From 5ce73712cc1f2b1f1121fd90c6d4741099e9f7cd Mon Sep 17 00:00:00 2001 From: William JCM Date: Thu, 1 Dec 2022 23:41:34 +0100 Subject: [PATCH 001/126] SaveTool: add a wrapper over ImGui::Checkbox(). This way, I can make it work like radio buttons or selectables. --- src/SaveTool/SaveTool.cpp | 5 +++++ src/SaveTool/SaveTool.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index c9e2315..4c6356c 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -412,6 +412,11 @@ void SaveTool::drawTooltip(Containers::StringView text, Float wrap_pos) { } } +bool +SaveTool::drawCheckbox(Containers::StringView label, bool value) { + return ImGui::Checkbox(label.data(), &value); +} + void SaveTool::openUri(Containers::StringView uri) { ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri.data()), nullptr, nullptr, SW_SHOWDEFAULT); } diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index c662203..6d21401 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -164,6 +164,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener // Convenience wrappers over ImGui stuff void drawHelpMarker(Containers::StringView text, Float wrap_pos = 0.0f); void drawTooltip(Containers::StringView text, Float wrap_pos = 0.0f); + bool drawCheckbox(Containers::StringView label, bool value); template auto drawUnsafeWidget(Functor func, Args... args) -> bool { -- 2.39.5 From e336b37d81b73733bb08ca1f330d6e8a728a550c Mon Sep 17 00:00:00 2001 From: William JCM Date: Thu, 1 Dec 2022 23:42:39 +0100 Subject: [PATCH 002/126] SaveTool: move the configuration to its own class. --- src/CMakeLists.txt | 2 + src/Configuration/Configuration.cpp | 152 ++++++++++ src/Configuration/Configuration.h | 46 ++++ src/SaveTool/SaveTool.cpp | 22 +- src/SaveTool/SaveTool.h | 11 - src/SaveTool/SaveTool_Initialisation.cpp | 59 +--- src/SaveTool/SaveTool_MainManager.cpp | 5 +- src/SaveTool/SaveTool_MassViewer.cpp | 15 +- src/SaveTool/SaveTool_drawMainMenu.cpp | 335 ++++++++++++----------- 9 files changed, 398 insertions(+), 249 deletions(-) create mode 100644 src/Configuration/Configuration.cpp create mode 100644 src/Configuration/Configuration.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 93d4596..939fd4c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -139,6 +139,8 @@ add_executable(MassBuilderSaveTool WIN32 SaveTool/SaveTool_MassViewer_Weapons.cpp SaveTool/SaveTool_ProfileManager.cpp SaveTool/SaveTool_UpdateChecker.cpp + Configuration/Configuration.h + Configuration/Configuration.cpp ProfileManager/ProfileManager.h ProfileManager/ProfileManager.cpp Profile/Profile.h diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp new file mode 100644 index 0000000..c8e1c49 --- /dev/null +++ b/src/Configuration/Configuration.cpp @@ -0,0 +1,152 @@ +#include +#include +#include + +#include "Configuration.h" + +Configuration::Configuration() { + Containers::String exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first(); + _conf = Utility::Configuration{Utility::Path::join(exe_path, "MassBuilderSaveTool.ini")}; + + if(_conf.hasValue("swap_interval")) { + _swapInterval = _conf.value("swap_interval"); + } + else { + _conf.setValue("swap_interval", 1); + } + + if(_conf.hasValue("frame_limit")) { + std::string frame_limit = _conf.value("frame_limit"); + if(frame_limit == "half_vsync") { + _swapInterval = 2; + } + _conf.removeValue("frame_limit"); + } + + if(_conf.hasValue("fps_cap")) { + _fpsCap = _conf.value("fps_cap"); + } + else { + _conf.setValue("fps_cap", 60.0f); + } + + if(_conf.hasValue("cheat_mode")) { + _cheatMode = _conf.value("cheat_mode"); + } + else { + _conf.setValue("cheat_mode", _cheatMode); + } + + if(_conf.hasValue("advanced_mode")) { + _advancedMode = _conf.value("advanced_mode"); + } + else { + _conf.setValue("advanced_mode", _advancedMode); + } + + if(_conf.hasValue("startup_update_check")) { + _checkUpdatesOnStartup = _conf.value("startup_update_check"); + } + else { + _conf.setValue("startup_update_check", _checkUpdatesOnStartup); + } + + if(_conf.hasValue("skip_disclaimer")) { + _skipDisclaimer = _conf.value("skip_disclaimer"); + } + else { + _conf.setValue("skip_disclaimer", _skipDisclaimer); + } +} + +Configuration::~Configuration() { + save(); +} + +void +Configuration::save() { + _conf.save(); +} + +int +Configuration::swapInterval() const { + return _swapInterval; +} + +void +Configuration::setSwapInterval(int interval) { + _swapInterval = interval; + _conf.setValue("swap_interval", _swapInterval); + _conf.save(); +} + +float +Configuration::fpsCap() const { + return _fpsCap; +} + +void +Configuration::setFpsCap(float cap) { + _fpsCap = cap; + _conf.setValue("fps_cap", _fpsCap); + _conf.save(); +} + +bool +Configuration::cheatMode() const { + return _cheatMode; +} + +void +Configuration::setCheatMode(bool enabled) { + _cheatMode = enabled; + _conf.setValue("cheat_mode", _cheatMode); + _conf.save(); +} + +bool +Configuration::advancedMode() const { + return _advancedMode; +} + +void +Configuration::setAdvancedMode(bool enabled) { + _advancedMode = enabled; + _conf.setValue("advanced_mode", _advancedMode); + _conf.save(); +} + +bool +Configuration::checkUpdatesOnStartup() const { + return _checkUpdatesOnStartup; +} + +void +Configuration::setCheckUpdatesOnStartup(bool mode) { + _checkUpdatesOnStartup = mode; + _conf.setValue("startup_update_check", _checkUpdatesOnStartup); + _conf.save(); +} + +bool +Configuration::skipDisclaimer() const { + return _skipDisclaimer; +} + +void +Configuration::setSkipDisclaimer(bool mode) { + _skipDisclaimer = mode; + _conf.setValue("skip_disclaimer", _skipDisclaimer); + _conf.save(); +} + +Configuration& +Configuration::instance() { + static Configuration conf{}; + return conf; +} + +Configuration& +conf() { + return Configuration::instance(); +} diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h new file mode 100644 index 0000000..c20cc5e --- /dev/null +++ b/src/Configuration/Configuration.h @@ -0,0 +1,46 @@ +#pragma once + +#include + +using namespace Corrade; + +class Configuration { + public: + static Configuration& instance(); + + ~Configuration(); + + void save(); + + int swapInterval() const; + void setSwapInterval(int interval); + + float fpsCap() const; + void setFpsCap(float cap); + + bool cheatMode() const; + void setCheatMode(bool enabled); + + bool advancedMode() const; + void setAdvancedMode(bool enabled); + + bool checkUpdatesOnStartup() const; + void setCheckUpdatesOnStartup(bool mode); + + bool skipDisclaimer() const; + void setSkipDisclaimer(bool mode); + + private: + explicit Configuration(); + + Utility::Configuration _conf; + + int _swapInterval = 1; + float _fpsCap = 60.0f; + bool _cheatMode = false; + bool _advancedMode = false; + bool _checkUpdatesOnStartup = true; + bool _skipDisclaimer = false; +}; + +Configuration& conf(); diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 4c6356c..a39d798 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -35,6 +35,7 @@ #include #include "../FontAwesome/IconsFontAwesome5.h" +#include "../Configuration/Configuration.h" #include "../Logger/Logger.h" using namespace Containers::Literals; @@ -130,7 +131,7 @@ SaveTool::SaveTool(const Arguments& arguments): LOG_INFO("Initialising update checker."); curl_global_init(CURL_GLOBAL_DEFAULT); - if(_checkUpdatesOnStartup) { + if(conf().checkUpdatesOnStartup()) { _queue.addToast(Toast::Type::Default, "Checking for updates..."_s); _updateThread = std::thread{[this]{ checkForUpdates(); }}; } @@ -141,7 +142,7 @@ SaveTool::SaveTool(const Arguments& arguments): GL::DebugOutput::setEnabled(GL::DebugOutput::Source::Api, GL::DebugOutput::Type::Other, {131185}, false); } - if(_skipDisclaimer) { + if(conf().skipDisclaimer()) { _uiState = UiState::Initialising; _initThread = std::thread{[this]{ initialiseManager(); }}; } @@ -159,14 +160,7 @@ SaveTool::~SaveTool() { LOG_INFO("Saving the configuration."); - _conf.setValue("cheat_mode"_s, _cheatMode); - _conf.setValue("advanced_mode"_s, _advancedMode); - _conf.setValue("startup_update_check"_s, _checkUpdatesOnStartup); - _conf.setValue("skip_disclaimer"_s, _skipDisclaimer); - _conf.setValue("swap_interval"_s, _swapInterval); - _conf.setValue("fps_cap"_s, _fpsCap); - - _conf.save(); + conf().save(); LOG_INFO("Exiting."); } @@ -182,8 +176,8 @@ void SaveTool::drawEvent() { swapBuffers(); - if(_swapInterval == 0 && _fpsCap < 301.0f) { - while(_timeline.currentFrameDuration() < (1.0f / _fpsCap)); + if(conf().swapInterval() == 0 && conf().fpsCap() < 301.0f) { + while(_timeline.currentFrameDuration() < (1.0f / conf().fpsCap())); } redraw(); @@ -344,7 +338,9 @@ void SaveTool::drawDisclaimer() { ImGui::Dummy({0.0f, 5.0f}); ImGui::Dummy({4.0f, 0.0f}); ImGui::SameLine(); - ImGui::Checkbox("Don't show next time", &_skipDisclaimer); + if(drawCheckbox("Don't show next time", conf().skipDisclaimer())) { + conf().setSkipDisclaimer(!conf().skipDisclaimer()); + } ImGui::TableSetColumnIndex(1); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {24.0f, 12.0f}); if(ImGui::Button("I understand the risks")) { diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index 6d21401..decc9c7 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -21,7 +21,6 @@ #include #include -#include #include #ifdef SAVETOOL_DEBUG_BUILD #include @@ -198,7 +197,6 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void checkForUpdates(); - Utility::Configuration _conf{"MassBuilderSaveTool.ini"_s}; Utility::Resource _rs{"assets"_s}; // GUI-related members @@ -263,12 +261,6 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener }; Containers::StaticArray<2, efsw::WatchID> _watchIDs; - int _swapInterval = 1; - float _fpsCap = 60.0f; - - bool _skipDisclaimer{false}; - bool _checkUpdatesOnStartup{true}; - bool _updateAvailable{false}; Containers::String _latestVersion; Containers::String _releaseLink; @@ -291,8 +283,5 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener bool _bLaunchersDirty{false}; bool _eLaunchersDirty{false}; - bool _cheatMode{false}; - bool _advancedMode{false}; - Timeline _timeline; }; diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/SaveTool/SaveTool_Initialisation.cpp index 5f5ed49..ad1ec60 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/SaveTool/SaveTool_Initialisation.cpp @@ -24,6 +24,7 @@ #include +#include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5Brands.h" #include "../Logger/Logger.h" @@ -51,62 +52,8 @@ void SaveTool::initEvent(SDL_Event& event) { void SaveTool::initialiseConfiguration() { LOG_INFO("Reading configuration file."); - if(_conf.hasValue("cheat_mode"_s)) { - _cheatMode = _conf.value("cheat_mode"_s); - } - else { - _conf.setValue("cheat_mode"_s, _cheatMode); - } - - if(_conf.hasValue("advanced_mode"_s)) { - _advancedMode = _conf.value("advanced_mode"_s); - } - else { - _conf.setValue("advanced_mode"_s, _advancedMode); - } - - if(_conf.hasValue("startup_update_check"_s)) { - _checkUpdatesOnStartup = _conf.value("startup_update_check"_s); - } - else { - _conf.setValue("startup_update_check"_s, _checkUpdatesOnStartup); - } - - if(_conf.hasValue("skip_disclaimer"_s)) { - _skipDisclaimer = _conf.value("skip_disclaimer"_s); - } - else { - _conf.setValue("skip_disclaimer"_s, _skipDisclaimer); - } - - if(_conf.hasValue("swap_interval"_s)) { - _swapInterval = _conf.value("swap_interval"_s); - } - else { - _conf.setValue("swap_interval"_s, 1); - } - - if(_conf.hasValue("fps_cap"_s)) { - _fpsCap = _conf.value("fps_cap"); - } - else { - _conf.setValue("fps_cap", 60.0f); - } - - if(_conf.hasValue("frame_limit"_s)) { - std::string frame_limit = _conf.value("frame_limit"_s); - if(frame_limit == "half_vsync"_s) { - _swapInterval = 2; - } - _conf.removeValue("frame_limit"_s); - } - - setSwapInterval(_swapInterval); - if(_swapInterval == 0) { - setMinimalLoopPeriod(0); - } - - _conf.save(); + setSwapInterval(conf().swapInterval()); + setMinimalLoopPeriod(0); } void SaveTool::initialiseGui() { diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index 2f0d1c7..d8736d8 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -21,6 +21,7 @@ #include +#include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../Maps/LastMissionId.h" #include "../Maps/StoryProgress.h" @@ -224,7 +225,7 @@ void SaveTool::drawGeneralInfo() { } } - if(!_cheatMode) { + if(!conf().cheatMode()) { return; } @@ -403,7 +404,7 @@ void SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter get ImGui::TableSetColumnIndex(2); if(getter() != -1) { ImGui::Text("%i", getter()); - if(_cheatMode) { + if(conf().cheatMode()) { ImGui::TableSetColumnIndex(3); ImGui::PushID(name.data()); static Int var = 0; diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/SaveTool/SaveTool_MassViewer.cpp index 7ff8c5f..5bc6e36 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/SaveTool/SaveTool_MassViewer.cpp @@ -19,6 +19,7 @@ #include +#include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../Maps/Accessories.h" #define STYLENAMES_DEFINITION @@ -393,10 +394,10 @@ auto SaveTool::drawCustomStyle(CustomStyle& style) -> DCSResult { void SaveTool::drawDecalEditor(Decal& decal) { ImGui::Text("ID: %i", decal.id); - if(ImGui::BeginTable("##DecalTable", _advancedMode ? 2 : 1, ImGuiTableFlags_BordersInnerV)) { + if(ImGui::BeginTable("##DecalTable", conf().advancedMode() ? 2 : 1, ImGuiTableFlags_BordersInnerV)) { ImGui::TableSetupColumn("##Normal", ImGuiTableColumnFlags_WidthStretch); - if(_advancedMode) { + if(conf().advancedMode()) { ImGui::TableSetupColumn("##Advanced", ImGuiTableColumnFlags_WidthStretch); } @@ -442,7 +443,7 @@ void SaveTool::drawDecalEditor(Decal& decal) { ImGui::Checkbox("##Wrap", &decal.wrap); ImGui::EndGroup(); - if(_advancedMode) { + if(conf().advancedMode()) { ImGui::TableNextColumn(); ImGui::TextColored(ImColor(255, 255, 0), ICON_FA_EXCLAMATION_TRIANGLE); @@ -635,11 +636,11 @@ void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView +#include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5Brands.h" #include "SaveTool.h" void SaveTool::drawMainMenu() { - if(ImGui::BeginMainMenuBar()) { - if(ImGui::BeginMenu("Save Tool##SaveToolMenu")) { - if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open game data directory", Utility::Path::exists(_gameDataDir))) { - if(ImGui::MenuItem(ICON_FA_COG " Configuration", nullptr, false, Utility::Path::exists(_configDir))) { - openUri(Utility::Path::toNativeSeparators(_configDir)); - } + if(!ImGui::BeginMainMenuBar()) { + return; + } - if(ImGui::MenuItem(ICON_FA_SAVE " Saves", nullptr, false, Utility::Path::exists(_saveDir))) { - openUri(Utility::Path::toNativeSeparators(_saveDir)); - } - - if(ImGui::MenuItem(ICON_FA_IMAGE " Screenshots", nullptr, false, Utility::Path::exists(_screenshotsDir))) { - openUri(Utility::Path::toNativeSeparators(_screenshotsDir)); - } - - ImGui::EndMenu(); + if(ImGui::BeginMenu("Save Tool##SaveToolMenu")) { + if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open game data directory", Utility::Path::exists(_gameDataDir))) { + if(ImGui::MenuItem(ICON_FA_COG " Configuration", nullptr, false, Utility::Path::exists(_configDir))) { + openUri(Utility::Path::toNativeSeparators(_configDir)); } - if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open manager directory")) { - if(ImGui::MenuItem(ICON_FA_FILE_ARCHIVE " Profile backups", nullptr, false, Utility::Path::exists(_backupsDir))) { - openUri(Utility::Path::toNativeSeparators(_backupsDir)); - } - - if(ImGui::MenuItem(ICON_FA_EXCHANGE_ALT " Staging area", nullptr, false, Utility::Path::exists(_stagingDir))) { - openUri(Utility::Path::toNativeSeparators(_stagingDir)); - } - - ImGui::EndMenu(); + if(ImGui::MenuItem(ICON_FA_SAVE " Saves", nullptr, false, Utility::Path::exists(_saveDir))) { + openUri(Utility::Path::toNativeSeparators(_saveDir)); } - ImGui::Separator(); + if(ImGui::MenuItem(ICON_FA_IMAGE " Screenshots", nullptr, false, Utility::Path::exists(_screenshotsDir))) { + openUri(Utility::Path::toNativeSeparators(_screenshotsDir)); + } - if(ImGui::BeginMenu(ICON_FA_COG " Settings")) { - ImGui::BeginGroup(); - drawAlignedText("Vertical sync:"); - if(_swapInterval == 0) { - drawAlignedText("FPS cap:"); - } - ImGui::EndGroup(); + ImGui::EndMenu(); + } - ImGui::SameLine(); + if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open manager directory")) { + if(ImGui::MenuItem(ICON_FA_FILE_ARCHIVE " Profile backups", nullptr, false, Utility::Path::exists(_backupsDir))) { + openUri(Utility::Path::toNativeSeparators(_backupsDir)); + } - ImGui::BeginGroup(); + if(ImGui::MenuItem(ICON_FA_EXCHANGE_ALT " Staging area", nullptr, false, Utility::Path::exists(_stagingDir))) { + openUri(Utility::Path::toNativeSeparators(_stagingDir)); + } - static const char* framelimit_labels[] = { - "Off", - "Every VBLANK", - "Every second VBLANK", - "Every third VBLANK", - }; + ImGui::EndMenu(); + } - ImGui::PushItemWidth(300.0f); + ImGui::Separator(); - if(ImGui::BeginCombo("##FrameLimit", framelimit_labels[_swapInterval])) { - for(int i = 0; i <= 3; i++) { - if(ImGui::Selectable(framelimit_labels[i], _swapInterval == i)) { - _swapInterval = i; - setSwapInterval(i); - if(i == 0) { - setMinimalLoopPeriod(0); - } + if(ImGui::BeginMenu(ICON_FA_COG " Settings")) { + ImGui::BeginGroup(); + drawAlignedText("Vertical sync:"); + if(conf().swapInterval() == 0) { + drawAlignedText("FPS cap:"); + } + ImGui::EndGroup(); + + ImGui::SameLine(); + + ImGui::BeginGroup(); + + static const char* framelimit_labels[] = { + "Off", + "Every VBLANK", + "Every second VBLANK", + "Every third VBLANK", + }; + + ImGui::PushItemWidth(300.0f); + + if(ImGui::BeginCombo("##FrameLimit", framelimit_labels[conf().swapInterval()])) { + for(int i = 0; i <= 3; i++) { + if(ImGui::Selectable(framelimit_labels[i], conf().swapInterval() == i)) { + conf().setSwapInterval(i); + setSwapInterval(i); + if(i == 0) { + setMinimalLoopPeriod(0); } } - - ImGui::EndCombo(); } - if(_swapInterval == 0) { - ImGui::SliderFloat("##FpsCapSlider", &_fpsCap, 15.0f, 301.0f, - _fpsCap != 301.0f ? "%.0f" : "Uncapped", ImGuiSliderFlags_AlwaysClamp); + ImGui::EndCombo(); + } + + if(conf().swapInterval() == 0) { + static float fps_cap = conf().fpsCap(); + if(ImGui::SliderFloat("##FpsCapSlider", &fps_cap, 15.0f, 301.0f, + conf().fpsCap() != 301.0f ? "%.0f" : "Uncapped", ImGuiSliderFlags_AlwaysClamp)) + { + conf().setFpsCap(fps_cap); } + } - ImGui::PopItemWidth(); + ImGui::PopItemWidth(); - ImGui::EndGroup(); + ImGui::EndGroup(); - ImGui::Checkbox("Cheat mode", &_cheatMode); + if(drawCheckbox("Cheat mode", conf().cheatMode())) { + conf().setCheatMode(!conf().cheatMode()); + } + ImGui::SameLine(); + ImGui::AlignTextToFramePadding(); + drawHelpMarker("This gives access to save edition features that can be considered cheats.", + Float(windowSize().x()) * 0.4f); + + if(drawCheckbox("Advanced mode", conf().advancedMode())) { + conf().setAdvancedMode(!conf().advancedMode()); + } + ImGui::SameLine(); + ImGui::AlignTextToFramePadding(); + drawHelpMarker("This gives access to editing values that have unknown purposes or are undocumented.", + Float(windowSize().x()) * 0.4f); + + if(drawCheckbox("Check for updates on startup", conf().checkUpdatesOnStartup())) { + conf().setCheckUpdatesOnStartup(!conf().checkUpdatesOnStartup()); + } + ImGui::SameLine(); + if(ImGui::Button(ICON_FA_SYNC_ALT " Check now")) { + _queue.addToast(Toast::Type::Default, "Checking for updates..."); + _updateThread = std::thread{[this]{ checkForUpdates(); }}; + } + + if(_updateAvailable) { + drawAlignedText("Version %s is available.", _latestVersion.data()); + if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) { + openUri(_releaseLink); + } ImGui::SameLine(); - ImGui::AlignTextToFramePadding(); - drawHelpMarker("This gives access to save edition features that can be considered cheats.", - Float(windowSize().x()) * 0.4f); - - ImGui::Checkbox("Advanced mode", &_advancedMode); - ImGui::SameLine(); - ImGui::AlignTextToFramePadding(); - drawHelpMarker("This gives access to editing values that have unknown purposes or are undocumented.", - Float(windowSize().x()) * 0.4f); - - ImGui::Checkbox("Check for updates on startup", &_checkUpdatesOnStartup); - ImGui::SameLine(); - if(ImGui::Button(ICON_FA_SYNC_ALT " Check now")) { - _queue.addToast(Toast::Type::Default, "Checking for updates..."); - _updateThread = std::thread{[this]{ checkForUpdates(); }}; + if(ImGui::Button(ICON_FA_DOWNLOAD " Download now")) { + openUri(_downloadLink); } - - if(_updateAvailable) { - drawAlignedText("Version %s is available.", _latestVersion.data()); - if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) { - openUri(_releaseLink); - } - ImGui::SameLine(); - if(ImGui::Button(ICON_FA_DOWNLOAD " Download now")) { - openUri(_downloadLink); - } - } - - ImGui::Checkbox("Skip disclaimer", &_skipDisclaimer); - - ImGui::EndMenu(); } - ImGui::Separator(); - - if(ImGui::MenuItem(ICON_FA_SIGN_OUT_ALT " Quit##QuitMenuItem")) { - exit(EXIT_SUCCESS); + if(drawCheckbox("Skip disclaimer", conf().skipDisclaimer())) { + conf().setSkipDisclaimer(!conf().skipDisclaimer()); } ImGui::EndMenu(); } - if(ImGui::BeginMenu("Game##GameMenu")) { - if(ImGui::MenuItem(ICON_FA_PLAY " Run demo##RunDemoMenuItem")) { - openUri("steam://run/1048390"); - } - drawTooltip("Will not work if you have the full game."); + ImGui::Separator(); - if(ImGui::MenuItem(ICON_FA_PLAY " Run full game##RunFullGameMenuItem")) { - openUri("steam://run/956680"); - } - - ImGui::Separator(); - - if(ImGui::BeginMenu(ICON_FA_DISCORD " Discord communities")) { - if(ImGui::MenuItem("Official server")) { - openUri("https://discord.gg/sekai-project"); - } - - if(ImGui::MenuItem("Community server")) { - openUri("https://discord.gg/massbuildercommunity"); - } - - ImGui::EndMenu(); - } - - ImGui::EndMenu(); + if(ImGui::MenuItem(ICON_FA_SIGN_OUT_ALT " Quit##QuitMenuItem")) { + exit(EXIT_SUCCESS); } - #ifdef SAVETOOL_DEBUG_BUILD - if(ImGui::BeginMenu("Debug tools")) { - ImGui::MenuItem("ImGui demo window", nullptr, &_demoWindow); - ImGui::MenuItem("ImGui style editor", nullptr, &_styleEditor); - ImGui::MenuItem("ImGui metrics window", nullptr, &_metricsWindow); - - ImGui::EndMenu(); - } - #endif - - if(ImGui::BeginMenu("Help")) { - if(ImGui::BeginMenu(ICON_FA_KEYBOARD " Keyboard shortcuts")) { - ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text."); - ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields."); - ImGui::BulletText("While inputing text:\n"); - ImGui::Indent(); - ImGui::BulletText("CTRL+Left/Right to word jump."); - ImGui::BulletText("CTRL+A or double-click to select all."); - ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste."); - ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo."); - ImGui::BulletText("ESCAPE to revert."); - ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract."); - ImGui::Unindent(); - ImGui::EndMenu(); - } - ImGui::MenuItem(ICON_FA_INFO_CIRCLE " About", nullptr, &_aboutPopup); - - ImGui::EndMenu(); - } - - if(_gameCheckTimerId != 0) { - if(ImGui::BeginTable("##MainMenuLayout", 2)) { - ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##GameState", ImGuiTableColumnFlags_WidthFixed); - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(1); - drawGameState(); - - ImGui::EndTable(); - } - } - - ImGui::EndMainMenuBar(); + ImGui::EndMenu(); } + + if(ImGui::BeginMenu("Game##GameMenu")) { + if(ImGui::MenuItem(ICON_FA_PLAY " Run demo##RunDemoMenuItem")) { + openUri("steam://run/1048390"); + } + drawTooltip("Will not work if you have the full game."); + + if(ImGui::MenuItem(ICON_FA_PLAY " Run full game##RunFullGameMenuItem")) { + openUri("steam://run/956680"); + } + + ImGui::Separator(); + + if(ImGui::BeginMenu(ICON_FA_DISCORD " Discord communities")) { + if(ImGui::MenuItem("Official server")) { + openUri("https://discord.gg/sekai-project"); + } + + if(ImGui::MenuItem("Community server")) { + openUri("https://discord.gg/massbuildercommunity"); + } + + ImGui::EndMenu(); + } + + ImGui::EndMenu(); + } + + #ifdef SAVETOOL_DEBUG_BUILD + if(ImGui::BeginMenu("Debug tools")) { + ImGui::MenuItem("ImGui demo window", nullptr, &_demoWindow); + ImGui::MenuItem("ImGui style editor", nullptr, &_styleEditor); + ImGui::MenuItem("ImGui metrics window", nullptr, &_metricsWindow); + + ImGui::EndMenu(); + } + #endif + + if(ImGui::BeginMenu("Help")) { + if(ImGui::BeginMenu(ICON_FA_KEYBOARD " Keyboard shortcuts")) { + ImGui::BulletText("CTRL+Click on a slider or drag box to input value as text."); + ImGui::BulletText("TAB/SHIFT+TAB to cycle through keyboard editable fields."); + ImGui::BulletText("While inputing text:\n"); + ImGui::Indent(); + ImGui::BulletText("CTRL+Left/Right to word jump."); + ImGui::BulletText("CTRL+A or double-click to select all."); + ImGui::BulletText("CTRL+X/C/V to use clipboard cut/copy/paste."); + ImGui::BulletText("CTRL+Z,CTRL+Y to undo/redo."); + ImGui::BulletText("ESCAPE to revert."); + ImGui::BulletText("You can apply arithmetic operators +,*,/ on numerical values.\nUse +- to subtract."); + ImGui::Unindent(); + ImGui::EndMenu(); + } + ImGui::MenuItem(ICON_FA_INFO_CIRCLE " About", nullptr, &_aboutPopup); + + ImGui::EndMenu(); + } + + if(_gameCheckTimerId != 0) { + if(ImGui::BeginTable("##MainMenuLayout", 2)) { + ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); + ImGui::TableSetupColumn("##GameState", ImGuiTableColumnFlags_WidthFixed); + + ImGui::TableNextRow(); + ImGui::TableSetColumnIndex(1); + drawGameState(); + + ImGui::EndTable(); + } + } + + ImGui::EndMainMenuBar(); } -- 2.39.5 From c1701c19f41e0d956721e4b08c48a7b2d9d62c57 Mon Sep 17 00:00:00 2001 From: William JCM Date: Sat, 3 Dec 2022 16:49:18 +0100 Subject: [PATCH 003/126] Configuration: add missing licence text. --- src/Configuration/Configuration.cpp | 16 ++++++++++++++++ src/Configuration/Configuration.h | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index c8e1c49..c1a4545 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -1,3 +1,19 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2022 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include #include #include diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index c20cc5e..5b9a0ca 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -1,5 +1,21 @@ #pragma once +// MassBuilderSaveTool +// Copyright (C) 2021-2022 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + #include using namespace Corrade; -- 2.39.5 From 3c2cb001ff816959c77453925ddb0dd7a4c7e967 Mon Sep 17 00:00:00 2001 From: William JCM Date: Sat, 3 Dec 2022 16:49:39 +0100 Subject: [PATCH 004/126] Match the new coding style I use. --- src/Logger/Logger.h | 4 +- src/Logger/MagnumLogBuffer.cpp | 7 +- src/Mass/Mass.cpp | 58 ++++-- src/Mass/Mass.h | 100 +++++----- src/Mass/Mass_Armour.cpp | 30 ++- src/Mass/Mass_DecalsAccessories.cpp | 12 +- src/Mass/Mass_Frame.cpp | 36 ++-- src/Mass/Mass_Styles.cpp | 15 +- src/Mass/Mass_Weapons.cpp | 60 ++++-- src/MassManager/MassManager.cpp | 33 ++-- src/MassManager/MassManager.h | 16 +- src/Profile/Profile.cpp | 171 ++++++++++++------ src/Profile/Profile.h | 50 ++--- src/ProfileManager/ProfileManager.cpp | 33 ++-- src/ProfileManager/ProfileManager.h | 18 +- src/SaveTool/SaveTool.cpp | 57 ++++-- src/SaveTool/SaveTool.h | 24 +-- src/SaveTool/SaveTool_FileWatcher.cpp | 16 +- src/SaveTool/SaveTool_Initialisation.cpp | 24 ++- src/SaveTool/SaveTool_MainManager.cpp | 30 ++- src/SaveTool/SaveTool_MassViewer.cpp | 21 ++- src/SaveTool/SaveTool_MassViewer_Armour.cpp | 6 +- src/SaveTool/SaveTool_MassViewer_Frame.cpp | 16 +- src/SaveTool/SaveTool_MassViewer_Weapons.cpp | 11 +- src/SaveTool/SaveTool_ProfileManager.cpp | 12 +- src/SaveTool/SaveTool_UpdateChecker.cpp | 10 +- src/SaveTool/SaveTool_drawAbout.cpp | 19 +- src/SaveTool/SaveTool_drawMainMenu.cpp | 3 +- src/ToastQueue/ToastQueue.cpp | 44 +++-- src/ToastQueue/ToastQueue.h | 14 +- src/UESaveFile/BinaryReader.cpp | 57 ++++-- src/UESaveFile/BinaryReader.h | 40 ++-- src/UESaveFile/BinaryWriter.cpp | 60 ++++-- src/UESaveFile/BinaryWriter.h | 46 ++--- src/UESaveFile/Debug.cpp | 15 +- src/UESaveFile/PropertySerialiser.cpp | 45 +++-- src/UESaveFile/PropertySerialiser.h | 33 ++-- ...stractUnrealCollectionPropertySerialiser.h | 11 +- .../AbstractUnrealPropertySerialiser.h | 13 +- .../AbstractUnrealStructSerialiser.h | 8 +- .../Serialisers/ArrayPropertySerialiser.cpp | 12 +- .../Serialisers/ArrayPropertySerialiser.h | 9 +- .../Serialisers/BoolPropertySerialiser.cpp | 14 +- .../Serialisers/BoolPropertySerialiser.h | 11 +- .../Serialisers/BytePropertySerialiser.cpp | 14 +- .../Serialisers/BytePropertySerialiser.h | 11 +- .../Serialisers/ColourPropertySerialiser.cpp | 18 +- .../Serialisers/ColourPropertySerialiser.h | 9 +- .../DateTimePropertySerialiser.cpp | 12 +- .../Serialisers/DateTimePropertySerialiser.h | 9 +- .../Serialisers/EnumPropertySerialiser.cpp | 14 +- .../Serialisers/EnumPropertySerialiser.h | 11 +- .../Serialisers/FloatPropertySerialiser.cpp | 14 +- .../Serialisers/FloatPropertySerialiser.h | 11 +- .../Serialisers/GuidPropertySerialiser.cpp | 12 +- .../Serialisers/GuidPropertySerialiser.h | 9 +- .../Serialisers/IntPropertySerialiser.cpp | 12 +- .../Serialisers/IntPropertySerialiser.h | 9 +- .../Serialisers/MapPropertySerialiser.cpp | 12 +- .../Serialisers/MapPropertySerialiser.h | 9 +- .../ResourcePropertySerialiser.cpp | 12 +- .../Serialisers/ResourcePropertySerialiser.h | 9 +- .../Serialisers/RotatorPropertySerialiser.cpp | 12 +- .../Serialisers/RotatorPropertySerialiser.h | 9 +- .../Serialisers/SetPropertySerialiser.cpp | 12 +- .../Serialisers/SetPropertySerialiser.h | 9 +- .../Serialisers/StringPropertySerialiser.cpp | 20 +- .../Serialisers/StringPropertySerialiser.h | 11 +- .../Serialisers/StructSerialiser.cpp | 33 ++-- src/UESaveFile/Serialisers/StructSerialiser.h | 29 +-- .../Serialisers/TextPropertySerialiser.cpp | 12 +- .../Serialisers/TextPropertySerialiser.h | 9 +- .../Serialisers/UnrealPropertySerialiser.h | 27 +-- .../Vector2DPropertySerialiser.cpp | 12 +- .../Serialisers/Vector2DPropertySerialiser.h | 9 +- .../Serialisers/VectorPropertySerialiser.cpp | 12 +- .../Serialisers/VectorPropertySerialiser.h | 9 +- src/UESaveFile/Types/GenericStructProperty.h | 2 +- src/UESaveFile/UESaveFile.cpp | 24 ++- src/UESaveFile/UESaveFile.h | 12 +- 80 files changed, 1079 insertions(+), 715 deletions(-) diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index 7450754..370c08b 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -49,7 +49,7 @@ class Logger { Logger(Logger&&) = delete; Logger& operator=(Logger&&) = delete; - static auto instance() -> Logger&; + static Logger& instance(); void initialise(); @@ -73,7 +73,7 @@ class Logger { std::mutex _logMutex{}; }; -auto logger() -> Logger&; +Logger& logger(); #define LOG(entry_type, message) logger().lockMutex(); \ logger().log(EntryType::entry_type, \ diff --git a/src/Logger/MagnumLogBuffer.cpp b/src/Logger/MagnumLogBuffer.cpp index e2e3df9..6436009 100644 --- a/src/Logger/MagnumLogBuffer.cpp +++ b/src/Logger/MagnumLogBuffer.cpp @@ -16,7 +16,12 @@ #include "MagnumLogBuffer.h" -MagnumLogBuffer::MagnumLogBuffer(EntryType type): std::stringbuf(std::ios_base::out), _type{type} {} +MagnumLogBuffer::MagnumLogBuffer(EntryType type): + std::stringbuf(std::ios_base::out), + _type{type} +{ + //ctor +} MagnumLogBuffer::~MagnumLogBuffer() = default; diff --git a/src/Mass/Mass.cpp b/src/Mass/Mass.cpp index 2608948..98f064f 100644 --- a/src/Mass/Mass.cpp +++ b/src/Mass/Mass.cpp @@ -42,11 +42,13 @@ Mass::Mass(Containers::StringView path) { refreshValues(); } -auto Mass::lastError() -> Containers::StringView { +Containers::StringView +Mass::lastError() { return _lastError; } -auto Mass::getNameFromFile(Containers::StringView path) -> Containers::Optional { +Containers::Optional +Mass::getNameFromFile(Containers::StringView path) { if(!Utility::Path::exists(path)) { LOG_ERROR_FORMAT("{} couldn't be found.", path); return Containers::NullOpt; @@ -76,7 +78,8 @@ auto Mass::getNameFromFile(Containers::StringView path) -> Containers::Optional< return {name_prop->value}; } -void Mass::refreshValues() { +void +Mass::refreshValues() { LOG_INFO_FORMAT("Refreshing values for {}.", _filename); logger().lockMutex(); @@ -229,16 +232,19 @@ void Mass::refreshValues() { _state = State::Valid; } -auto Mass::filename() -> Containers::StringView { +Containers::StringView +Mass::filename() { return _filename; } -auto Mass::name() -> Containers::StringView { +Containers::StringView +Mass::name() { CORRADE_INTERNAL_ASSERT(_name); return *_name; } -auto Mass::setName(Containers::StringView new_name) -> bool { +bool +Mass::setName(Containers::StringView new_name) { _name = {new_name}; auto unit_data = _mass->at("UnitData"_s); @@ -267,19 +273,22 @@ auto Mass::setName(Containers::StringView new_name) -> bool { return true; } -auto Mass::state() -> State { +Mass::State +Mass::state() { return _state; } -auto Mass::dirty() const -> bool { +bool Mass::dirty() const { return _dirty; } -void Mass::setDirty(bool dirty) { +void +Mass::setDirty(bool dirty) { _dirty = dirty; } -void Mass::getTuning() { +void +Mass::getTuning() { getTuningCategory(MASS_ENGINE, _tuning.engineId, MASS_GEARS, _tuning.gearIds); if(_state == State::Invalid) { @@ -299,35 +308,43 @@ void Mass::getTuning() { } } -auto Mass::engine() -> Int& { +Int& +Mass::engine() { return _tuning.engineId; } -auto Mass::gears() -> Containers::ArrayView { +Containers::ArrayView +Mass::gears() { return _tuning.gearIds; } -auto Mass::os() -> Int& { +Int& +Mass::os() { return _tuning.osId; } -auto Mass::modules() -> Containers::ArrayView { +Containers::ArrayView +Mass::modules() { return _tuning.moduleIds; } -auto Mass::architecture() -> Int& { +Int& +Mass::architecture() { return _tuning.archId; } -auto Mass::techs() -> Containers::ArrayView { +Containers::ArrayView +Mass::techs() { return _tuning.techIds; } -auto Mass::account() -> Containers::StringView { +Containers::StringView +Mass::account() { return _account; } -auto Mass::updateAccount(Containers::StringView new_account) -> bool { +bool +Mass::updateAccount(Containers::StringView new_account) { _account = new_account; auto account = _mass->at(MASS_ACCOUNT); @@ -347,8 +364,9 @@ auto Mass::updateAccount(Containers::StringView new_account) -> bool { return true; } -void Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id, - Containers::StringView small_nodes_prop_name, Containers::ArrayView small_nodes_ids) +void +Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id, + Containers::StringView small_nodes_prop_name, Containers::ArrayView small_nodes_ids) { LOG_INFO_FORMAT("Getting tuning data ({}, {}).", big_node_prop_name, small_nodes_prop_name); diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index 733c07f..ed991c7 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -45,10 +45,6 @@ struct ArrayProperty; class Mass { public: - enum class State : UnsignedByte { - Empty, Invalid, Valid - }; - explicit Mass(Containers::StringView path); Mass(const Mass&) = delete; @@ -57,96 +53,100 @@ class Mass { Mass(Mass&&) = default; Mass& operator=(Mass&&) = default; - auto lastError() -> Containers::StringView; + Containers::StringView lastError(); - static auto getNameFromFile(Containers::StringView path) -> Containers::Optional; + static Containers::Optional getNameFromFile(Containers::StringView path); void refreshValues(); - auto filename() -> Containers::StringView; + Containers::StringView filename(); - auto name() -> Containers::StringView; - auto setName(Containers::StringView new_name) -> bool; + Containers::StringView name(); + bool setName(Containers::StringView new_name); - auto state() -> State; + enum class State : UnsignedByte { + Empty, Invalid, Valid + }; - auto dirty() const -> bool; + State state(); + + bool dirty() const; void setDirty(bool dirty = true); - auto jointSliders() -> Joints&; + Joints& jointSliders(); void getJointSliders(); - auto writeJointSliders() -> bool; + bool writeJointSliders(); - auto frameStyles() -> Containers::ArrayView; + Containers::ArrayView frameStyles(); void getFrameStyles(); - auto writeFrameStyles() -> bool; + bool writeFrameStyles(); - auto eyeFlareColour() -> Color4&; + Color4& eyeFlareColour(); void getEyeFlareColour(); - auto writeEyeFlareColour() -> bool; + bool writeEyeFlareColour(); - auto frameCustomStyles() -> Containers::ArrayView; + Containers::ArrayView frameCustomStyles(); void getFrameCustomStyles(); - auto writeFrameCustomStyle(UnsignedLong index) -> bool; + bool writeFrameCustomStyle(UnsignedLong index); - auto armourParts() -> Containers::ArrayView; + Containers::ArrayView armourParts(); void getArmourParts(); - auto writeArmourPart(ArmourSlot slot) -> bool; + bool writeArmourPart(ArmourSlot slot); - auto bulletLauncherAttachmentStyle() -> BulletLauncherAttachmentStyle&; - auto bulletLauncherAttachments() -> Containers::ArrayView; + BulletLauncherAttachmentStyle& bulletLauncherAttachmentStyle(); + Containers::ArrayView bulletLauncherAttachments(); void getBulletLauncherAttachments(); - auto writeBulletLauncherAttachments() -> bool; + bool writeBulletLauncherAttachments(); - auto armourCustomStyles() -> Containers::ArrayView; + Containers::ArrayView armourCustomStyles(); void getArmourCustomStyles(); - auto writeArmourCustomStyle(UnsignedLong index) -> bool; + bool writeArmourCustomStyle(UnsignedLong index); - auto meleeWeapons() -> Containers::ArrayView; + Containers::ArrayView meleeWeapons(); void getMeleeWeapons(); - auto writeMeleeWeapons() -> bool; + bool writeMeleeWeapons(); - auto shields() -> Containers::ArrayView; + Containers::ArrayView shields(); void getShields(); - auto writeShields() -> bool; + bool writeShields(); - auto bulletShooters() -> Containers::ArrayView; + Containers::ArrayView bulletShooters(); void getBulletShooters(); - auto writeBulletShooters() -> bool; + bool writeBulletShooters(); - auto energyShooters() -> Containers::ArrayView; + Containers::ArrayView energyShooters(); void getEnergyShooters(); - auto writeEnergyShooters() -> bool; + bool writeEnergyShooters(); - auto bulletLaunchers() -> Containers::ArrayView; + Containers::ArrayView bulletLaunchers(); void getBulletLaunchers(); - auto writeBulletLaunchers() -> bool; + bool writeBulletLaunchers(); - auto energyLaunchers() -> Containers::ArrayView; + Containers::ArrayView energyLaunchers(); void getEnergyLaunchers(); - auto writeEnergyLaunchers() -> bool; + bool writeEnergyLaunchers(); - auto globalStyles() -> Containers::ArrayView; + Containers::ArrayView globalStyles(); void getGlobalStyles(); - auto writeGlobalStyle(UnsignedLong index) -> bool; + bool writeGlobalStyle(UnsignedLong index); void getTuning(); - auto engine() -> Int&; - auto gears() -> Containers::ArrayView; + Int& engine(); + Containers::ArrayView gears(); - auto os() -> Int&; - auto modules() -> Containers::ArrayView; + Int& os(); + Containers::ArrayView modules(); - auto architecture() -> Int&; - auto techs() -> Containers::ArrayView; + Int& architecture(); + Containers::ArrayView techs(); - auto account() -> Containers::StringView; - auto updateAccount(Containers::StringView new_account) -> bool; + Containers::StringView account(); + bool updateAccount(Containers::StringView new_account); private: void getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array); - auto writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool; + bool writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array); void getDecals(Containers::ArrayView decals, ArrayProperty* decal_array); void writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array); @@ -155,7 +155,7 @@ class Mass { void writeAccessories(Containers::ArrayView accessories, ArrayProperty* accs_array); void getWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array); - auto writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) -> bool; + bool writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array); void getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id, Containers::StringView small_nodes_prop_name, Containers::ArrayView small_nodes_ids); diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 8af925a..4a656c6 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -29,11 +29,13 @@ using namespace Containers::Literals; -auto Mass::armourParts() -> Containers::ArrayView { +Containers::ArrayView +Mass::armourParts() { return _armour.parts; } -void Mass::getArmourParts() { +void +Mass::getArmourParts() { LOG_INFO("Getting armour parts."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -117,7 +119,8 @@ void Mass::getArmourParts() { } } -auto Mass::writeArmourPart(ArmourSlot slot) -> bool { +bool +Mass::writeArmourPart(ArmourSlot slot) { LOG_INFO_FORMAT("Writing armour part in slot {}.", static_cast(slot)); auto& part = *std::find_if(_armour.parts.begin(), _armour.parts.end(), [&slot](const ArmourPart& part){ return slot == part.slot; }); @@ -195,15 +198,18 @@ auto Mass::writeArmourPart(ArmourSlot slot) -> bool { return true; } -auto Mass::bulletLauncherAttachmentStyle() -> BulletLauncherAttachmentStyle& { +BulletLauncherAttachmentStyle& +Mass::bulletLauncherAttachmentStyle() { return _armour.blAttachmentStyle; } -auto Mass::bulletLauncherAttachments() -> Containers::ArrayView { +Containers::ArrayView +Mass::bulletLauncherAttachments() { return _armour.blAttachment; } -void Mass::getBulletLauncherAttachments() { +void +Mass::getBulletLauncherAttachments() { LOG_INFO("Getting the bullet launcher attachment data."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -274,7 +280,8 @@ void Mass::getBulletLauncherAttachments() { } } -auto Mass::writeBulletLauncherAttachments() -> bool { +bool +Mass::writeBulletLauncherAttachments() { LOG_INFO("Writing bullet launcher attachments."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -373,11 +380,13 @@ auto Mass::writeBulletLauncherAttachments() -> bool { return true; } -auto Mass::armourCustomStyles() -> Containers::ArrayView { +Containers::ArrayView +Mass::armourCustomStyles() { return _armour.customStyles; } -void Mass::getArmourCustomStyles() { +void +Mass::getArmourCustomStyles() { LOG_INFO("Getting the custom armour styles."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -404,7 +413,8 @@ void Mass::getArmourCustomStyles() { getCustomStyles(_armour.customStyles, armour_styles); } -auto Mass::writeArmourCustomStyle(UnsignedLong index) -> bool { +bool +Mass::writeArmourCustomStyle(UnsignedLong index) { LOG_INFO_FORMAT("Writing custom armour style {}.", index); if(index > _armour.customStyles.size()) { diff --git a/src/Mass/Mass_DecalsAccessories.cpp b/src/Mass/Mass_DecalsAccessories.cpp index acb987f..7b28d25 100644 --- a/src/Mass/Mass_DecalsAccessories.cpp +++ b/src/Mass/Mass_DecalsAccessories.cpp @@ -29,7 +29,8 @@ using namespace Containers::Literals; -void Mass::getDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { +void +Mass::getDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { for(UnsignedInt i = 0; i < decal_array->items.size(); i++) { auto decal_prop = decal_array->at(i); CORRADE_INTERNAL_ASSERT(decal_prop); @@ -53,7 +54,8 @@ void Mass::getDecals(Containers::ArrayView decals, ArrayProperty* decal_a } } -void Mass::writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { +void +Mass::writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { for(UnsignedInt i = 0; i < decal_array->items.size(); i++) { auto decal_prop = decal_array->at(i); CORRADE_INTERNAL_ASSERT(decal_prop); @@ -87,7 +89,8 @@ void Mass::writeDecals(Containers::ArrayView decals, ArrayProperty* decal } } -void Mass::getAccessories(Containers::ArrayView accessories, ArrayProperty* accessory_array) { +void +Mass::getAccessories(Containers::ArrayView accessories, ArrayProperty* accessory_array) { for(UnsignedInt i = 0; i < accessory_array->items.size(); i++) { auto acc_prop = accessory_array->at(i); CORRADE_INTERNAL_ASSERT(acc_prop); @@ -112,7 +115,8 @@ void Mass::getAccessories(Containers::ArrayView accessories, ArrayPro } } -void Mass::writeAccessories(Containers::ArrayView accessories, ArrayProperty* accs_array) { +void +Mass::writeAccessories(Containers::ArrayView accessories, ArrayProperty* accs_array) { for(UnsignedInt i = 0; i < accs_array->items.size(); i++) { auto acc_prop = accs_array->at(i); CORRADE_INTERNAL_ASSERT(acc_prop); diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index c585a19..77721d7 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -26,11 +26,13 @@ using namespace Containers::Literals; -auto Mass::jointSliders() -> Joints& { +Joints& +Mass::jointSliders() { return _frame.joints; } -void Mass::getJointSliders() { +void +Mass::getJointSliders() { LOG_INFO("Getting joint sliders."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -65,7 +67,8 @@ void Mass::getJointSliders() { _frame.joints.lowerLegs = (length ? length->value : 0.0f); } -auto Mass::writeJointSliders() -> bool { +bool +Mass::writeJointSliders() { LOG_INFO("Writing joint sliders"); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -181,11 +184,13 @@ auto Mass::writeJointSliders() -> bool { return true; } -auto Mass::frameStyles() -> Containers::ArrayView { +Containers::ArrayView +Mass::frameStyles() { return _frame.styles; } -void Mass::getFrameStyles() { +void +Mass::getFrameStyles() { LOG_INFO("Getting frame styles."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -221,7 +226,8 @@ void Mass::getFrameStyles() { } } -auto Mass::writeFrameStyles() -> bool { +bool +Mass::writeFrameStyles() { LOG_INFO("Writing frame styles."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -260,11 +266,13 @@ auto Mass::writeFrameStyles() -> bool { return true; } -auto Mass::eyeFlareColour() -> Color4& { +Color4& +Mass::eyeFlareColour() { return _frame.eyeFlare; } -void Mass::getEyeFlareColour() { +void +Mass::getEyeFlareColour() { LOG_INFO("Getting the eye flare colour."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -291,7 +299,8 @@ void Mass::getEyeFlareColour() { _frame.eyeFlare = Color4{eye_flare_prop->r, eye_flare_prop->g, eye_flare_prop->b, eye_flare_prop->a}; } -auto Mass::writeEyeFlareColour() -> bool { +bool +Mass::writeEyeFlareColour() { LOG_INFO("Writing the eye flare colour."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -331,11 +340,13 @@ auto Mass::writeEyeFlareColour() -> bool { return true; } -auto Mass::frameCustomStyles() -> Containers::ArrayView { +Containers::ArrayView +Mass::frameCustomStyles() { return _frame.customStyles; } -void Mass::getFrameCustomStyles() { +void +Mass::getFrameCustomStyles() { LOG_INFO("Getting the frame's custom styles."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -362,7 +373,8 @@ void Mass::getFrameCustomStyles() { getCustomStyles(_frame.customStyles, frame_styles); } -auto Mass::writeFrameCustomStyle(UnsignedLong index) -> bool { +bool +Mass::writeFrameCustomStyle(UnsignedLong index) { LOG_INFO_FORMAT("Writing frame custom style number {}.", index); if(index > _frame.customStyles.size()) { diff --git a/src/Mass/Mass_Styles.cpp b/src/Mass/Mass_Styles.cpp index 362a850..a5181ef 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/Mass/Mass_Styles.cpp @@ -27,11 +27,13 @@ using namespace Containers::Literals; -auto Mass::globalStyles() -> Containers::ArrayView { +Containers::ArrayView +Mass::globalStyles() { return _globalStyles; } -void Mass::getGlobalStyles() { +void +Mass::getGlobalStyles() { LOG_INFO("Getting global styles."); auto unit_data = _mass->at(MASS_UNIT_DATA); @@ -55,7 +57,8 @@ void Mass::getGlobalStyles() { getCustomStyles(_globalStyles, global_styles); } -auto Mass::writeGlobalStyle(UnsignedLong index) -> bool { +bool +Mass::writeGlobalStyle(UnsignedLong index) { LOG_INFO_FORMAT("Writing global style number {}.", index); if(index > _globalStyles.size()) { @@ -83,7 +86,8 @@ auto Mass::writeGlobalStyle(UnsignedLong index) -> bool { return writeCustomStyle(_globalStyles[index], index, global_styles); } -void Mass::getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array) { +void +Mass::getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array) { for(UnsignedInt i = 0; i < style_array->items.size(); i++) { auto style_prop = style_array->at(i); auto& style = styles[i]; @@ -106,7 +110,8 @@ void Mass::getCustomStyles(Containers::ArrayView styles, ArrayPrope } } -auto Mass::writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) -> bool { +bool +Mass::writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) { if(!style_array) { _lastError = "style_array is null."_s; LOG_ERROR(_lastError); diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index 62826e6..a9ea9fe 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -28,91 +28,110 @@ using namespace Containers::Literals; -auto Mass::meleeWeapons() -> Containers::ArrayView { +Containers::ArrayView +Mass::meleeWeapons() { return _weapons.melee; } -void Mass::getMeleeWeapons() { +void +Mass::getMeleeWeapons() { LOG_INFO("Getting melee weapons."); getWeaponType(MASS_WEAPONS_MELEE, _weapons.melee); } -auto Mass::writeMeleeWeapons() -> bool { +bool +Mass::writeMeleeWeapons() { LOG_INFO("Writing melee weapons."); return writeWeaponType(MASS_WEAPONS_MELEE, _weapons.melee); } -auto Mass::shields() -> Containers::ArrayView { +Containers::ArrayView +Mass::shields() { return _weapons.shields; } -void Mass::getShields() { +void +Mass::getShields() { LOG_INFO("Getting shields."); getWeaponType(MASS_WEAPONS_SHIELD, _weapons.shields); } -auto Mass::writeShields() -> bool { +bool +Mass::writeShields() { LOG_INFO("Writing shields."); return writeWeaponType(MASS_WEAPONS_SHIELD, _weapons.shields); } -auto Mass::bulletShooters() -> Containers::ArrayView { +Containers::ArrayView +Mass::bulletShooters() { return _weapons.bulletShooters; } -void Mass::getBulletShooters() { +void +Mass::getBulletShooters() { LOG_INFO("Getting bullet shooters."); getWeaponType(MASS_WEAPONS_BSHOOTER, _weapons.bulletShooters); } -auto Mass::writeBulletShooters() -> bool { +bool +Mass::writeBulletShooters() { LOG_INFO("Writing bullet shooters."); return writeWeaponType(MASS_WEAPONS_BSHOOTER, _weapons.bulletShooters); } -auto Mass::energyShooters() -> Containers::ArrayView { +Containers::ArrayView +Mass::energyShooters() { return _weapons.energyShooters; } -void Mass::getEnergyShooters() { +void +Mass::getEnergyShooters() { LOG_INFO("Getting energy shooters."); getWeaponType(MASS_WEAPONS_ESHOOTER, _weapons.energyShooters); } -auto Mass::writeEnergyShooters() -> bool { +bool +Mass::writeEnergyShooters() { LOG_INFO("Writing energy shooters."); return writeWeaponType(MASS_WEAPONS_ESHOOTER, _weapons.energyShooters); } -auto Mass::bulletLaunchers() -> Containers::ArrayView { +Containers::ArrayView +Mass::bulletLaunchers() { return _weapons.bulletLaunchers; } -void Mass::getBulletLaunchers() { +void +Mass::getBulletLaunchers() { LOG_INFO("Getting bullet launchers."); getWeaponType(MASS_WEAPONS_BLAUNCHER, _weapons.bulletLaunchers); } -auto Mass::writeBulletLaunchers() -> bool { +bool +Mass::writeBulletLaunchers() { LOG_INFO("Writing bullet launchers."); return writeWeaponType(MASS_WEAPONS_BLAUNCHER, _weapons.bulletLaunchers); } -auto Mass::energyLaunchers() -> Containers::ArrayView { +Containers::ArrayView +Mass::energyLaunchers() { return _weapons.energyLaunchers; } -void Mass::getEnergyLaunchers() { +void +Mass::getEnergyLaunchers() { LOG_INFO("Getting energy launchers."); getWeaponType(MASS_WEAPONS_ELAUNCHER, _weapons.energyLaunchers); } -auto Mass::writeEnergyLaunchers() -> bool { +bool +Mass::writeEnergyLaunchers() { LOG_INFO("Writing energy launchers."); return writeWeaponType(MASS_WEAPONS_ELAUNCHER, _weapons.energyLaunchers); } -void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) { +void +Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) { auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); @@ -223,7 +242,8 @@ void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView } } -auto Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) -> bool { +bool +Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) { auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in "_s + _filename; diff --git a/src/MassManager/MassManager.cpp b/src/MassManager/MassManager.cpp index 788a4ef..8bec3b5 100644 --- a/src/MassManager/MassManager.cpp +++ b/src/MassManager/MassManager.cpp @@ -39,15 +39,18 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie refreshStagedMasses(); } -auto MassManager::lastError() -> Containers::StringView { +Containers::StringView +MassManager::lastError() { return _lastError; } -auto MassManager::hangar(Int hangar) -> Mass& { +Mass& +MassManager::hangar(Int hangar) { return _hangars[hangar]; } -void MassManager::refreshHangar(Int hangar) { +void +MassManager::refreshHangar(Int hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -60,7 +63,8 @@ void MassManager::refreshHangar(Int hangar) { _hangars[hangar] = Mass{mass_filename}; } -auto MassManager::importMass(Containers::StringView staged_fn, Int hangar) -> bool { +bool +MassManager::importMass(Containers::StringView staged_fn, Int hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -102,7 +106,8 @@ auto MassManager::importMass(Containers::StringView staged_fn, Int hangar) -> bo return true; } -auto MassManager::exportMass(Int hangar) -> bool { +bool +MassManager::exportMass(Int hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -128,7 +133,8 @@ auto MassManager::exportMass(Int hangar) -> bool { return true; } -auto MassManager::moveMass(Int source, Int destination) -> bool { +bool +MassManager::moveMass(Int source, Int destination) { if(source < 0 || source >= 32) { _lastError = "Source hangar index out of range."_s; LOG_ERROR(_lastError); @@ -165,7 +171,8 @@ auto MassManager::moveMass(Int source, Int destination) -> bool { return true; } -auto MassManager::deleteMass(Int hangar) -> bool { +bool +MassManager::deleteMass(Int hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -181,11 +188,13 @@ auto MassManager::deleteMass(Int hangar) -> bool { return true; } -auto MassManager::stagedMasses() -> std::map const& { +const std::map& +MassManager::stagedMasses() { return _stagedMasses; } -void MassManager::refreshStagedMasses() { +void +MassManager::refreshStagedMasses() { _stagedMasses.clear(); using Utility::Path::ListFlag; @@ -217,7 +226,8 @@ void MassManager::refreshStagedMasses() { } } -void MassManager::refreshStagedMass(Containers::StringView filename) { +void +MassManager::refreshStagedMass(Containers::StringView filename) { LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename)); @@ -237,7 +247,8 @@ void MassManager::refreshStagedMass(Containers::StringView filename) { } } -auto MassManager::deleteStagedMass(Containers::StringView filename) -> bool { +bool +MassManager::deleteStagedMass(Containers::StringView filename) { if(_stagedMasses.find(filename) == _stagedMasses.cend()) { _lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s; LOG_ERROR(_lastError); diff --git a/src/MassManager/MassManager.h b/src/MassManager/MassManager.h index 330d98d..c3e495b 100644 --- a/src/MassManager/MassManager.h +++ b/src/MassManager/MassManager.h @@ -30,22 +30,22 @@ class MassManager { public: MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); - auto lastError() -> Containers::StringView; + Containers::StringView lastError(); - auto hangar(int hangar) -> Mass&; + Mass& hangar(int hangar); void refreshHangar(int hangar); - auto importMass(Containers::StringView staged_fn, int hangar) -> bool; - auto exportMass(int hangar) -> bool; + bool importMass(Containers::StringView staged_fn, int hangar); + bool exportMass(int hangar); - auto moveMass(int source, int destination) -> bool; - auto deleteMass(int hangar) -> bool; + bool moveMass(int source, int destination); + bool deleteMass(int hangar); - auto stagedMasses() -> std::map const&; + std::map const& stagedMasses(); void refreshStagedMasses(); void refreshStagedMass(Containers::StringView filename); - auto deleteStagedMass(Containers::StringView filename) -> bool; + bool deleteStagedMass(Containers::StringView filename); private: Containers::StringView _saveDirectory; diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index 706a88f..288e8cf 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -62,31 +62,38 @@ Profile::Profile(Containers::StringView path): refreshValues(); } -auto Profile::valid() const -> bool { +bool +Profile::valid() const { return _valid; } -auto Profile::lastError() const -> Containers::StringView { +Containers::StringView +Profile::lastError() const { return _lastError; } -auto Profile::filename() const -> Containers::StringView { +Containers::StringView +Profile::filename() const { return _filename; } -auto Profile::type() const -> ProfileType { +ProfileType +Profile::type() const { return _type; } -auto Profile::isDemo() const -> bool { +bool +Profile::isDemo() const { return _type == ProfileType::Demo; } -auto Profile::account() const -> Containers::StringView { +Containers::StringView +Profile::account() const { return _account; } -void Profile::refreshValues() { +void +Profile::refreshValues() { if(!_profile.reloadData()) { LOG_ERROR(_profile.lastError()); _valid = false; @@ -157,11 +164,13 @@ void Profile::refreshValues() { _valid = true; } -auto Profile::companyName() const -> Containers::StringView { +Containers::StringView +Profile::companyName() const { return _name; } -auto Profile::renameCompany(Containers::StringView new_name) -> bool { +bool +Profile::renameCompany(Containers::StringView new_name) { auto name_prop = _profile.at(PROFILE_NAME); if(!name_prop) { _lastError = "No company name in "_s + _filename; @@ -180,15 +189,18 @@ auto Profile::renameCompany(Containers::StringView new_name) -> bool { return true; } -auto Profile::activeFrameSlot() const -> Int { +Int +Profile::activeFrameSlot() const { return _activeFrameSlot; } -auto Profile::credits() const -> Int { +Int +Profile::credits() const { return _credits; } -auto Profile::setCredits(Int amount) -> bool { +bool +Profile::setCredits(Int amount) { auto credits_prop = _profile.at(PROFILE_CREDITS); if(!credits_prop) { @@ -208,11 +220,13 @@ auto Profile::setCredits(Int amount) -> bool { return true; } -auto Profile::storyProgress() const -> Int { +Int +Profile::storyProgress() const { return _storyProgress; } -auto Profile::setStoryProgress(Int progress) -> bool { +bool +Profile::setStoryProgress(Int progress) { auto story_progress_prop = _profile.at("StoryProgress"_s); if(!story_progress_prop) { @@ -232,47 +246,58 @@ auto Profile::setStoryProgress(Int progress) -> bool { return true; } -auto Profile::lastMissionId() const -> Int { +Int +Profile::lastMissionId() const { return _lastMissionId; } -auto Profile::verseSteel() const -> Int { +Int +Profile::verseSteel() const { return _verseSteel; } -auto Profile::setVerseSteel(Int amount) -> bool { +bool +Profile::setVerseSteel(Int amount) { return setResource(PROFILE_MATERIAL, VerseSteel, amount); } -auto Profile::undinium() const -> Int { +Int +Profile::undinium() const { return _undinium; } -auto Profile::setUndinium(Int amount) -> bool { +bool +Profile::setUndinium(Int amount) { return setResource(PROFILE_MATERIAL, Undinium, amount); } -auto Profile::necriumAlloy() const -> Int { +Int +Profile::necriumAlloy() const { return _necriumAlloy; } -auto Profile::setNecriumAlloy(Int amount) -> bool { +bool +Profile::setNecriumAlloy(Int amount) { return setResource(PROFILE_MATERIAL, NecriumAlloy, amount); } -auto Profile::lunarite() const -> Int { +Int +Profile::lunarite() const { return _lunarite; } -auto Profile::setLunarite(Int amount) -> bool { +bool +Profile::setLunarite(Int amount) { return setResource(PROFILE_MATERIAL, Lunarite, amount); } -auto Profile::asterite() const -> Int { +Int +Profile::asterite() const { return _asterite; } -auto Profile::setAsterite(Int amount) -> bool { +bool +Profile::setAsterite(Int amount) { return setResource(PROFILE_MATERIAL, Asterite, amount); } @@ -286,43 +311,53 @@ Profile::setHalliteFragma(Int amount) { return setResource(PROFILE_MATERIAL, HalliteFragma, amount); } -auto Profile::ednil() const -> Int { +Int +Profile::ednil() const { return _ednil; } -auto Profile::setEdnil(Int amount) -> bool { +bool +Profile::setEdnil(Int amount) { return setResource(PROFILE_MATERIAL, Ednil, amount); } -auto Profile::nuflalt() const -> Int { +Int +Profile::nuflalt() const { return _nuflalt; } -auto Profile::setNuflalt(Int amount) -> bool { +bool +Profile::setNuflalt(Int amount) { return setResource(PROFILE_MATERIAL, Nuflalt, amount); } -auto Profile::aurelene() const -> Int { +Int +Profile::aurelene() const { return _aurelene; } -auto Profile::setAurelene(Int amount) -> bool { +bool +Profile::setAurelene(Int amount) { return setResource(PROFILE_MATERIAL, Aurelene, amount); } -auto Profile::soldus() const -> Int { +Int +Profile::soldus() const { return _soldus; } -auto Profile::setSoldus(Int amount) -> bool { +bool +Profile::setSoldus(Int amount) { return setResource(PROFILE_MATERIAL, Soldus, amount); } -auto Profile::synthesisedN() const -> Int { +Int +Profile::synthesisedN() const { return _synthesisedN; } -auto Profile::setSynthesisedN(Int amount) -> bool { +bool +Profile::setSynthesisedN(Int amount) { return setResource(PROFILE_MATERIAL, SynthesisedN, amount); } @@ -336,43 +371,53 @@ Profile::setNanoc(Int amount) { return setResource(PROFILE_MATERIAL, Nanoc, amount); } -auto Profile::alcarbonite() const -> Int { +Int +Profile::alcarbonite() const { return _alcarbonite; } -auto Profile::setAlcarbonite(Int amount) -> bool { +bool +Profile::setAlcarbonite(Int amount) { return setResource(PROFILE_MATERIAL, Alcarbonite, amount); } -auto Profile::keriphene() const -> Int { +Int +Profile::keriphene() const { return _keriphene; } -auto Profile::setKeriphene(Int amount) -> bool { +bool +Profile::setKeriphene(Int amount) { return setResource(PROFILE_MATERIAL, Keriphene, amount); } -auto Profile::nitinolCM() const -> Int { +Int +Profile::nitinolCM() const { return _nitinolCM; } -auto Profile::setNitinolCM(Int amount) -> bool { +bool +Profile::setNitinolCM(Int amount) { return setResource(PROFILE_MATERIAL, NitinolCM, amount); } -auto Profile::quarkium() const -> Int { +Int +Profile::quarkium() const { return _quarkium; } -auto Profile::setQuarkium(Int amount) -> bool { +bool +Profile::setQuarkium(Int amount) { return setResource(PROFILE_MATERIAL, Quarkium, amount); } -auto Profile::alterene() const -> Int { +Int +Profile::alterene() const { return _alterene; } -auto Profile::setAlterene(Int amount) -> bool { +bool +Profile::setAlterene(Int amount) { return setResource(PROFILE_MATERIAL, Alterene, amount); } @@ -386,43 +431,53 @@ Profile::setCosmium(Int amount) { return setResource(PROFILE_MATERIAL, Cosmium, amount); } -auto Profile::mixedComposition() const -> Int { +Int +Profile::mixedComposition() const { return _mixedComposition; } -auto Profile::setMixedComposition(Int amount) -> bool { +bool +Profile::setMixedComposition(Int amount) { return setResource(PROFILE_QUARK_DATA, MixedComposition, amount); } -auto Profile::voidResidue() const -> Int { +Int +Profile::voidResidue() const { return _voidResidue; } -auto Profile::setVoidResidue(Int amount) -> bool { +bool +Profile::setVoidResidue(Int amount) { return setResource(PROFILE_QUARK_DATA, VoidResidue, amount); } -auto Profile::muscularConstruction() const -> Int { +Int +Profile::muscularConstruction() const { return _muscularConstruction; } -auto Profile::setMuscularConstruction(Int amount) -> bool { +bool +Profile::setMuscularConstruction(Int amount) { return setResource(PROFILE_QUARK_DATA, MuscularConstruction, amount); } -auto Profile::mineralExoskeletology() const -> Int { +Int +Profile::mineralExoskeletology() const { return _mineralExoskeletology; } -auto Profile::setMineralExoskeletology(Int amount) -> bool { +bool +Profile::setMineralExoskeletology(Int amount) { return setResource(PROFILE_QUARK_DATA, MineralExoskeletology, amount); } -auto Profile::carbonisedSkin() const -> Int { +Int +Profile::carbonisedSkin() const { return _carbonisedSkin; } -auto Profile::setCarbonisedSkin(Int amount) -> bool { +bool +Profile::setCarbonisedSkin(Int amount) { return setResource(PROFILE_QUARK_DATA, CarbonisedSkin, amount); } @@ -436,7 +491,8 @@ Profile::setIsolatedVoidParticle(Int amount) { return setResource(PROFILE_QUARK_DATA, IsolatedVoidParticle, amount); } -auto Profile::getResource(Containers::StringView container, MaterialID id) -> Int { +Int +Profile::getResource(Containers::StringView container, MaterialID id) { auto mats_prop = _profile.at(container); if(!mats_prop) { @@ -452,7 +508,8 @@ auto Profile::getResource(Containers::StringView container, MaterialID id) -> In return it != mats_prop->items.end() ? static_cast(it->get())->quantity : 0; } -auto Profile::setResource(Containers::StringView container, MaterialID id, Int amount) -> bool { +bool +Profile::setResource(Containers::StringView container, MaterialID id, Int amount) { auto mats_prop = _profile.at(container); if(!mats_prop) { diff --git a/src/Profile/Profile.h b/src/Profile/Profile.h index eede0fd..e861160 100644 --- a/src/Profile/Profile.h +++ b/src/Profile/Profile.h @@ -51,93 +51,93 @@ class Profile { void refreshValues(); auto companyName() const -> Containers::StringView; - auto renameCompany(Containers::StringView new_name) -> bool; + bool renameCompany(Containers::StringView new_name); auto activeFrameSlot() const -> Int; auto credits() const -> Int; - auto setCredits(Int credits) -> bool; + bool setCredits(Int credits); auto storyProgress() const -> Int; - auto setStoryProgress(Int progress) -> bool; + bool setStoryProgress(Int progress); auto lastMissionId() const -> Int; auto verseSteel() const -> Int; - auto setVerseSteel(Int amount) -> bool; + bool setVerseSteel(Int amount); auto undinium() const -> Int; - auto setUndinium(Int amount) -> bool; + bool setUndinium(Int amount); auto necriumAlloy() const -> Int; - auto setNecriumAlloy(Int amount) -> bool; + bool setNecriumAlloy(Int amount); auto lunarite() const -> Int; - auto setLunarite(Int amount) -> bool; + bool setLunarite(Int amount); auto asterite() const -> Int; - auto setAsterite(Int amount) -> bool; + bool setAsterite(Int amount); Int halliteFragma() const; bool setHalliteFragma(Int amount); auto ednil() const -> Int; - auto setEdnil(Int amount) -> bool; + bool setEdnil(Int amount); auto nuflalt() const -> Int; - auto setNuflalt(Int amount) -> bool; + bool setNuflalt(Int amount); auto aurelene() const -> Int; - auto setAurelene(Int amount) -> bool; + bool setAurelene(Int amount); auto soldus() const -> Int; - auto setSoldus(Int amount) -> bool; + bool setSoldus(Int amount); auto synthesisedN() const -> Int; - auto setSynthesisedN(Int amount) -> bool; + bool setSynthesisedN(Int amount); Int nanoc() const; bool setNanoc(Int amount); auto alcarbonite() const -> Int; - auto setAlcarbonite(Int amount) -> bool; + bool setAlcarbonite(Int amount); auto keriphene() const -> Int; - auto setKeriphene(Int amount) -> bool; + bool setKeriphene(Int amount); auto nitinolCM() const -> Int; - auto setNitinolCM(Int amount) -> bool; + bool setNitinolCM(Int amount); auto quarkium() const -> Int; - auto setQuarkium(Int amount) -> bool; + bool setQuarkium(Int amount); auto alterene() const -> Int; - auto setAlterene(Int amount) -> bool; + bool setAlterene(Int amount); Int cosmium() const; bool setCosmium(Int amount); auto mixedComposition() const -> Int; - auto setMixedComposition(Int amount) -> bool; + bool setMixedComposition(Int amount); auto voidResidue() const -> Int; - auto setVoidResidue(Int amount) -> bool; + bool setVoidResidue(Int amount); auto muscularConstruction() const -> Int; - auto setMuscularConstruction(Int amount) -> bool; + bool setMuscularConstruction(Int amount); auto mineralExoskeletology() const -> Int; - auto setMineralExoskeletology(Int amount) -> bool; + bool setMineralExoskeletology(Int amount); auto carbonisedSkin() const -> Int; - auto setCarbonisedSkin(Int amount) -> bool; + bool setCarbonisedSkin(Int amount); Int isolatedVoidParticle() const; bool setIsolatedVoidParticle(Int amount); private: - auto getResource(Containers::StringView container, MaterialID id) -> Int; - auto setResource(Containers::StringView container, MaterialID id, Int amount) -> bool; + Int getResource(Containers::StringView container, MaterialID id); + bool setResource(Containers::StringView container, MaterialID id, Int amount); Containers::String _filename; diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index 1b358a2..b6972ac 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -40,19 +40,23 @@ ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::Stri _ready = refreshProfiles(); } -auto ProfileManager::ready() const -> bool { +bool +ProfileManager::ready() const { return _ready; } -auto ProfileManager::lastError() -> Containers::StringView { +Containers::StringView +ProfileManager::lastError() { return _lastError; } -auto ProfileManager::profiles() -> Containers::ArrayView { +Containers::ArrayView +ProfileManager::profiles() { return _profiles; } -auto ProfileManager::refreshProfiles() -> bool { +bool +ProfileManager::refreshProfiles() { LOG_INFO("Refreshing profiles."); _profiles = Containers::Array{}; @@ -93,11 +97,13 @@ auto ProfileManager::refreshProfiles() -> bool { return true; } -auto ProfileManager::getProfile(std::size_t index) -> Profile* { +Profile* +ProfileManager::getProfile(std::size_t index) { return index <= _profiles.size() ? &(_profiles[index]) : nullptr; } -auto ProfileManager::deleteProfile(std::size_t index, bool delete_builds) -> bool { +bool +ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) { _lastError = Utility::format("Couldn't delete {} (filename: {}).", _profiles[index].companyName(), @@ -126,7 +132,8 @@ auto ProfileManager::deleteProfile(std::size_t index, bool delete_builds) -> boo return true; } -auto ProfileManager::backupProfile(std::size_t index, bool backup_builds) -> bool { +bool +ProfileManager::backupProfile(std::size_t index, bool backup_builds) { std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm* time = std::localtime(×tamp); auto& profile = _profiles[index]; @@ -202,11 +209,13 @@ auto ProfileManager::backupProfile(std::size_t index, bool backup_builds) -> boo return true; } -auto ProfileManager::backups() -> Containers::ArrayView { +Containers::ArrayView +ProfileManager::backups() { return _backups; } -void ProfileManager::refreshBackups() { +void +ProfileManager::refreshBackups() { _backups = Containers::Array{}; using Utility::Path::ListFlag; @@ -290,7 +299,8 @@ void ProfileManager::refreshBackups() { } } -auto ProfileManager::deleteBackup(std::size_t index) -> bool { +bool +ProfileManager::deleteBackup(std::size_t index) { if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) { _lastError = "Couldn't delete " + _backups[index].filename; LOG_ERROR(_lastError); @@ -307,7 +317,8 @@ auto ProfileManager::deleteBackup(std::size_t index) -> bool { return true; } -auto ProfileManager::restoreBackup(std::size_t index) -> bool { +bool +ProfileManager::restoreBackup(std::size_t index) { const Backup& backup = _backups[index]; auto error_format = "Extraction of file {} failed: {}"_s; diff --git a/src/ProfileManager/ProfileManager.h b/src/ProfileManager/ProfileManager.h index 0fe9e11..56c5e0a 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/ProfileManager/ProfileManager.h @@ -45,20 +45,20 @@ class ProfileManager { explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir); auto ready() const -> bool; - auto lastError() -> Containers::StringView; + Containers::StringView lastError(); - auto profiles() -> Containers::ArrayView; - auto refreshProfiles() -> bool; + Containers::ArrayView profiles(); + bool refreshProfiles(); - auto getProfile(std::size_t index) -> Profile*; - auto deleteProfile(std::size_t index, bool delete_builds) -> bool; - auto backupProfile(std::size_t index, bool backup_builds) -> bool; + Profile* getProfile(std::size_t index); + bool deleteProfile(std::size_t index, bool delete_builds); + bool backupProfile(std::size_t index, bool backup_builds); - auto backups() -> Containers::ArrayView; + Containers::ArrayView backups(); void refreshBackups(); - auto deleteBackup(std::size_t index) -> bool; - auto restoreBackup(std::size_t index) -> bool; + bool deleteBackup(std::size_t index); + bool restoreBackup(std::size_t index); private: bool _ready = false; diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index a39d798..922e5e3 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -165,7 +165,8 @@ SaveTool::~SaveTool() { LOG_INFO("Exiting."); } -void SaveTool::drawEvent() { +void +SaveTool::drawEvent() { #ifdef SAVETOOL_DEBUG_BUILD tweak.update(); #endif @@ -185,45 +186,54 @@ void SaveTool::drawEvent() { _timeline.nextFrame(); } -void SaveTool::viewportEvent(ViewportEvent& event) { +void +SaveTool::viewportEvent(ViewportEvent& event) { GL::defaultFramebuffer.setViewport({{}, event.framebufferSize()}); const Vector2 size = Vector2{windowSize()}/dpiScaling(); _imgui.relayout(size, windowSize(), framebufferSize()); } -void SaveTool::keyPressEvent(KeyEvent& event) { +void +SaveTool::keyPressEvent(KeyEvent& event) { if(_imgui.handleKeyPressEvent(event)) return; } -void SaveTool::keyReleaseEvent(KeyEvent& event) { +void +SaveTool::keyReleaseEvent(KeyEvent& event) { if(_imgui.handleKeyReleaseEvent(event)) return; } -void SaveTool::mousePressEvent(MouseEvent& event) { +void +SaveTool::mousePressEvent(MouseEvent& event) { if(_imgui.handleMousePressEvent(event)) return; } -void SaveTool::mouseReleaseEvent(MouseEvent& event) { +void +SaveTool::mouseReleaseEvent(MouseEvent& event) { if(_imgui.handleMouseReleaseEvent(event)) return; } -void SaveTool::mouseMoveEvent(MouseMoveEvent& event) { +void +SaveTool::mouseMoveEvent(MouseMoveEvent& event) { if(_imgui.handleMouseMoveEvent(event)) return; } -void SaveTool::mouseScrollEvent(MouseScrollEvent& event) { +void +SaveTool::mouseScrollEvent(MouseScrollEvent& event) { if(_imgui.handleMouseScrollEvent(event)) { event.setAccepted(); return; } } -void SaveTool::textInputEvent(TextInputEvent& event) { +void +SaveTool::textInputEvent(TextInputEvent& event) { if(_imgui.handleTextInputEvent(event)) return; } -void SaveTool::anyEvent(SDL_Event& event) { +void +SaveTool::anyEvent(SDL_Event& event) { if(event.type == _initEventId) { initEvent(event); } @@ -235,7 +245,8 @@ void SaveTool::anyEvent(SDL_Event& event) { } } -void SaveTool::drawImGui() { +void +SaveTool::drawImGui() { _imgui.newFrame(); if(ImGui::GetIO().WantTextInput && !isTextInputActive()) { @@ -252,7 +263,8 @@ void SaveTool::drawImGui() { _imgui.drawFrame(); } -void SaveTool::drawGui() { +void +SaveTool::drawGui() { drawMainMenu(); switch(_uiState) { @@ -294,7 +306,8 @@ void SaveTool::drawGui() { _queue.draw(windowSize()); } -void SaveTool::drawDisclaimer() { +void +SaveTool::drawDisclaimer() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); if(ImGui::Begin("Disclaimer##DisclaimerWindow", nullptr, @@ -355,7 +368,8 @@ void SaveTool::drawDisclaimer() { ImGui::End(); } -void SaveTool::drawInitialisation() { +void +SaveTool::drawInitialisation() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); if(ImGui::BeginPopupModal("##InitPopup", nullptr, @@ -368,7 +382,8 @@ void SaveTool::drawInitialisation() { ImGui::OpenPopup("##InitPopup"); } -void SaveTool::drawGameState() { +void +SaveTool::drawGameState() { ImGui::TextUnformatted("Game state:"); ImGui::SameLine(); { @@ -389,12 +404,14 @@ void SaveTool::drawGameState() { } } -void SaveTool::drawHelpMarker(Containers::StringView text, Float wrap_pos) { +void +SaveTool::drawHelpMarker(Containers::StringView text, Float wrap_pos) { ImGui::TextUnformatted(ICON_FA_QUESTION_CIRCLE); drawTooltip(text, wrap_pos); } -void SaveTool::drawTooltip(Containers::StringView text, Float wrap_pos) { +void +SaveTool::drawTooltip(Containers::StringView text, Float wrap_pos) { if(ImGui::IsItemHovered()){ ImGui::BeginTooltip(); if(wrap_pos > 0.0f) { @@ -413,11 +430,13 @@ SaveTool::drawCheckbox(Containers::StringView label, bool value) { return ImGui::Checkbox(label.data(), &value); } -void SaveTool::openUri(Containers::StringView uri) { +void +SaveTool::openUri(Containers::StringView uri) { ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri.data()), nullptr, nullptr, SW_SHOWDEFAULT); } -void SaveTool::checkGameState() { +void +SaveTool::checkGameState() { WTS_PROCESS_INFOW* process_infos = nullptr; unsigned long process_count = 0; diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index decc9c7..2685921 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -103,8 +103,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void initialiseConfiguration(); void initialiseGui(); void initialiseManager(); - auto initialiseToolDirectories() -> bool; - auto findGameDataDirectory() -> bool; + bool initialiseToolDirectories(); + bool findGameDataDirectory(); void initialiseMassManager(); void initialiseFileWatcher(); @@ -116,21 +116,21 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawInitialisation(); void drawProfileManager(); - auto drawBackupListPopup() -> ImGuiID; - auto drawBackupProfilePopup(std::size_t profile_index) -> ImGuiID; - auto drawDeleteProfilePopup(std::size_t profile_index) -> ImGuiID; + ImGuiID drawBackupListPopup(); + ImGuiID drawBackupProfilePopup(std::size_t profile_index); + ImGuiID drawDeleteProfilePopup(std::size_t profile_index); void drawManager(); - auto drawIntEditPopup(int* value_to_edit, int max) -> bool; - auto drawRenamePopup(Containers::ArrayView name_view) -> bool; + bool drawIntEditPopup(int* value_to_edit, int max); + bool drawRenamePopup(Containers::ArrayView name_view); void drawGeneralInfo(); void drawResearchInventory(); template void drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter); void drawUnavailableMaterialRow(Containers::StringView name, Int tier); void drawMassManager(); - auto drawDeleteMassPopup(int mass_index) -> ImGuiID; - auto drawDeleteStagedMassPopup(Containers::StringView filename) -> ImGuiID; + ImGuiID drawDeleteMassPopup(int mass_index); + ImGuiID drawDeleteStagedMassPopup(Containers::StringView filename); void drawMassViewer(); void drawFrameInfo(); @@ -148,14 +148,14 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawTuning(); void drawDecalEditor(Decal& decal); void drawAccessoryEditor(Accessory& accessory, Containers::ArrayView style_view); - auto getStyleName(Int id, Containers::ArrayView view) -> Containers::StringView; + Containers::StringView getStyleName(Int id, Containers::ArrayView view); enum DCSResult { DCS_Fail, DCS_ResetStyle, DCS_Save }; - auto drawCustomStyle(CustomStyle& style) -> DCSResult; + DCSResult drawCustomStyle(CustomStyle& style); void drawAbout(); void drawGameState(); @@ -166,7 +166,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener bool drawCheckbox(Containers::StringView label, bool value); template - auto drawUnsafeWidget(Functor func, Args... args) -> bool { + bool drawUnsafeWidget(Functor func, Args... args) { GameState game_state = _gameState; // Copying the value to reduce the risk of a data race. ImGui::BeginDisabled(game_state != GameState::NotRunning); bool result = func(std::forward(args)...); diff --git a/src/SaveTool/SaveTool_FileWatcher.cpp b/src/SaveTool/SaveTool_FileWatcher.cpp index 42a3fcd..37cbd02 100644 --- a/src/SaveTool/SaveTool_FileWatcher.cpp +++ b/src/SaveTool/SaveTool_FileWatcher.cpp @@ -26,11 +26,12 @@ #include "SaveTool.h" -void SaveTool::handleFileAction(efsw::WatchID watch_id, - const std::string&, - const std::string& filename, - efsw::Action action, - std::string old_filename) +void +SaveTool::handleFileAction(efsw::WatchID watch_id, + const std::string&, + const std::string& filename, + efsw::Action action, + std::string old_filename) { SDL_Event event; SDL_zero(event); @@ -60,7 +61,8 @@ void SaveTool::handleFileAction(efsw::WatchID watch_id, SDL_PushEvent(&event); } -void SaveTool::fileUpdateEvent(SDL_Event& event) { +void +SaveTool::fileUpdateEvent(SDL_Event& event) { Containers::String filename{static_cast(event.user.data1), std::strlen(static_cast(event.user.data1)), nullptr}; @@ -83,7 +85,7 @@ void SaveTool::fileUpdateEvent(SDL_Event& event) { if(event.user.code == FileMoved) { old_filename = Containers::String{static_cast(event.user.data2), std::strlen(static_cast(event.user.data2)), nullptr}; old_index = ((old_filename[_currentProfile->isDemo() ? 8 : 4] - 0x30) * 10) + - (old_filename[_currentProfile->isDemo() ? 9 : 5] - 0x30); + (old_filename[_currentProfile->isDemo() ? 9 : 5] - 0x30); } switch(event.user.code) { diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/SaveTool/SaveTool_Initialisation.cpp index ad1ec60..1142d1f 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/SaveTool/SaveTool_Initialisation.cpp @@ -31,7 +31,8 @@ #include "SaveTool.h" -void SaveTool::initEvent(SDL_Event& event) { +void +SaveTool::initEvent(SDL_Event& event) { _initThread.join(); switch(event.user.code) { @@ -49,14 +50,16 @@ void SaveTool::initEvent(SDL_Event& event) { } } -void SaveTool::initialiseConfiguration() { +void +SaveTool::initialiseConfiguration() { LOG_INFO("Reading configuration file."); setSwapInterval(conf().swapInterval()); setMinimalLoopPeriod(0); } -void SaveTool::initialiseGui() { +void +SaveTool::initialiseGui() { LOG_INFO("Initialising Dear ImGui."); ImGui::CreateContext(); @@ -108,7 +111,8 @@ void SaveTool::initialiseGui() { style.Colors[ImGuiCol_WindowBg] = ImColor(0xff1f1f1f); } -void SaveTool::initialiseManager() { +void +SaveTool::initialiseManager() { LOG_INFO("Initialising the profile manager."); SDL_Event event; @@ -126,7 +130,8 @@ void SaveTool::initialiseManager() { SDL_PushEvent(&event); } -auto SaveTool::initialiseToolDirectories() -> bool { +auto +SaveTool::initialiseToolDirectories() -> bool { LOG_INFO("Initialising Save Tool directories."); _backupsDir = Utility::Path::join(Utility::Path::split(*Utility::Path::executableLocation()).first(), "backups"); @@ -187,7 +192,8 @@ auto SaveTool::initialiseToolDirectories() -> bool { return true; } -auto SaveTool::findGameDataDirectory() -> bool { +auto +SaveTool::findGameDataDirectory() -> bool { LOG_INFO("Searching for the game's save directory."); wchar_t* localappdata_path = nullptr; @@ -213,12 +219,14 @@ auto SaveTool::findGameDataDirectory() -> bool { return true; } -void SaveTool::initialiseMassManager() { +void +SaveTool::initialiseMassManager() { LOG_INFO("Initialising the M.A.S.S. manager."); _massManager.emplace(_saveDir, _currentProfile->account(), _currentProfile->isDemo(), _stagingDir); } -void SaveTool::initialiseFileWatcher() { +void +SaveTool::initialiseFileWatcher() { LOG_INFO("Initialising the file watcher."); _fileWatcher.emplace(); _watchIDs[SaveDir] = _fileWatcher->addWatch(_saveDir, this, false); diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index d8736d8..671763a 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -28,7 +28,8 @@ #include "SaveTool.h" -void SaveTool::drawManager() { +void +SaveTool::drawManager() { ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGuiCond_Always); @@ -95,7 +96,8 @@ void SaveTool::drawManager() { ImGui::End(); } -auto SaveTool::drawIntEditPopup(int* value_to_edit, int max) -> bool { +bool +SaveTool::drawIntEditPopup(int* value_to_edit, int max) { bool apply = false; if(ImGui::BeginPopup("int_edit")) { ImGui::Text("Please enter a value between 0 and %i:", max); @@ -118,7 +120,8 @@ auto SaveTool::drawIntEditPopup(int* value_to_edit, int max) -> bool { return apply; } -auto SaveTool::drawRenamePopup(Containers::ArrayView name_view) -> bool { +bool +SaveTool::drawRenamePopup(Containers::ArrayView name_view) { bool apply = false; if(ImGui::BeginPopup("name_edit")) { ImGui::TextUnformatted("Please enter a new name. Conditions:"); @@ -170,7 +173,8 @@ auto SaveTool::drawRenamePopup(Containers::ArrayView name_view) -> bool { return apply; } -void SaveTool::drawGeneralInfo() { +void +SaveTool::drawGeneralInfo() { if(!_currentProfile) { return; } @@ -278,7 +282,8 @@ void SaveTool::drawGeneralInfo() { } } -void SaveTool::drawResearchInventory() { +void +SaveTool::drawResearchInventory() { if(!_currentProfile) { return; } @@ -392,7 +397,8 @@ void SaveTool::drawResearchInventory() { } template -void SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter) { +void +SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter) { static_assert(std::is_same::value, "getter doesn't return an Int, and/or doesn't take zero arguments."); static_assert(std::is_same::value, "setter doesn't return a bool, and/or doesn't take a single Int as an argument."); @@ -426,7 +432,8 @@ void SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter get } } -void SaveTool::drawUnavailableMaterialRow(Containers::StringView name, Int tier) { +void +SaveTool::drawUnavailableMaterialRow(Containers::StringView name, Int tier) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); @@ -436,7 +443,8 @@ void SaveTool::drawUnavailableMaterialRow(Containers::StringView name, Int tier) ImGui::TextDisabled("Unavailable as of game version " SUPPORTED_GAME_VERSION); } -void SaveTool::drawMassManager() { +void +SaveTool::drawMassManager() { if(!_massManager) { return; } @@ -633,7 +641,8 @@ void SaveTool::drawMassManager() { drawDeleteStagedMassPopup(staged_mass_to_delete); } -auto SaveTool::drawDeleteMassPopup(int mass_index) -> ImGuiID { +ImGuiID +SaveTool::drawDeleteMassPopup(int mass_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteMassConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { @@ -689,7 +698,8 @@ auto SaveTool::drawDeleteMassPopup(int mass_index) -> ImGuiID { return 0; } -auto SaveTool::drawDeleteStagedMassPopup(Containers::StringView filename) -> ImGuiID { +ImGuiID +SaveTool::drawDeleteStagedMassPopup(Containers::StringView filename) { if(!ImGui::BeginPopupModal("Confirmation##DeleteStagedMassConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/SaveTool/SaveTool_MassViewer.cpp index 5bc6e36..f1256cf 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/SaveTool/SaveTool_MassViewer.cpp @@ -27,7 +27,8 @@ #include "SaveTool.h" -void SaveTool::drawMassViewer() { +void +SaveTool::drawMassViewer() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { _currentMass = nullptr; _currentWeapon = nullptr; @@ -154,7 +155,8 @@ void SaveTool::drawMassViewer() { ImGui::End(); } -void SaveTool::drawGlobalStyles() { +void +SaveTool::drawGlobalStyles() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -190,7 +192,8 @@ void SaveTool::drawGlobalStyles() { ImGui::EndChild(); } -void SaveTool::drawTuning() { +void +SaveTool::drawTuning() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -286,7 +289,8 @@ void SaveTool::drawTuning() { ImGui::EndTable(); } -auto SaveTool::drawCustomStyle(CustomStyle& style) -> DCSResult { +SaveTool::DCSResult +SaveTool::drawCustomStyle(CustomStyle& style) { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return DCS_Fail; } @@ -391,7 +395,8 @@ auto SaveTool::drawCustomStyle(CustomStyle& style) -> DCSResult { return return_value; } -void SaveTool::drawDecalEditor(Decal& decal) { +void +SaveTool::drawDecalEditor(Decal& decal) { ImGui::Text("ID: %i", decal.id); if(ImGui::BeginTable("##DecalTable", conf().advancedMode() ? 2 : 1, ImGuiTableFlags_BordersInnerV)) { @@ -495,7 +500,8 @@ void SaveTool::drawDecalEditor(Decal& decal) { } } -void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView style_view) { +void +SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView style_view) { if(accessory.id < 1) { ImGui::TextUnformatted("Accessory: "); } @@ -733,7 +739,8 @@ void SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView view) -> Containers::StringView { +Containers::StringView +SaveTool::getStyleName(Int id, Containers::ArrayView view) { if(id >= 0 && id <= 15) { return view[id].name; } diff --git a/src/SaveTool/SaveTool_MassViewer_Armour.cpp b/src/SaveTool/SaveTool_MassViewer_Armour.cpp index 6f5aeb4..5c21698 100644 --- a/src/SaveTool/SaveTool_MassViewer_Armour.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Armour.cpp @@ -21,7 +21,8 @@ #include "SaveTool.h" -void SaveTool::drawArmour() { +void +SaveTool::drawArmour() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -288,7 +289,8 @@ void SaveTool::drawArmour() { ImGui::EndChild(); } -void SaveTool::drawCustomArmourStyles() { +void +SaveTool::drawCustomArmourStyles() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } diff --git a/src/SaveTool/SaveTool_MassViewer_Frame.cpp b/src/SaveTool/SaveTool_MassViewer_Frame.cpp index a648c90..bbcf609 100644 --- a/src/SaveTool/SaveTool_MassViewer_Frame.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Frame.cpp @@ -15,12 +15,12 @@ // along with this program. If not, see . #include "../FontAwesome/IconsFontAwesome5.h" - #include "../Maps/StyleNames.h" #include "SaveTool.h" -void SaveTool::drawFrameInfo() { +void +SaveTool::drawFrameInfo() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -73,7 +73,8 @@ void SaveTool::drawFrameInfo() { ImGui::EndChild(); } -void SaveTool::drawJointSliders() { +void +SaveTool::drawJointSliders() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -195,7 +196,8 @@ void SaveTool::drawJointSliders() { } } -void SaveTool::drawFrameStyles() { +void +SaveTool::drawFrameStyles() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -245,7 +247,8 @@ void SaveTool::drawFrameStyles() { } } -void SaveTool::drawEyeColourPicker() { +void +SaveTool::drawEyeColourPicker() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } @@ -278,7 +281,8 @@ void SaveTool::drawEyeColourPicker() { } } -void SaveTool::drawCustomFrameStyles() { +void +SaveTool::drawCustomFrameStyles() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { return; } diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp index 909712f..2bbcd3a 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp @@ -21,7 +21,8 @@ #include "SaveTool.h" -void SaveTool::drawWeapons() { +void +SaveTool::drawWeapons() { if(!_currentMass || _currentMass->state() != Mass::State::Valid) { _currentWeapon = nullptr; return; @@ -254,8 +255,9 @@ void SaveTool::drawWeapons() { ImGui::EndGroup(); } -void SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, bool& dirty, - Containers::StringView payload_type, Containers::StringView payload_tooltip) +void +SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, bool& dirty, + Containers::StringView payload_type, Containers::StringView payload_tooltip) { ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextColumn(); @@ -317,7 +319,8 @@ void SaveTool::drawWeaponCategory(Containers::StringView name, Containers::Array ImGui::PopID(); } -void SaveTool::drawWeaponEditor(Weapon& weapon) { +void +SaveTool::drawWeaponEditor(Weapon& weapon) { if(!_currentMass || _currentMass->state() != Mass::State::Valid || !_currentWeapon) { return; } diff --git a/src/SaveTool/SaveTool_ProfileManager.cpp b/src/SaveTool/SaveTool_ProfileManager.cpp index 89b7bdf..0ce5262 100644 --- a/src/SaveTool/SaveTool_ProfileManager.cpp +++ b/src/SaveTool/SaveTool_ProfileManager.cpp @@ -24,7 +24,8 @@ extern const ImVec2 center_pivot; -void SaveTool::drawProfileManager() { +void +SaveTool::drawProfileManager() { static std::size_t profile_index = 0; ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); @@ -125,7 +126,8 @@ void SaveTool::drawProfileManager() { ImGui::End(); } -auto SaveTool::drawBackupListPopup() -> ImGuiID { +ImGuiID +SaveTool::drawBackupListPopup() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); if(!ImGui::BeginPopupModal("Backups##BackupsModal", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) @@ -324,7 +326,8 @@ auto SaveTool::drawBackupListPopup() -> ImGuiID { return 0; } -auto SaveTool::drawBackupProfilePopup(std::size_t profile_index) -> ImGuiID { +ImGuiID +SaveTool::drawBackupProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Include builds ?##IncludeBuildsDialog", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { @@ -368,7 +371,8 @@ auto SaveTool::drawBackupProfilePopup(std::size_t profile_index) -> ImGuiID { return 0; } -auto SaveTool::drawDeleteProfilePopup(std::size_t profile_index) -> ImGuiID { +ImGuiID +SaveTool::drawDeleteProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteProfileConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { diff --git a/src/SaveTool/SaveTool_UpdateChecker.cpp b/src/SaveTool/SaveTool_UpdateChecker.cpp index 768b330..0716744 100644 --- a/src/SaveTool/SaveTool_UpdateChecker.cpp +++ b/src/SaveTool/SaveTool_UpdateChecker.cpp @@ -24,7 +24,8 @@ #include "SaveTool.h" -void SaveTool::updateCheckEvent(SDL_Event& event) { +void +SaveTool::updateCheckEvent(SDL_Event& event) { _updateThread.join(); if(event.user.code == CurlInitFailed) { @@ -123,13 +124,16 @@ void SaveTool::updateCheckEvent(SDL_Event& event) { } } -inline auto writeData(char* ptr, std::size_t size, std::size_t nmemb, Containers::String* buf)-> std::size_t { +inline +std::size_t +writeData(char* ptr, std::size_t size, std::size_t nmemb, Containers::String* buf) { if(!ptr || !buf) return 0; (*buf) = Utility::format("{}{}", *buf, Containers::StringView{ptr, size * nmemb}); return size * nmemb; } -void SaveTool::checkForUpdates() { +void +SaveTool::checkForUpdates() { SDL_Event event; SDL_zero(event); event.type = _updateEventId; diff --git a/src/SaveTool/SaveTool_drawAbout.cpp b/src/SaveTool/SaveTool_drawAbout.cpp index 1904d1b..9c1927f 100644 --- a/src/SaveTool/SaveTool_drawAbout.cpp +++ b/src/SaveTool/SaveTool_drawAbout.cpp @@ -31,7 +31,8 @@ extern const ImVec2 center_pivot; -void SaveTool::drawAbout() { +void +SaveTool::drawAbout() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); ImGui::SetNextWindowSize({float(windowSize().x()) * 0.8f, float(windowSize().y()) * 0.75f}, ImGuiCond_Always); @@ -88,7 +89,7 @@ void SaveTool::drawAbout() { if(ImGui::BeginChild("##GPL", {0.0f, float(windowSize().y()) * 0.3f}, true)) { static auto licence = _rs.getRaw("COPYING"); ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(licence.data(), licence.data() + licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(licence.begin(), licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -117,7 +118,7 @@ void SaveTool::drawAbout() { static auto corrade_licence = _rs.getRaw("COPYING.Corrade"); if(ImGui::BeginChild("##CorradeLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(corrade_licence.data(), corrade_licence.data() + corrade_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(corrade_licence.begin(), corrade_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -145,7 +146,7 @@ void SaveTool::drawAbout() { static auto magnum_licence = _rs.getRaw("COPYING.Magnum"); if(ImGui::BeginChild("##MagnumLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(magnum_licence.data(), magnum_licence.data() + magnum_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(magnum_licence.begin(), magnum_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -171,7 +172,7 @@ void SaveTool::drawAbout() { static auto imgui_licence = _rs.getRaw("LICENSE.ImGui"); if(ImGui::BeginChild("##ImGuiLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(imgui_licence.data(), imgui_licence.data() + imgui_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(imgui_licence.begin(), imgui_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -197,7 +198,7 @@ void SaveTool::drawAbout() { static auto sdl_licence = _rs.getRaw("LICENSE.SDL"); if(ImGui::BeginChild("##SDLLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(sdl_licence.data(), sdl_licence.data() + sdl_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(sdl_licence.begin(), sdl_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -223,7 +224,7 @@ void SaveTool::drawAbout() { static auto libzip_licence = _rs.getRaw("LICENSE.libzip"); if(ImGui::BeginChild("##libzipLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(libzip_licence.data(), libzip_licence.data() + libzip_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(libzip_licence.begin(), libzip_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -248,7 +249,7 @@ void SaveTool::drawAbout() { static auto efsw_licence = _rs.getRaw("LICENSE.efsw"); if(ImGui::BeginChild("##efswLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(efsw_licence.data(), efsw_licence.data() + efsw_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(efsw_licence.begin(), efsw_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); @@ -274,7 +275,7 @@ void SaveTool::drawAbout() { static auto curl_licence = _rs.getRaw("LICENSE.curl"); if(ImGui::BeginChild("##libcurlLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextEx(curl_licence.data(), curl_licence.data() + curl_licence.size(), ImGuiTextFlags_None); + ImGui::TextUnformatted(curl_licence.begin(), curl_licence.end()); ImGui::PopFont(); } ImGui::EndChild(); diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/SaveTool/SaveTool_drawMainMenu.cpp index b6e47ae..400c608 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/SaveTool/SaveTool_drawMainMenu.cpp @@ -22,7 +22,8 @@ #include "SaveTool.h" -void SaveTool::drawMainMenu() { +void +SaveTool::drawMainMenu() { if(!ImGui::BeginMainMenuBar()) { return; } diff --git a/src/ToastQueue/ToastQueue.cpp b/src/ToastQueue/ToastQueue.cpp index d0902d7..df92ec8 100644 --- a/src/ToastQueue/ToastQueue.cpp +++ b/src/ToastQueue/ToastQueue.cpp @@ -37,41 +37,51 @@ constexpr Vector2 padding{20.0f, 20.0f}; constexpr Float toast_spacing = 10.0f; Toast::Toast(Type type, Containers::StringView message, std::chrono::milliseconds timeout): - _type{type}, _message{message}, _timeout{timeout}, _creationTime{std::chrono::steady_clock::now()} + _type{type}, + _message{message}, + _timeout{timeout}, + _creationTime{std::chrono::steady_clock::now()} { _phaseTrack = Animation::Track{{ - {0, Phase::FadeIn}, - {fade_time, Phase::Wait}, - {fade_time + timeout.count(), Phase::FadeOut}, + {0, Phase::FadeIn}, + {fade_time, Phase::Wait}, + {fade_time + timeout.count(), Phase::FadeOut}, {(fade_time * 2) + timeout.count(), Phase::TimedOut} }, Math::select, Animation::Extrapolation::Constant}; } -auto Toast::type() -> Type { +Toast::Type +Toast::type() { return _type; } -auto Toast::message() -> Containers::StringView { +Containers::StringView +Toast::message() { return _message; } -auto Toast::timeout() -> std::chrono::milliseconds { +std::chrono::milliseconds +Toast::timeout() { return _timeout; } -auto Toast::creationTime() -> std::chrono::steady_clock::time_point { +std::chrono::steady_clock::time_point +Toast::creationTime() { return _creationTime; } -auto Toast::elapsedTime() -> std::chrono::milliseconds { +std::chrono::milliseconds +Toast::elapsedTime() { return std::chrono::duration_cast(std::chrono::steady_clock::now() - _creationTime); } -auto Toast::phase() -> Phase { +Toast::Phase +Toast::phase() { return _phaseTrack.at(elapsedTime().count()); } -auto Toast::opacity() -> Float { +Float +Toast::opacity() { Phase phase = this->phase(); Long elapsed_time = elapsedTime().count(); @@ -85,15 +95,18 @@ auto Toast::opacity() -> Float { return 1.0f; } -void ToastQueue::addToast(Toast&& toast) { +void +ToastQueue::addToast(Toast&& toast) { _toasts.push_back(std::move(toast)); } -void ToastQueue::addToast(Toast::Type type, Containers::StringView message, std::chrono::milliseconds timeout) { +void +ToastQueue::addToast(Toast::Type type, Containers::StringView message, std::chrono::milliseconds timeout) { _toasts.emplace_back(type, message, timeout); } -void ToastQueue::draw(Vector2i viewport_size) { +void +ToastQueue::draw(Vector2i viewport_size) { Float height = 0.0f; for(UnsignedInt i = 0; i < _toasts.size(); i++) { @@ -154,6 +167,7 @@ void ToastQueue::draw(Vector2i viewport_size) { } } -void ToastQueue::removeToast(Long index) { +void +ToastQueue::removeToast(Long index) { _toasts.erase(_toasts.begin() + index); } diff --git a/src/ToastQueue/ToastQueue.h b/src/ToastQueue/ToastQueue.h index fe0fc42..5c5365e 100644 --- a/src/ToastQueue/ToastQueue.h +++ b/src/ToastQueue/ToastQueue.h @@ -46,19 +46,19 @@ class Toast { Toast(Toast&& other) = default; Toast& operator=(Toast&& other) = default; - auto type() -> Type; + Type type(); - auto message() -> Containers::StringView; + Containers::StringView message(); - auto timeout() -> std::chrono::milliseconds; + std::chrono::milliseconds timeout(); - auto creationTime() -> std::chrono::steady_clock::time_point; + std::chrono::steady_clock::time_point creationTime(); - auto elapsedTime() -> std::chrono::milliseconds; + std::chrono::milliseconds elapsedTime(); - auto phase() -> Phase; + Phase phase(); - auto opacity() -> Float; + Float opacity(); private: Type _type{Type::Default}; diff --git a/src/UESaveFile/BinaryReader.cpp b/src/UESaveFile/BinaryReader.cpp index f1d88a5..c0ae9b2 100644 --- a/src/UESaveFile/BinaryReader.cpp +++ b/src/UESaveFile/BinaryReader.cpp @@ -35,72 +35,89 @@ BinaryReader::~BinaryReader() { closeFile(); } -auto BinaryReader::open() -> bool { +bool +BinaryReader::open() { return _file; } -auto BinaryReader::eof() -> bool { +bool +BinaryReader::eof() { return std::feof(_file) != 0; } -auto BinaryReader::position() -> Long { +Long +BinaryReader::position() { return _ftelli64(_file); } -auto BinaryReader::seek(Long position) -> bool { +bool +BinaryReader::seek(Long position) { return _fseeki64(_file, position, SEEK_SET) == 0; } -void BinaryReader::closeFile() { +void +BinaryReader::closeFile() { std::fclose(_file); _file = nullptr; } -auto BinaryReader::readChar(char& value) -> bool { +bool +BinaryReader::readChar(char& value) { return std::fread(&value, sizeof(char), 1, _file) == 1; } -auto BinaryReader::readByte(Byte& value) -> bool { +bool +BinaryReader::readByte(Byte& value) { return std::fread(&value, sizeof(Byte), 1, _file) == 1; } -auto BinaryReader::readUnsignedByte(UnsignedByte& value) -> bool { +bool +BinaryReader::readUnsignedByte(UnsignedByte& value) { return std::fread(&value, sizeof(UnsignedByte), 1, _file) == 1; } -auto BinaryReader::readShort(Short& value) -> bool { +bool +BinaryReader::readShort(Short& value) { return std::fread(&value, sizeof(Short), 1, _file) == 1; } -auto BinaryReader::readUnsignedShort(UnsignedShort& value) -> bool { +bool +BinaryReader::readUnsignedShort(UnsignedShort& value) { return std::fread(&value, sizeof(UnsignedShort), 1, _file) == 1; } -auto BinaryReader::readInt(Int& value) -> bool { +bool +BinaryReader::readInt(Int& value) { return std::fread(&value, sizeof(Int), 1, _file) == 1; } -auto BinaryReader::readUnsignedInt(UnsignedInt& value) -> bool { +bool +BinaryReader::readUnsignedInt(UnsignedInt& value) { return std::fread(&value, sizeof(UnsignedInt), 1, _file) == 1; } -auto BinaryReader::readLong(Long& value) -> bool { +bool +BinaryReader::readLong(Long& value) { return std::fread(&value, sizeof(Long), 1, _file) == 1; } -auto BinaryReader::readUnsignedLong(UnsignedLong& value) -> bool { +bool +BinaryReader::readUnsignedLong(UnsignedLong& value) { return std::fread(&value, sizeof(UnsignedLong), 1, _file) == 1; } -auto BinaryReader::readFloat(Float& value) -> bool { +bool +BinaryReader::readFloat(Float& value) { return std::fread(&value, sizeof(Float), 1, _file) == 1; } -auto BinaryReader::readDouble(Double& value) -> bool { +bool +BinaryReader::readDouble(Double& value) { return std::fread(&value, sizeof(Double), 1, _file) == 1; } -auto BinaryReader::readArray(Containers::Array& array, std::size_t count) -> bool { +bool +BinaryReader::readArray(Containers::Array& array, std::size_t count) { if(array.size() < count) { array = Containers::Array{ValueInit, count}; } @@ -108,7 +125,8 @@ auto BinaryReader::readArray(Containers::Array& array, std::size_t count) return std::fread(array.data(), sizeof(char), count, _file) == count; } -auto BinaryReader::readUEString(Containers::String& str) -> bool { +bool +BinaryReader::readUEString(Containers::String& str) { UnsignedInt length = 0; if(!readUnsignedInt(length) || length == 0) { return false; @@ -119,7 +137,8 @@ auto BinaryReader::readUEString(Containers::String& str) -> bool { return std::fread(str.data(), sizeof(char), length, _file) == length; } -auto BinaryReader::peekChar() -> Int { +Int +BinaryReader::peekChar() { Int c; c = std::fgetc(_file); std::ungetc(c, _file); diff --git a/src/UESaveFile/BinaryReader.h b/src/UESaveFile/BinaryReader.h index d43df8a..e945938 100644 --- a/src/UESaveFile/BinaryReader.h +++ b/src/UESaveFile/BinaryReader.h @@ -32,40 +32,40 @@ class BinaryReader { explicit BinaryReader(Containers::StringView filename); ~BinaryReader(); - auto open() -> bool; - auto eof() -> bool; - auto position() -> Long; + bool open(); + bool eof(); + Long position(); - auto seek(Long position) -> bool; + bool seek(Long position); void closeFile(); - auto readChar(char& value) -> bool; - auto readByte(Byte& value) -> bool; - auto readUnsignedByte(UnsignedByte& value) -> bool; - auto readShort(Short& value) -> bool; - auto readUnsignedShort(UnsignedShort& value) -> bool; - auto readInt(Int& value) -> bool; - auto readUnsignedInt(UnsignedInt& value) -> bool; - auto readLong(Long& value) -> bool; - auto readUnsignedLong(UnsignedLong& value) -> bool; - auto readFloat(Float& value) -> bool; - auto readDouble(Double& value) -> bool; - auto readArray(Containers::Array& array, std::size_t count) -> bool; + bool readChar(char& value); + bool readByte(Byte& value); + bool readUnsignedByte(UnsignedByte& value); + bool readShort(Short& value); + bool readUnsignedShort(UnsignedShort& value); + bool readInt(Int& value); + bool readUnsignedInt(UnsignedInt& value); + bool readLong(Long& value); + bool readUnsignedLong(UnsignedLong& value); + bool readFloat(Float& value); + bool readDouble(Double& value); + bool readArray(Containers::Array& array, std::size_t count); template - auto readValue(T& value) -> bool { + bool readValue(T& value) { return fread(&value, sizeof(T), 1, _file) == sizeof(T); } template - auto readStaticArray(Containers::StaticArray& array) -> bool { + bool readStaticArray(Containers::StaticArray& array) { return std::fread(array.data(), sizeof(char), S, _file) == S; } - auto readUEString(Containers::String& str) -> bool; + bool readUEString(Containers::String& str); - auto peekChar() -> Int; + Int peekChar(); private: std::FILE* _file = nullptr; diff --git a/src/UESaveFile/BinaryWriter.cpp b/src/UESaveFile/BinaryWriter.cpp index 10fa76d..a5a2e15 100644 --- a/src/UESaveFile/BinaryWriter.cpp +++ b/src/UESaveFile/BinaryWriter.cpp @@ -33,29 +33,35 @@ BinaryWriter::~BinaryWriter() { closeFile(); } -auto BinaryWriter::open() -> bool { +bool +BinaryWriter::open() { return _file; } -void BinaryWriter::closeFile() { +void +BinaryWriter::closeFile() { std::fflush(_file); std::fclose(_file); _file = nullptr; } -auto BinaryWriter::position() -> Long { +Long +BinaryWriter::position() { return _ftelli64(_file); } -auto BinaryWriter::array() const -> Containers::ArrayView { +Containers::ArrayView +BinaryWriter::array() const { return _data; } -auto BinaryWriter::arrayPosition() const -> UnsignedLong { +UnsignedLong +BinaryWriter::arrayPosition() const { return _index; } -auto BinaryWriter::flushToFile() -> bool { +bool +BinaryWriter::flushToFile() { bool ret = writeArray(_data); std::fflush(_file); _data = Containers::Array{}; @@ -63,51 +69,63 @@ auto BinaryWriter::flushToFile() -> bool { return ret; } -auto BinaryWriter::writeChar(char value) -> bool { +bool +BinaryWriter::writeChar(char value) { return std::fwrite(&value, sizeof(char), 1, _file) == 1; } -auto BinaryWriter::writeByte(Byte value) -> bool { +bool +BinaryWriter::writeByte(Byte value) { return std::fwrite(&value, sizeof(Byte), 1, _file) == 1; } -auto BinaryWriter::writeUnsignedByte(UnsignedByte value) -> bool { +bool +BinaryWriter::writeUnsignedByte(UnsignedByte value) { return std::fwrite(&value, sizeof(UnsignedByte), 1, _file) == 1; } -auto BinaryWriter::writeShort(Short value) -> bool { +bool +BinaryWriter::writeShort(Short value) { return std::fwrite(&value, sizeof(Short), 1, _file) == 1; } -auto BinaryWriter::writeUnsignedShort(UnsignedShort value) -> bool { +bool +BinaryWriter::writeUnsignedShort(UnsignedShort value) { return std::fwrite(&value, sizeof(UnsignedShort), 1, _file) == 1; } -auto BinaryWriter::writeInt(Int value) -> bool { +bool +BinaryWriter::writeInt(Int value) { return std::fwrite(&value, sizeof(Int), 1, _file) == 1; } -auto BinaryWriter::writeUnsignedInt(UnsignedInt value) -> bool { +bool +BinaryWriter::writeUnsignedInt(UnsignedInt value) { return std::fwrite(&value, sizeof(UnsignedInt), 1, _file) == 1; } -auto BinaryWriter::writeLong(Long value) -> bool { +bool +BinaryWriter::writeLong(Long value) { return std::fwrite(&value, sizeof(Long), 1, _file) == 1; } -auto BinaryWriter::writeUnsignedLong(UnsignedLong value) -> bool { +bool +BinaryWriter::writeUnsignedLong(UnsignedLong value) { return std::fwrite(&value, sizeof(UnsignedLong), 1, _file) == 1; } -auto BinaryWriter::writeFloat(Float value) -> bool { +bool +BinaryWriter::writeFloat(Float value) { return std::fwrite(&value, sizeof(Float), 1, _file) == 1; } -auto BinaryWriter::writeDouble(Double value) -> bool { +bool +BinaryWriter::writeDouble(Double value) { return std::fwrite(&value, sizeof(Double), 1, _file) == 1; } -auto BinaryWriter::writeArray(Containers::ArrayView array) -> bool { +bool +BinaryWriter::writeArray(Containers::ArrayView array) { if(array.size() == 0) { return false; } @@ -115,7 +133,8 @@ auto BinaryWriter::writeArray(Containers::ArrayView array) -> bool { return std::fwrite(array.data(), sizeof(char), array.size(), _file) == array.size(); } -auto BinaryWriter::writeUEString(Containers::StringView str) -> bool { +bool +BinaryWriter::writeUEString(Containers::StringView str) { if(str.size() > UINT32_MAX) { LOG_ERROR_FORMAT("String is too big. Expected size() < UINT32_MAX, got {} instead.", str.size()); return false; @@ -132,7 +151,8 @@ auto BinaryWriter::writeUEString(Containers::StringView str) -> bool { return writeChar('\0'); } -auto BinaryWriter::writeUEStringToArray(Containers::StringView value) -> UnsignedLong { +UnsignedLong +BinaryWriter::writeUEStringToArray(Containers::StringView value) { return writeValueToArray(UnsignedInt(value.size()) + 1u) + writeDataToArray(Containers::ArrayView{value}) + writeValueToArray('\0'); diff --git a/src/UESaveFile/BinaryWriter.h b/src/UESaveFile/BinaryWriter.h index efdc4ed..4921f1e 100644 --- a/src/UESaveFile/BinaryWriter.h +++ b/src/UESaveFile/BinaryWriter.h @@ -39,47 +39,47 @@ class BinaryWriter { BinaryWriter(BinaryWriter&& other) = default; BinaryWriter& operator=(BinaryWriter&& other) = default; - auto open() -> bool; + bool open(); void closeFile(); - auto position() -> Long; + Long position(); - auto array() const -> Containers::ArrayView; - auto arrayPosition() const -> UnsignedLong; - auto flushToFile() -> bool; + Containers::ArrayView array() const; + UnsignedLong arrayPosition() const; + bool flushToFile(); - auto writeByte(Byte value) -> bool; - auto writeChar(char value) -> bool; - auto writeUnsignedByte(UnsignedByte value) -> bool; - auto writeShort(Short value) -> bool; - auto writeUnsignedShort(UnsignedShort value) -> bool; - auto writeInt(Int value) -> bool; - auto writeUnsignedInt(UnsignedInt value) -> bool; - auto writeLong(Long value) -> bool; - auto writeUnsignedLong(UnsignedLong value) -> bool; - auto writeFloat(Float value) -> bool; - auto writeDouble(Double value) -> bool; - auto writeArray(Containers::ArrayView array) -> bool; + bool writeByte(Byte value); + bool writeChar(char value); + bool writeUnsignedByte(UnsignedByte value); + bool writeShort(Short value); + bool writeUnsignedShort(UnsignedShort value); + bool writeInt(Int value); + bool writeUnsignedInt(UnsignedInt value); + bool writeLong(Long value); + bool writeUnsignedLong(UnsignedLong value); + bool writeFloat(Float value); + bool writeDouble(Double value); + bool writeArray(Containers::ArrayView array); template - auto writeString(const char(&str)[size]) -> bool { + bool writeString(const char(&str)[size]) { return writeArray({str, size - 1}); } template - auto writeStaticArray(Containers::StaticArrayView array) -> bool { + bool writeStaticArray(Containers::StaticArrayView array) { return std::fwrite(array.data(), sizeof(char), S, _file) == S; } - auto writeUEString(Containers::StringView str) -> bool; + bool writeUEString(Containers::StringView str); template::value, T, T&>> - auto writeValueToArray(U value) -> UnsignedLong { + UnsignedLong writeValueToArray(U value) { Containers::ArrayView view{&value, 1}; return writeDataToArray(view); } - auto writeUEStringToArray(Containers::StringView value) -> UnsignedLong; + UnsignedLong writeUEStringToArray(Containers::StringView value); template void writeValueToArrayAt(T& value, UnsignedLong position) { @@ -88,7 +88,7 @@ class BinaryWriter { } template - auto writeDataToArray(Containers::ArrayView view) -> UnsignedLong { + UnsignedLong writeDataToArray(Containers::ArrayView view) { arrayAppend(_data, Containers::arrayCast(view)); _index += sizeof(T) * view.size(); return sizeof(T) * view.size(); diff --git a/src/UESaveFile/Debug.cpp b/src/UESaveFile/Debug.cpp index 31bc2ab..d10a752 100644 --- a/src/UESaveFile/Debug.cpp +++ b/src/UESaveFile/Debug.cpp @@ -22,17 +22,20 @@ #include "Debug.h" -Utility::Debug& operator<<(Utility::Debug& debug, const ArrayProperty* prop) { +Utility::Debug& +operator<<(Utility::Debug& debug, const ArrayProperty* prop) { return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType << "of" << prop->items.size() << prop->itemType; } -Utility::Debug& operator<<(Utility::Debug& debug, const SetProperty* prop) { +Utility::Debug& +operator<<(Utility::Debug& debug, const SetProperty* prop) { return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType << "of" << prop->items.size() << prop->itemType; } -Utility::Debug& operator<<(Utility::Debug& debug, const GenericStructProperty* prop) { +Utility::Debug& +operator<<(Utility::Debug& debug, const GenericStructProperty* prop) { debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->structType << "(" << Utility::Debug::nospace << prop->propertyType << Utility::Debug::nospace << ") Contents:"; @@ -42,7 +45,8 @@ Utility::Debug& operator<<(Utility::Debug& debug, const GenericStructProperty* p return debug; } -Utility::Debug& operator<<(Utility::Debug& debug, const StructProperty* prop) { +Utility::Debug& +operator<<(Utility::Debug& debug, const StructProperty* prop) { auto cast = dynamic_cast(prop); if(cast) { return debug << cast; @@ -52,7 +56,8 @@ Utility::Debug& operator<<(Utility::Debug& debug, const StructProperty* prop) { prop->structType << "(" << Utility::Debug::nospace << prop->propertyType << Utility::Debug::nospace << ")"; } -Utility::Debug& operator<<(Utility::Debug& debug, const UnrealPropertyBase* prop) { +Utility::Debug& +operator<<(Utility::Debug& debug, const UnrealPropertyBase* prop) { if(prop->propertyType == "ArrayProperty") { auto array_prop = dynamic_cast(prop); if(array_prop) { diff --git a/src/UESaveFile/PropertySerialiser.cpp b/src/UESaveFile/PropertySerialiser.cpp index 77e8e4a..775189f 100644 --- a/src/UESaveFile/PropertySerialiser.cpp +++ b/src/UESaveFile/PropertySerialiser.cpp @@ -67,12 +67,14 @@ PropertySerialiser::PropertySerialiser() { arrayAppend(_collectionSerialisers, Containers::pointer()); } -auto PropertySerialiser::instance() -> PropertySerialiser& { +PropertySerialiser& +PropertySerialiser::instance() { static PropertySerialiser serialiser; return serialiser; } -auto PropertySerialiser::read(BinaryReader& reader) -> UnrealPropertyBase::ptr { +UnrealPropertyBase::ptr +PropertySerialiser::read(BinaryReader& reader) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; } @@ -99,8 +101,10 @@ auto PropertySerialiser::read(BinaryReader& reader) -> UnrealPropertyBase::ptr { return deserialise(std::move(name), std::move(type), value_length, reader); } -auto PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length, - Containers::String name) -> UnrealPropertyBase::ptr { +UnrealPropertyBase::ptr +PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length, + Containers::String name) +{ if(reader.peekChar() < 0 || reader.eof()) { return nullptr; } @@ -108,9 +112,8 @@ auto PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, return deserialise(std::move(name), std::move(type), value_length, reader); } -auto PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, - UnsignedInt count) -> Containers::Array -{ +Containers::Array +PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, UnsignedInt count) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; } @@ -153,8 +156,9 @@ auto PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView it return array; } -auto PropertySerialiser::deserialise(Containers::String name, Containers::String type, UnsignedLong value_length, - BinaryReader& reader) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +PropertySerialiser::deserialise(Containers::String name, Containers::String type, UnsignedLong value_length, + BinaryReader& reader) { UnrealPropertyBase::ptr prop; auto serialiser = getSerialiser(type); @@ -176,8 +180,8 @@ auto PropertySerialiser::deserialise(Containers::String name, Containers::String return prop; } -auto PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer) -> bool +bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, + UnsignedLong& bytes_written, BinaryWriter& writer) { auto serialiser = getSerialiser(item_type); if(!serialiser) { @@ -186,7 +190,8 @@ auto PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::St return serialiser->serialise(prop, bytes_written, writer, *this); } -auto PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer) -> bool { +bool +PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); return true; @@ -209,8 +214,9 @@ auto PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& byte return ret; } -auto PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer) -> bool +bool +PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, + UnsignedLong& bytes_written, BinaryWriter& writer) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); @@ -220,9 +226,8 @@ auto PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::St return serialise(prop, item_type, bytes_written, writer); } -auto PropertySerialiser::writeSet(Containers::ArrayView props, - Containers::StringView item_type, UnsignedLong& bytes_written, - BinaryWriter& writer) -> bool +bool PropertySerialiser::writeSet(Containers::ArrayView props, + Containers::StringView item_type, UnsignedLong& bytes_written, BinaryWriter& writer) { auto serialiser = getCollectionSerialiser(item_type); if(serialiser) { @@ -239,7 +244,8 @@ auto PropertySerialiser::writeSet(Containers::ArrayView } } -auto PropertySerialiser::getSerialiser(Containers::StringView item_type) -> AbstractUnrealPropertySerialiser* { +AbstractUnrealPropertySerialiser* +PropertySerialiser::getSerialiser(Containers::StringView item_type) { for(auto& item : _serialisers) { for(auto serialiser_type : item->types()) { if(item_type == serialiser_type) { @@ -251,7 +257,8 @@ auto PropertySerialiser::getSerialiser(Containers::StringView item_type) -> Abst return nullptr; } -auto PropertySerialiser::getCollectionSerialiser(Containers::StringView item_type) -> AbstractUnrealCollectionPropertySerialiser* { +AbstractUnrealCollectionPropertySerialiser* +PropertySerialiser::getCollectionSerialiser(Containers::StringView item_type) { for(auto& item : _collectionSerialisers) { for(Containers::StringView serialiser_type : item->types()) { if(item_type == serialiser_type) { diff --git a/src/UESaveFile/PropertySerialiser.h b/src/UESaveFile/PropertySerialiser.h index 67a1aed..579e527 100644 --- a/src/UESaveFile/PropertySerialiser.h +++ b/src/UESaveFile/PropertySerialiser.h @@ -32,28 +32,29 @@ class BinaryWriter; class PropertySerialiser { public: - static auto instance() -> PropertySerialiser&; + static PropertySerialiser& instance(); - auto read(BinaryReader& reader) -> UnrealPropertyBase::ptr; - auto readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length, - Containers::String name) -> UnrealPropertyBase::ptr; - auto readSet(BinaryReader& reader, Containers::StringView item_type, UnsignedInt count) -> Containers::Array; - auto deserialise(Containers::String name, Containers::String type, UnsignedLong value_length, - BinaryReader& reader) -> UnrealPropertyBase::ptr; + UnrealPropertyBase::ptr read(BinaryReader& reader); + UnrealPropertyBase::ptr readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length, + Containers::String name); + Containers::Array readSet(BinaryReader& reader, Containers::StringView item_type, + UnsignedInt count); + UnrealPropertyBase::ptr deserialise(Containers::String name, Containers::String type, UnsignedLong value_length, + BinaryReader& reader); - auto serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written, - BinaryWriter& writer) -> bool; - auto write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer) -> bool; - auto writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written, - BinaryWriter& writer) -> bool; - auto writeSet(Containers::ArrayView props, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer) -> bool; + bool serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written, + BinaryWriter& writer); + bool write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer); + bool writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written, + BinaryWriter& writer); + bool writeSet(Containers::ArrayView props, Containers::StringView item_type, + UnsignedLong& bytes_written, BinaryWriter& writer); private: PropertySerialiser(); - auto getSerialiser(Containers::StringView item_type) -> AbstractUnrealPropertySerialiser*; - auto getCollectionSerialiser(Containers::StringView item_type) -> AbstractUnrealCollectionPropertySerialiser*; + AbstractUnrealPropertySerialiser* getSerialiser(Containers::StringView item_type); + AbstractUnrealCollectionPropertySerialiser* getCollectionSerialiser(Containers::StringView item_type); Containers::Array _serialisers; Containers::Array _collectionSerialisers; diff --git a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h index ffa273d..a798222 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h @@ -32,17 +32,20 @@ class BinaryReader; class BinaryWriter; class PropertySerialiser; +using PropertyArray = Containers::Array; +using PropertyArrayView = Containers::ArrayView; + class AbstractUnrealCollectionPropertySerialiser { public: using ptr = Containers::Pointer; virtual ~AbstractUnrealCollectionPropertySerialiser() = default; - virtual auto types() -> Containers::ArrayView = 0; + virtual StringArrayView types() = 0; - virtual auto deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, UnsignedInt count, BinaryReader& reader, - PropertySerialiser& serialiser) -> Containers::Array = 0; + virtual PropertyArray deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, UnsignedInt count, BinaryReader& reader, + PropertySerialiser& serialiser) = 0; virtual auto serialise(Containers::ArrayView props, Containers::StringView item_type, UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) -> bool = 0; diff --git a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h index 0ddbfd1..cd68b5e 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h @@ -31,17 +31,20 @@ class BinaryReader; class BinaryWriter; class PropertySerialiser; +using StringArrayView = Containers::ArrayView; + class AbstractUnrealPropertySerialiser { public: using ptr = Containers::Pointer; virtual ~AbstractUnrealPropertySerialiser() = default; - virtual auto types() -> Containers::ArrayView = 0; + virtual StringArrayView types() = 0; - virtual auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr = 0; + virtual UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) = 0; - virtual auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool = 0; + virtual bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) = 0; }; diff --git a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h index 7e62fc6..c7e9827 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h @@ -37,10 +37,10 @@ class AbstractUnrealStructSerialiser { virtual ~AbstractUnrealStructSerialiser() = default; - virtual auto supportsType(Containers::StringView type) -> bool = 0; + virtual bool supportsType(Containers::StringView type) = 0; - virtual auto deserialise(BinaryReader& reader) -> UnrealPropertyBase::ptr = 0; + virtual UnrealPropertyBase::ptr deserialise(BinaryReader& reader) = 0; - virtual auto serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, - UnsignedLong& bytes_written) -> bool = 0; + virtual bool serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, + UnsignedLong& bytes_written) = 0; }; diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp index d2efbb8..1b06824 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp @@ -23,9 +23,10 @@ #include "ArrayPropertySerialiser.h" -auto ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -52,8 +53,9 @@ auto ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, C return prop; } -auto ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto array_prop = dynamic_cast(prop.get()); if(!array_prop) { diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h index f9b0334..7d7eef1 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h @@ -32,8 +32,9 @@ class ArrayPropertySerialiser : public UnrealPropertySerialiser { using ptr = Containers::Pointer; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp b/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp index 7f9e6cc..b4b689b 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp @@ -20,15 +20,16 @@ #include "BoolPropertySerialiser.h" -auto BoolPropertySerialiser::types() -> Containers::ArrayView { +StringArrayView +BoolPropertySerialiser::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"BoolProperty"_s}}; return types; } -auto BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { if(value_length != 0) { LOG_ERROR_FORMAT("Invalid value length for bool property {}. Expected 0, got {} instead.", name, value_length); @@ -52,8 +53,9 @@ auto BoolPropertySerialiser::deserialise(Containers::StringView name, Containers return prop; } -auto BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto bool_prop = dynamic_cast(prop.get()); if(!bool_prop) { diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h b/src/UESaveFile/Serialisers/BoolPropertySerialiser.h index ddbbf85..2507313 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/BoolPropertySerialiser.h @@ -29,11 +29,12 @@ class BoolPropertySerialiser : public AbstractUnrealPropertySerialiser { public: using ptr = Containers::Pointer; - auto types() -> Containers::ArrayView override; + StringArrayView types() override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp index eb24db1..fed7309 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp @@ -20,15 +20,16 @@ #include "BytePropertySerialiser.h" -auto BytePropertySerialiser::types() -> Containers::ArrayView { +StringArrayView +BytePropertySerialiser::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"ByteProperty"_s}}; return types; } -auto BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -64,8 +65,9 @@ auto BytePropertySerialiser::deserialise(Containers::StringView name, Containers return prop; } -auto BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto byte_prop = dynamic_cast(prop.get()); if(!byte_prop) { diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.h b/src/UESaveFile/Serialisers/BytePropertySerialiser.h index 74b7205..4e1ff71 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.h @@ -27,11 +27,12 @@ class BytePropertySerialiser : public AbstractUnrealPropertySerialiser { public: using ptr = Containers::Pointer; - auto types() -> Containers::ArrayView override; + StringArrayView types() override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp b/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp index d90035f..4972cd7 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp @@ -20,9 +20,10 @@ #include "ColourPropertySerialiser.h" -auto ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -36,8 +37,9 @@ auto ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, return prop; } -auto ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto colour_prop = dynamic_cast(prop.get()); if(!colour_prop) { @@ -45,8 +47,10 @@ auto ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, return false; } - bytes_written += writer.writeValueToArray(colour_prop->r) + writer.writeValueToArray(colour_prop->g) + - writer.writeValueToArray(colour_prop->b) + writer.writeValueToArray(colour_prop->a); + bytes_written += writer.writeValueToArray(colour_prop->r) + + writer.writeValueToArray(colour_prop->g) + + writer.writeValueToArray(colour_prop->b) + + writer.writeValueToArray(colour_prop->a); return true; } diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h b/src/UESaveFile/Serialisers/ColourPropertySerialiser.h index d14dd1f..f137eee 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ColourPropertySerialiser.h @@ -29,8 +29,9 @@ class ColourPropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp index 6e32666..09187cd 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp @@ -20,9 +20,10 @@ #include "DateTimePropertySerialiser.h" -auto DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -34,8 +35,9 @@ auto DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name return prop; } -auto DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto dt_prop = dynamic_cast(prop.get()); if(!dt_prop) { diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h index 51db914..78e3bfd 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h @@ -27,8 +27,9 @@ class DateTimePropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp b/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp index 4cb5835..191d5e4 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp @@ -20,15 +20,16 @@ #include "EnumPropertySerialiser.h" -auto EnumPropertySerialiser::types() -> Containers::ArrayView { +StringArrayView +EnumPropertySerialiser::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"EnumProperty"_s}}; return types; } -auto EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -51,8 +52,9 @@ auto EnumPropertySerialiser::deserialise(Containers::StringView name, Containers return prop; } -auto EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto enum_prop = dynamic_cast(prop.get()); if(!enum_prop) { diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h b/src/UESaveFile/Serialisers/EnumPropertySerialiser.h index 57b821b..c2874a3 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/EnumPropertySerialiser.h @@ -27,11 +27,12 @@ class EnumPropertySerialiser : public AbstractUnrealPropertySerialiser { public: using ptr = Containers::Pointer; - auto types() -> Containers::ArrayView override; + StringArrayView types() override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp b/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp index 4134f94..0d229d9 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp @@ -20,15 +20,16 @@ #include "FloatPropertySerialiser.h" -auto FloatPropertySerialiser::types() -> Containers::ArrayView { +StringArrayView +FloatPropertySerialiser::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"FloatProperty"_s}}; return types; } -auto FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -46,8 +47,9 @@ auto FloatPropertySerialiser::deserialise(Containers::StringView name, Container return prop; } -auto FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto float_prop = dynamic_cast(prop.get()); if(!float_prop) { diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h b/src/UESaveFile/Serialisers/FloatPropertySerialiser.h index d09d31b..9ec5741 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/FloatPropertySerialiser.h @@ -27,11 +27,12 @@ class FloatPropertySerialiser : public AbstractUnrealPropertySerialiser { public: using ptr = Containers::Pointer; - auto types() -> Containers::ArrayView override; + StringArrayView types() override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp b/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp index dd0036b..d70aefa 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp @@ -22,9 +22,10 @@ using namespace Containers::Literals; -auto GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -36,8 +37,9 @@ auto GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Co return prop; } -auto GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto guid_prop = dynamic_cast(prop.get()); if(!guid_prop) { diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h b/src/UESaveFile/Serialisers/GuidPropertySerialiser.h index 33f7d8c..6094f83 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/GuidPropertySerialiser.h @@ -27,8 +27,9 @@ class GuidPropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp b/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp index 3c2e50f..074e670 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp @@ -20,9 +20,10 @@ #include "IntPropertySerialiser.h" -auto IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -52,8 +53,9 @@ auto IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Con return prop; } -auto IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto int_prop = dynamic_cast(prop.get()); if(!int_prop) { diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.h b/src/UESaveFile/Serialisers/IntPropertySerialiser.h index 4dc9f88..6b8ef46 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/IntPropertySerialiser.h @@ -27,8 +27,9 @@ class IntPropertySerialiser : public UnrealPropertySerialiser { using ptr = Containers::Pointer; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp b/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp index 35a9055..7692575 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp @@ -24,9 +24,10 @@ using namespace Containers::Literals; -auto MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -107,8 +108,9 @@ auto MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Con return prop; } -auto MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto map_prop = dynamic_cast(prop.get()); if(!map_prop) { diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.h b/src/UESaveFile/Serialisers/MapPropertySerialiser.h index e8ebaba..c6150aa 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/MapPropertySerialiser.h @@ -27,8 +27,9 @@ class MapPropertySerialiser : public UnrealPropertySerialiser { using ptr = Containers::Pointer; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp index 6113c11..9a2ee48 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp @@ -25,9 +25,10 @@ using namespace Containers::Literals; -auto ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -77,8 +78,9 @@ auto ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name return prop; } -auto ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto res_prop = dynamic_cast(prop.get()); if(!res_prop) { diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h index bccd012..8053327 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h @@ -27,8 +27,9 @@ class ResourcePropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp index ecd125d..3ea30d4 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp @@ -20,9 +20,10 @@ #include "RotatorPropertySerialiser.h" -auto RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -34,8 +35,9 @@ auto RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, return prop; } -auto RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto rotator = dynamic_cast(prop.get()); if(!rotator) { diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h index eec73c9..1ef9349 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h @@ -27,8 +27,9 @@ class RotatorPropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp b/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp index cfa9bd0..2c10211 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp @@ -21,9 +21,10 @@ #include "SetPropertySerialiser.h" -auto SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -56,8 +57,9 @@ auto SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Con return prop; } -auto SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto set_prop = dynamic_cast(prop.get()); if(!set_prop) { diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.h b/src/UESaveFile/Serialisers/SetPropertySerialiser.h index 8bfddee..84ed8e5 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/SetPropertySerialiser.h @@ -27,8 +27,9 @@ class SetPropertySerialiser : public UnrealPropertySerialiser { using ptr = Containers::Pointer; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp b/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp index 3cb4208..4c5f210 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp @@ -20,17 +20,18 @@ #include "StringPropertySerialiser.h" -auto StringPropertySerialiser::types() -> Containers::ArrayView { +StringArrayView +StringPropertySerialiser::types() { using namespace Containers::Literals; - static const Containers::Array types{InPlaceInit, - {"NameProperty"_s, "StrProperty"_s, - "SoftObjectProperty"_s, "ObjectProperty"_s}}; + static const Containers::Array types{InPlaceInit, { + "NameProperty"_s, "StrProperty"_s, "SoftObjectProperty"_s, "ObjectProperty"_s + }}; return types; } -auto StringPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +StringPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(type); @@ -52,8 +53,9 @@ auto StringPropertySerialiser::deserialise(Containers::StringView name, Containe return prop; } -auto StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto str_prop = dynamic_cast(prop.get()); if(!str_prop) { diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.h b/src/UESaveFile/Serialisers/StringPropertySerialiser.h index 5965bcf..685dfbf 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/StringPropertySerialiser.h @@ -27,11 +27,12 @@ class StringPropertySerialiser : public AbstractUnrealPropertySerialiser { public: using ptr = Containers::Pointer; - auto types() -> Containers::ArrayView override; + StringArrayView types() override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/StructSerialiser.cpp b/src/UESaveFile/Serialisers/StructSerialiser.cpp index 95001b7..fe2e306 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.cpp +++ b/src/UESaveFile/Serialisers/StructSerialiser.cpp @@ -25,14 +25,16 @@ #include "StructSerialiser.h" -auto StructSerialiser::types() -> Containers::ArrayView { +StringArrayView +StructSerialiser::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"StructProperty"_s}}; return types; } -auto StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) -> Containers::Array +Containers::Array +StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -83,8 +85,9 @@ auto StructSerialiser::deserialise(Containers::StringView name, Containers::Stri return array; } -auto StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -120,8 +123,9 @@ auto StructSerialiser::deserialise(Containers::StringView name, Containers::Stri return prop; } -auto StructSerialiser::serialise(Containers::ArrayView props, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +StructSerialiser::serialise(Containers::ArrayView props, Containers::StringView item_type, + UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { bytes_written += writer.writeUEStringToArray(*(props.front()->name)); bytes_written += writer.writeUEStringToArray(item_type); @@ -163,8 +167,9 @@ auto StructSerialiser::serialise(Containers::ArrayView return true; } -auto StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto struct_prop = dynamic_cast(prop.get()); if(!struct_prop) { @@ -189,8 +194,9 @@ auto StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& by return true; } -auto StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> StructProperty::ptr +StructProperty::ptr +StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { auto st_prop = Containers::pointer(); st_prop->structType = type; @@ -212,8 +218,9 @@ auto StructSerialiser::readStructValue(Containers::StringView name, Containers:: return st_prop; } -auto StructSerialiser::writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +StructSerialiser::writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { auto struct_prop = dynamic_cast(prop); if(!struct_prop) { diff --git a/src/UESaveFile/Serialisers/StructSerialiser.h b/src/UESaveFile/Serialisers/StructSerialiser.h index 81efcc0..2de192d 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.h +++ b/src/UESaveFile/Serialisers/StructSerialiser.h @@ -29,20 +29,23 @@ class StructSerialiser : public AbstractUnrealPropertySerialiser, public Abstrac public: using ptr = Containers::Pointer; - auto types() -> Containers::ArrayView override; + StringArrayView types() override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) -> Containers::Array override; - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; + PropertyArray deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, + UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) override; + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; - auto serialise(Containers::ArrayView props, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) -> bool override; - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool override; + bool serialise(PropertyArrayView props, Containers::StringView item_type, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) override; + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; private: - auto readStructValue(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> StructProperty::ptr; - auto writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) -> bool; -}; + StructProperty::ptr readStructValue(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser); + bool writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser); +} ; diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp index 89d9af0..a3e2329 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp @@ -21,9 +21,10 @@ #include "TextPropertySerialiser.h" -auto TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -68,8 +69,9 @@ auto TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Co return prop; } -auto TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto text_prop = dynamic_cast(prop.get()); diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.h b/src/UESaveFile/Serialisers/TextPropertySerialiser.h index 0938936..08e1028 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.h @@ -27,8 +27,9 @@ class TextPropertySerialiser : public UnrealPropertySerialiser { using ptr = Containers::Pointer; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h b/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h index e3fcdb6..763d18f 100644 --- a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h @@ -27,17 +27,19 @@ template class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser { - static_assert(std::is_base_of::value, "T must be derived from UnrealPropertyBase."); + static_assert(std::is_base_of::value, "T must be derived from UnrealPropertyBase."); public: using ptr = Containers::Pointer>; - auto types() -> Containers::ArrayView override { + StringArrayView types() override { static const Containers::Array types = []{ Containers::Array array; Containers::Pointer p(new T); if(std::is_base_of::value) { - array = Containers::Array{InPlaceInit, {dynamic_cast(p.get())->structType}}; + array = Containers::Array{InPlaceInit, { + dynamic_cast(p.get())->structType + }}; } else { array = Containers::Array{InPlaceInit, {p->propertyType}}; @@ -47,23 +49,24 @@ class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser { return types; } - auto deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override + UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override { return deserialiseProperty(name, type, value_length, reader, serialiser); } - auto serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override + bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override { return serialiseProperty(prop, bytes_written, writer, serialiser); } private: - virtual auto deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> typename UnrealPropertyBase::ptr = 0; + virtual UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) = 0; - virtual auto serialiseProperty(typename UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool = 0; + virtual bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) = 0; }; diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp index ef002c7..872e767 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp @@ -20,9 +20,10 @@ #include "Vector2DPropertySerialiser.h" -auto Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -34,8 +35,9 @@ auto Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name return prop; } -auto Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto vector = dynamic_cast(prop.get()); if(!vector) { diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h index faa1682..f6de167 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h @@ -27,8 +27,9 @@ class Vector2DPropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp b/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp index 97bd0a8..738914d 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp @@ -20,9 +20,10 @@ #include "VectorPropertySerialiser.h" -auto VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, - PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr +UnrealPropertyBase::ptr +VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -34,8 +35,9 @@ auto VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, return prop; } -auto VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) -> bool +bool +VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { auto vector = dynamic_cast(prop.get()); if(!vector) { diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h b/src/UESaveFile/Serialisers/VectorPropertySerialiser.h index 8a8cc7e..85d2920 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/VectorPropertySerialiser.h @@ -27,8 +27,9 @@ class VectorPropertySerialiser : public UnrealPropertySerialiser; private: - auto deserialiseProperty(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> UnrealPropertyBase::ptr override; - auto serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) -> bool override; + UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, + UnsignedLong value_length, BinaryReader& reader, + PropertySerialiser& serialiser) override; + bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Types/GenericStructProperty.h b/src/UESaveFile/Types/GenericStructProperty.h index 9c76828..6472fd0 100644 --- a/src/UESaveFile/Types/GenericStructProperty.h +++ b/src/UESaveFile/Types/GenericStructProperty.h @@ -45,7 +45,7 @@ struct GenericStructProperty : public StructProperty { atMove(Containers::StringView name) { for(auto& item : properties) { if(item && item->name == name) { - return Containers::Pointer{static_cast(item.release())}; + return Containers::pointerCast(std::move(item)); } } return nullptr; diff --git a/src/UESaveFile/UESaveFile.cpp b/src/UESaveFile/UESaveFile.cpp index 44942ba..51d5684 100644 --- a/src/UESaveFile/UESaveFile.cpp +++ b/src/UESaveFile/UESaveFile.cpp @@ -33,15 +33,18 @@ UESaveFile::UESaveFile(Containers::String filepath): loadData(); } -auto UESaveFile::valid() const -> bool { +bool +UESaveFile::valid() const { return _valid; } -auto UESaveFile::lastError() const -> Containers::StringView { +Containers::StringView +UESaveFile::lastError() const { return _lastError; } -auto UESaveFile::reloadData() -> bool { +bool +UESaveFile::reloadData() { if(_noReloadAfterSave) { _noReloadAfterSave = false; return valid(); @@ -52,21 +55,25 @@ auto UESaveFile::reloadData() -> bool { return valid(); } -auto UESaveFile::saveType() -> Containers::StringView { +Containers::StringView +UESaveFile::saveType() { return _saveType; } -void UESaveFile::appendProperty(UnrealPropertyBase::ptr prop) { +void +UESaveFile::appendProperty(UnrealPropertyBase::ptr prop) { auto none_prop = std::move(_properties.back()); _properties.back() = std::move(prop); arrayAppend(_properties, std::move(none_prop)); } -auto UESaveFile::props() -> Containers::ArrayView { +Containers::ArrayView +UESaveFile::props() { return _properties; } -auto UESaveFile::saveToFile() -> bool { +bool +UESaveFile::saveToFile() { LOG_INFO_FORMAT("Writing to {}.", _filepath); bool temp_file = _filepath.hasSuffix(".tmp"); @@ -155,7 +162,8 @@ auto UESaveFile::saveToFile() -> bool { return true; } -void UESaveFile::loadData() { +void +UESaveFile::loadData() { LOG_INFO_FORMAT("Reading data from {}.", _filepath); _valid = false; diff --git a/src/UESaveFile/UESaveFile.h b/src/UESaveFile/UESaveFile.h index a281369..8ed3476 100644 --- a/src/UESaveFile/UESaveFile.h +++ b/src/UESaveFile/UESaveFile.h @@ -36,12 +36,12 @@ class UESaveFile { public: explicit UESaveFile(Containers::String filepath); - auto valid() const -> bool; - auto lastError() const -> Containers::StringView; + bool valid() const; + Containers::StringView lastError() const; - auto reloadData() -> bool; + bool reloadData(); - auto saveType() -> Containers::StringView; + Containers::StringView saveType(); template std::enable_if_t::value, T*> @@ -56,9 +56,9 @@ class UESaveFile { void appendProperty(UnrealPropertyBase::ptr prop); - auto props() -> Containers::ArrayView; + Containers::ArrayView props(); - auto saveToFile() -> bool; + bool saveToFile(); private: void loadData(); -- 2.39.5 From 9c074c24bdce0f8533a7a40ae94858d8d48caae8 Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 5 Dec 2022 11:32:18 +0100 Subject: [PATCH 005/126] Update coding style. Magnum's type names are fine, but I'd rather limit what depends on Magnum as much as possible. Vector types are still allowed, though. No way I'll write my own. --- src/Logger/Logger.cpp | 4 +- src/Logger/Logger.h | 6 +- src/Maps/Accessories.h | 7 +- src/Maps/ArmourSets.h | 7 +- src/Maps/LastMissionId.h | 5 +- src/Maps/StoryProgress.h | 5 +- src/Maps/StyleNames.h | 7 +- src/Maps/WeaponParts.h | 29 ++- src/Mass/Accessory.h | 6 +- src/Mass/ArmourPart.h | 7 +- src/Mass/CustomStyle.h | 12 +- src/Mass/Decal.h | 7 +- src/Mass/Joints.h | 20 +- src/Mass/Mass.cpp | 19 +- src/Mass/Mass.h | 43 +++-- src/Mass/Mass_Armour.cpp | 14 +- src/Mass/Mass_DecalsAccessories.cpp | 12 +- src/Mass/Mass_Frame.cpp | 8 +- src/Mass/Mass_Styles.cpp | 6 +- src/Mass/Mass_Weapons.cpp | 14 +- src/Mass/Weapon.cpp | 4 +- src/Mass/WeaponPart.h | 15 +- src/MassManager/MassManager.cpp | 14 +- src/Profile/Profile.cpp | 116 ++++++------ src/Profile/Profile.h | 179 +++++++++--------- src/Profile/ResourceIDs.h | 6 +- src/ProfileManager/ProfileManager.cpp | 10 +- src/ProfileManager/ProfileManager.h | 14 +- src/SaveTool/SaveTool.cpp | 10 +- src/SaveTool/SaveTool.h | 36 ++-- src/SaveTool/SaveTool_FileWatcher.cpp | 4 +- src/SaveTool/SaveTool_Initialisation.cpp | 8 +- src/SaveTool/SaveTool_MainManager.cpp | 64 +++---- src/SaveTool/SaveTool_MassViewer.cpp | 20 +- src/SaveTool/SaveTool_MassViewer_Armour.cpp | 22 +-- src/SaveTool/SaveTool_MassViewer_Frame.cpp | 4 +- src/SaveTool/SaveTool_MassViewer_Weapons.cpp | 20 +- src/SaveTool/SaveTool_UpdateChecker.cpp | 10 +- src/SaveTool/SaveTool_drawMainMenu.cpp | 4 +- src/ToastQueue/ToastQueue.cpp | 35 ++-- src/ToastQueue/ToastQueue.h | 10 +- src/UESaveFile/BinaryReader.cpp | 52 ++--- src/UESaveFile/BinaryReader.h | 30 ++- src/UESaveFile/BinaryWriter.cpp | 50 ++--- src/UESaveFile/BinaryWriter.h | 42 ++-- src/UESaveFile/PropertySerialiser.cpp | 32 ++-- src/UESaveFile/PropertySerialiser.h | 14 +- ...stractUnrealCollectionPropertySerialiser.h | 9 +- .../AbstractUnrealPropertySerialiser.h | 7 +- .../AbstractUnrealStructSerialiser.h | 6 +- .../Serialisers/ArrayPropertySerialiser.cpp | 14 +- .../Serialisers/ArrayPropertySerialiser.h | 7 +- .../Serialisers/BoolPropertySerialiser.cpp | 10 +- .../Serialisers/BoolPropertySerialiser.h | 4 +- .../Serialisers/BytePropertySerialiser.cpp | 14 +- .../Serialisers/BytePropertySerialiser.h | 4 +- .../Serialisers/ColourPropertySerialiser.cpp | 12 +- .../Serialisers/ColourPropertySerialiser.h | 4 +- .../DateTimePropertySerialiser.cpp | 8 +- .../Serialisers/DateTimePropertySerialiser.h | 4 +- .../Serialisers/EnumPropertySerialiser.cpp | 4 +- .../Serialisers/EnumPropertySerialiser.h | 4 +- .../Serialisers/FloatPropertySerialiser.cpp | 6 +- .../Serialisers/FloatPropertySerialiser.h | 4 +- .../Serialisers/GuidPropertySerialiser.cpp | 4 +- .../Serialisers/GuidPropertySerialiser.h | 4 +- .../Serialisers/IntPropertySerialiser.cpp | 16 +- .../Serialisers/IntPropertySerialiser.h | 4 +- .../Serialisers/MapPropertySerialiser.cpp | 22 +-- .../Serialisers/MapPropertySerialiser.h | 4 +- .../ResourcePropertySerialiser.cpp | 12 +- .../Serialisers/ResourcePropertySerialiser.h | 4 +- .../Serialisers/RotatorPropertySerialiser.cpp | 8 +- .../Serialisers/RotatorPropertySerialiser.h | 4 +- .../Serialisers/SetPropertySerialiser.cpp | 20 +- .../Serialisers/SetPropertySerialiser.h | 4 +- .../Serialisers/StringPropertySerialiser.cpp | 8 +- .../Serialisers/StringPropertySerialiser.h | 4 +- .../Serialisers/StructSerialiser.cpp | 32 ++-- src/UESaveFile/Serialisers/StructSerialiser.h | 14 +- .../Serialisers/TextPropertySerialiser.cpp | 8 +- .../Serialisers/TextPropertySerialiser.h | 4 +- .../Serialisers/UnrealPropertySerialiser.h | 8 +- .../Vector2DPropertySerialiser.cpp | 6 +- .../Serialisers/Vector2DPropertySerialiser.h | 4 +- .../Serialisers/VectorPropertySerialiser.cpp | 8 +- .../Serialisers/VectorPropertySerialiser.h | 4 +- src/UESaveFile/Types/ColourStructProperty.h | 2 +- src/UESaveFile/Types/DateTimeStructProperty.h | 5 +- src/UESaveFile/Types/FloatProperty.h | 5 +- src/UESaveFile/Types/IntProperty.h | 2 +- src/UESaveFile/Types/ResourceItemValue.h | 11 +- src/UESaveFile/Types/RotatorStructProperty.h | 5 +- src/UESaveFile/Types/UnrealPropertyBase.h | 7 +- src/UESaveFile/Types/Vector2DStructProperty.h | 5 +- src/UESaveFile/Types/VectorStructProperty.h | 5 +- src/UESaveFile/UESaveFile.cpp | 48 ++--- src/UESaveFile/UESaveFile.h | 19 +- src/Utilities/Crc32.h | 60 +++--- src/main.cpp | 2 +- 100 files changed, 751 insertions(+), 815 deletions(-) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index b8f5cd4..7ae0f9d 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -25,8 +25,6 @@ using Utility::Debug; using Utility::Warning; using Utility::Error; -using namespace Magnum; - Logger& Logger::instance() { static Logger logger; @@ -89,7 +87,7 @@ Logger::log(EntryType type, StringView location, StringView message) { d << "["_s << Debug::nospace << location << Debug::nospace << "]"; - for(UnsignedInt i = 0; i < _indentLevel; i++) { + for(auto i = 0u; i < _indentLevel; i++) { d << Debug::nospace << " "_s << Debug::nospace; } diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index 370c08b..9bb793b 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -27,8 +27,6 @@ #include #include -#include - #include "EntryType.h" using namespace Corrade; @@ -37,8 +35,6 @@ using Containers::ArrayView; using Containers::String; using Containers::StringView; -using namespace Magnum; - using namespace Containers::Literals; class Logger { @@ -68,7 +64,7 @@ class Logger { std::ofstream _logFile; #endif - UnsignedInt _indentLevel = 0; + std::uint32_t _indentLevel = 0; std::mutex _logMutex{}; }; diff --git a/src/Maps/Accessories.h b/src/Maps/Accessories.h index 5b3ebbb..61b664a 100644 --- a/src/Maps/Accessories.h +++ b/src/Maps/Accessories.h @@ -16,15 +16,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include -#include - using namespace Corrade; using namespace Containers::Literals; -using namespace Magnum; enum AccessorySize { S, @@ -38,7 +37,7 @@ struct AccessoryData{ AccessorySize size = AccessorySize::S; }; -static const std::map accessories { +static const std::map accessories { // region Primitives {1, {"Cube"_s, AccessorySize::S}}, {2, {"Pentagon"_s, AccessorySize::S}}, diff --git a/src/Maps/ArmourSets.h b/src/Maps/ArmourSets.h index 8051709..167c471 100644 --- a/src/Maps/ArmourSets.h +++ b/src/Maps/ArmourSets.h @@ -16,22 +16,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include -#include - using namespace Corrade; using namespace Containers::Literals; -using namespace Magnum; struct ArmourSet { Containers::StringView name; bool neck_compatible; }; -static const std::map armour_sets { +static const std::map armour_sets { {-1, {""_s, true}}, {0, {"Vanguard"_s, true}}, {1, {"Assault Mk.I"_s, true}}, diff --git a/src/Maps/LastMissionId.h b/src/Maps/LastMissionId.h index 4cbdd23..bcc60d3 100644 --- a/src/Maps/LastMissionId.h +++ b/src/Maps/LastMissionId.h @@ -20,13 +20,10 @@ #include -#include - using namespace Corrade; using namespace Containers::Literals; -using namespace Magnum; -static const std::map mission_id_map {{ +static const std::map mission_id_map {{ // Story missions {0x0064, "Mission 1 - Training"_s}, {0x0065, "Mission 2 - Patrol Operation"_s}, diff --git a/src/Maps/StoryProgress.h b/src/Maps/StoryProgress.h index 2e9e28d..040aa01 100644 --- a/src/Maps/StoryProgress.h +++ b/src/Maps/StoryProgress.h @@ -19,14 +19,11 @@ #include #include -#include - using namespace Corrade; using namespace Containers::Literals; -using namespace Magnum; struct StoryProgressPoint { - Int id; + std::int32_t id; Containers::StringView chapter; Containers::StringView point; Containers::StringView after = nullptr; diff --git a/src/Maps/StyleNames.h b/src/Maps/StyleNames.h index e62188f..675a117 100644 --- a/src/Maps/StyleNames.h +++ b/src/Maps/StyleNames.h @@ -16,17 +16,16 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include -#include - using namespace Corrade; using namespace Containers::Literals; -using namespace Magnum; -extern const std::map style_names +extern const std::map style_names #ifdef STYLENAMES_DEFINITION { {0, "Custom Style 1"_s}, diff --git a/src/Maps/WeaponParts.h b/src/Maps/WeaponParts.h index 3455943..8de7269 100644 --- a/src/Maps/WeaponParts.h +++ b/src/Maps/WeaponParts.h @@ -15,19 +15,18 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include -#include - using namespace Corrade; -using namespace Magnum; using namespace Containers::Literals; // region Melee -static const std::map melee_grips { +static const std::map melee_grips { {0, "Combat Grip (1H)"_s}, {1, "Knuckle Guard Grip (1H)"_s}, {2, "Dual Guard Grip (1H)"_s}, @@ -78,7 +77,7 @@ static const std::map melee_grips { {2404, "Arched Twin Blade (2H)"_s}, }; -static const std::map melee_assaulters { +static const std::map melee_assaulters { {0, "Long Metal Blade"_s}, {1, "Long Assault Blade"_s}, {2, "Long Fin Blade"_s}, @@ -172,7 +171,7 @@ static const std::map melee_assaulters { // endregion // region Shields -static const std::map shield_handles { +static const std::map shield_handles { {0, "Balanced Handle"_s}, {1, "Expanded Handle"_s}, {2, "Lowguard Handle"_s}, @@ -191,7 +190,7 @@ static const std::map shield_handles { {101, "Star Handle"_s}, }; -static const std::map shield_shells { +static const std::map shield_shells { {0, "Balanced Shell"_s}, {1, "Compass Shell"_s}, {2, "Uppoint Shell"_s}, @@ -212,7 +211,7 @@ static const std::map shield_shells { // endregion // region Bullet Shooters -static const std::map bshooter_triggers { +static const std::map bshooter_triggers { {0, "BL-Combat Trigger (1H)"_s}, {1, "Light Machine Trigger (1H)"_s}, {2, "Tactical Trigger (1H)"_s}, @@ -230,7 +229,7 @@ static const std::map bshooter_triggers { {199, "2H Base Trigger (2H)"_s}, }; -static const std::map bshooter_barrels { +static const std::map bshooter_barrels { {0, "BL-Combat Barrel (1 shot)"_s}, {1, "Shock Absorb Barrel (1 shot) (Motion)"_s}, {2, "Muzzlemod Barrel (1 shot)"_s}, @@ -267,7 +266,7 @@ static const std::map bshooter_barrels { // endregion //region Energy Shooters -static const std::map eshooter_triggers { +static const std::map eshooter_triggers { {0, "EN-Rifle Trigger (1H)"_s}, {1, "Underarm Trigger (1H)"_s}, {2, "EN-Inverted Trigger (1H)"_s}, @@ -285,7 +284,7 @@ static const std::map eshooter_triggers { {199, "2H Base EnTrigger (2H)"_s}, }; -static const std::map eshooter_busters { +static const std::map eshooter_busters { {0, "EN-Combat Buster (1 shot)"_s}, {1, "Delta Cycler (1 shot) (Motion)"_s}, {2, "EN-Longbarrel Buster (1 shot)"_s}, @@ -321,7 +320,7 @@ static const std::map eshooter_busters { // endregion // region Bullet Launchers -static const std::map blauncher_pods { +static const std::map blauncher_pods { {0, "BL-Delta Pack Launcher (Missile x12)"_s}, {1, "BL-Twin Pack Launcher (Missile x12)"_s}, {2, "Detector Launcher (Missile x12)"_s}, @@ -351,7 +350,7 @@ static const std::map blauncher_pods { {399, "C Base Pod (Cluster x40)"_s}, }; -static const std::map blauncher_projectiles { +static const std::map blauncher_projectiles { {0, "Flathead Missile"_s}, {1, "Warhead Missile"_s}, {2, "Pointhead Missile"_s}, @@ -361,7 +360,7 @@ static const std::map blauncher_projectiles { // endregion // region Energy Launchers -static const std::map elauncher_generators { +static const std::map elauncher_generators { {0, "Fly Unit"_s}, {1, "Assault Unit (Motion)"_s}, {2, "Falcon Unit"_s}, @@ -393,7 +392,7 @@ static const std::map elauncher_generators { {99, "Base Generator"}, }; -static const std::map elauncher_pods { +static const std::map elauncher_pods { {0, "EN-Dual Claw Launcher (Echo) (Motion)"_s}, {1, "EN-Assault Launcher (Echo)"_s}, {2, "EN-Tactical Launcher (Echo)"_s}, diff --git a/src/Mass/Accessory.h b/src/Mass/Accessory.h index cca271d..4f326f4 100644 --- a/src/Mass/Accessory.h +++ b/src/Mass/Accessory.h @@ -25,9 +25,9 @@ using namespace Corrade; using namespace Magnum; struct Accessory { - Int attachIndex = -1; - Int id = -1; - Containers::StaticArray<2, Int> styles{ValueInit}; + std::int32_t attachIndex = -1; + std::int32_t id = -1; + Containers::StaticArray<2, std::int32_t> styles{ValueInit}; Vector3 relativePosition{0.0f}; Vector3 relativePositionOffset{0.0f}; Vector3 relativeRotation{0.0f}; diff --git a/src/Mass/ArmourPart.h b/src/Mass/ArmourPart.h index 9f7a96c..c30dc79 100644 --- a/src/Mass/ArmourPart.h +++ b/src/Mass/ArmourPart.h @@ -19,13 +19,10 @@ #include #include -#include - #include "Decal.h" #include "Accessory.h" using namespace Corrade; -using namespace Magnum; enum class ArmourSlot { #define c(enumerator, enumstr, name) enumerator, @@ -35,8 +32,8 @@ enum class ArmourSlot { struct ArmourPart { ArmourSlot slot = ArmourSlot::Face; - Int id = 0; - Containers::StaticArray<4, Int> styles{ValueInit}; + std::int32_t id = 0; + Containers::StaticArray<4, std::int32_t> styles{ValueInit}; Containers::Array decals; Containers::Array accessories; }; diff --git a/src/Mass/CustomStyle.h b/src/Mass/CustomStyle.h index 7fcc9c3..8dbc832 100644 --- a/src/Mass/CustomStyle.h +++ b/src/Mass/CustomStyle.h @@ -28,13 +28,13 @@ using namespace Magnum; struct CustomStyle { Containers::String name; Color4 colour{0.0f}; - Float metallic = 0.5f; - Float gloss = 0.5f; + float metallic = 0.5f; + float gloss = 0.5f; bool glow = false; - Int patternId = 0; - Float opacity = 0.5f; + std::int32_t patternId = 0; + float opacity = 0.5f; Vector2 offset{0.5f}; - Float rotation = 0.0f; - Float scale = 0.5f; + float rotation = 0.0f; + float scale = 0.5f; }; diff --git a/src/Mass/Decal.h b/src/Mass/Decal.h index 3758b75..727147b 100644 --- a/src/Mass/Decal.h +++ b/src/Mass/Decal.h @@ -19,18 +19,19 @@ #include #include #include +#include using namespace Magnum; struct Decal { - Int id = -1; + std::int32_t id = -1; Color4 colour{0.0f}; Vector3 position{0.0f}; Vector3 uAxis{0.0f}; Vector3 vAxis{0.0f}; Vector2 offset{0.5f}; - Float scale = 0.5f; - Float rotation = 0.0f; + float scale = 0.5f; + float rotation = 0.0f; bool flip = false; bool wrap = false; }; diff --git a/src/Mass/Joints.h b/src/Mass/Joints.h index 8cc58c2..a1c358e 100644 --- a/src/Mass/Joints.h +++ b/src/Mass/Joints.h @@ -16,17 +16,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include - -using namespace Magnum; - struct Joints { - Float neck = 0.0f; - Float body = 0.0f; - Float shoulders = 0.0f; - Float hips = 0.0f; - Float upperArms = 0.0f; - Float lowerArms = 0.0f; - Float upperLegs = 0.0f; - Float lowerLegs = 0.0f; + float neck = 0.0f; + float body = 0.0f; + float shoulders = 0.0f; + float hips = 0.0f; + float upperArms = 0.0f; + float lowerArms = 0.0f; + float upperLegs = 0.0f; + float lowerLegs = 0.0f; }; diff --git a/src/Mass/Mass.cpp b/src/Mass/Mass.cpp index 98f064f..d585c74 100644 --- a/src/Mass/Mass.cpp +++ b/src/Mass/Mass.cpp @@ -308,32 +308,32 @@ Mass::getTuning() { } } -Int& +std::int32_t& Mass::engine() { return _tuning.engineId; } -Containers::ArrayView +Containers::ArrayView Mass::gears() { return _tuning.gearIds; } -Int& +std::int32_t& Mass::os() { return _tuning.osId; } -Containers::ArrayView +Containers::ArrayView Mass::modules() { return _tuning.moduleIds; } -Int& +std::int32_t& Mass::architecture() { return _tuning.archId; } -Containers::ArrayView +Containers::ArrayView Mass::techs() { return _tuning.techIds; } @@ -365,8 +365,9 @@ Mass::updateAccount(Containers::StringView new_account) { } void -Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id, - Containers::StringView small_nodes_prop_name, Containers::ArrayView small_nodes_ids) +Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& big_node_id, + Containers::StringView small_nodes_prop_name, + Containers::ArrayView small_nodes_ids) { LOG_INFO_FORMAT("Getting tuning data ({}, {}).", big_node_prop_name, small_nodes_prop_name); @@ -392,7 +393,7 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node return; } - for(UnsignedInt i = 0; i < small_nodes_ids.size(); i++) { + for(std::uint32_t i = 0; i < small_nodes_ids.size(); i++) { auto small_node_id = node_ids->at(i); CORRADE_INTERNAL_ASSERT(small_node_id); small_nodes_ids[i] = small_node_id->value; diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index ed991c7..74292ec 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -64,7 +64,7 @@ class Mass { Containers::StringView name(); bool setName(Containers::StringView new_name); - enum class State : UnsignedByte { + enum class State: std::uint8_t { Empty, Invalid, Valid }; @@ -77,7 +77,7 @@ class Mass { void getJointSliders(); bool writeJointSliders(); - Containers::ArrayView frameStyles(); + Containers::ArrayView frameStyles(); void getFrameStyles(); bool writeFrameStyles(); @@ -87,7 +87,7 @@ class Mass { Containers::ArrayView frameCustomStyles(); void getFrameCustomStyles(); - bool writeFrameCustomStyle(UnsignedLong index); + bool writeFrameCustomStyle(std::size_t index); Containers::ArrayView armourParts(); void getArmourParts(); @@ -100,7 +100,7 @@ class Mass { Containers::ArrayView armourCustomStyles(); void getArmourCustomStyles(); - bool writeArmourCustomStyle(UnsignedLong index); + bool writeArmourCustomStyle(std::size_t index); Containers::ArrayView meleeWeapons(); void getMeleeWeapons(); @@ -128,25 +128,25 @@ class Mass { Containers::ArrayView globalStyles(); void getGlobalStyles(); - bool writeGlobalStyle(UnsignedLong index); + bool writeGlobalStyle(std::size_t index); void getTuning(); - Int& engine(); - Containers::ArrayView gears(); + std::int32_t& engine(); + Containers::ArrayView gears(); - Int& os(); - Containers::ArrayView modules(); + std::int32_t& os(); + Containers::ArrayView modules(); - Int& architecture(); - Containers::ArrayView techs(); + std::int32_t& architecture(); + Containers::ArrayView techs(); Containers::StringView account(); bool updateAccount(Containers::StringView new_account); private: void getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array); - bool writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array); + bool writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array); void getDecals(Containers::ArrayView decals, ArrayProperty* decal_array); void writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array); @@ -157,8 +157,9 @@ class Mass { void getWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array); bool writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array); - void getTuningCategory(Containers::StringView big_node_prop_name, Int& big_node_id, - Containers::StringView small_nodes_prop_name, Containers::ArrayView small_nodes_ids); + void getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& big_node_id, + Containers::StringView small_nodes_prop_name, + Containers::ArrayView small_nodes_ids); Containers::Optional _mass; @@ -174,7 +175,7 @@ class Mass { struct { Joints joints{}; - Containers::StaticArray<4, Int> styles{ValueInit}; + Containers::StaticArray<4, std::int32_t> styles{ValueInit}; Color4 eyeFlare{0.0f}; Containers::StaticArray<16, CustomStyle> customStyles; } _frame; @@ -198,14 +199,14 @@ class Mass { Containers::Array _globalStyles; struct { - Int engineId; - Containers::StaticArray<7, Int> gearIds; + std::int32_t engineId; + Containers::StaticArray<7, std::int32_t> gearIds; - Int osId; - Containers::StaticArray<7, Int> moduleIds; + std::int32_t osId; + Containers::StaticArray<7, std::int32_t> moduleIds; - Int archId; - Containers::StaticArray<7, Int> techIds; + std::int32_t archId; + Containers::StaticArray<7, std::int32_t> techIds; } _tuning; Containers::String _account; diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 4a656c6..5450319 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -59,7 +59,7 @@ Mass::getArmourParts() { return; } - for(UnsignedInt i = 0; i < armour_array->items.size(); i++) { + for(std::uint32_t i = 0; i < armour_array->items.size(); i++) { auto part_prop = armour_array->at(i); auto& part = _armour.parts[i]; @@ -89,7 +89,7 @@ Mass::getArmourParts() { return; } - for(UnsignedInt j = 0; j < part_styles->items.size(); j++) { + for(std::uint32_t j = 0; j < part_styles->items.size(); j++) { part.styles[j] = part_styles->at(j)->value; } @@ -152,7 +152,7 @@ Mass::writeArmourPart(ArmourSlot slot) { GenericStructProperty* part_prop = nullptr; - for(UnsignedInt i = 0; i < armour_array->items.size(); i++) { + for(std::uint32_t i = 0; i < armour_array->items.size(); i++) { part_prop = armour_array->at(i); if(slot_str == part_prop->at(MASS_ARMOUR_SLOT)->enumValue) { break; @@ -178,7 +178,7 @@ Mass::writeArmourPart(ArmourSlot slot) { part_prop->at(MASS_ARMOUR_ID)->value = part.id; auto part_styles = part_prop->at(MASS_ARMOUR_STYLES); - for(UnsignedInt i = 0; i < part.styles.size(); i++) { + for(std::uint32_t i = 0; i < part.styles.size(); i++) { part_styles->at(i)->value = part.styles[i]; } @@ -238,7 +238,7 @@ Mass::getBulletLauncherAttachments() { if(attach_array->items.size() == _weapons.bulletLaunchers.size() && attach_array->items.size() == _armour.blAttachment.size()) { - for(UnsignedInt i = 0; i < attach_array->items.size(); i++) { + for(std::uint32_t i = 0; i < attach_array->items.size(); i++) { auto attachment_prop = attach_array->at(i); auto& attachment = _armour.blAttachment[i]; @@ -313,7 +313,7 @@ Mass::writeBulletLauncherAttachments() { if(attach_array->items.size() == _weapons.bulletLaunchers.size() && attach_array->items.size() == _armour.blAttachment.size()) { - for(UnsignedInt i = 0; i < attach_array->items.size(); i++) { + for(std::uint32_t i = 0; i < attach_array->items.size(); i++) { auto attachment_prop = attach_array->at(i); auto& attachment = _armour.blAttachment[i]; @@ -414,7 +414,7 @@ Mass::getArmourCustomStyles() { } bool -Mass::writeArmourCustomStyle(UnsignedLong index) { +Mass::writeArmourCustomStyle(std::size_t index) { LOG_INFO_FORMAT("Writing custom armour style {}.", index); if(index > _armour.customStyles.size()) { diff --git a/src/Mass/Mass_DecalsAccessories.cpp b/src/Mass/Mass_DecalsAccessories.cpp index 7b28d25..dfb8d00 100644 --- a/src/Mass/Mass_DecalsAccessories.cpp +++ b/src/Mass/Mass_DecalsAccessories.cpp @@ -31,7 +31,7 @@ using namespace Containers::Literals; void Mass::getDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { - for(UnsignedInt i = 0; i < decal_array->items.size(); i++) { + for(std::uint32_t i = 0; i < decal_array->items.size(); i++) { auto decal_prop = decal_array->at(i); CORRADE_INTERNAL_ASSERT(decal_prop); auto& decal = decals[i]; @@ -56,7 +56,7 @@ Mass::getDecals(Containers::ArrayView decals, ArrayProperty* decal_array) void Mass::writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { - for(UnsignedInt i = 0; i < decal_array->items.size(); i++) { + for(std::uint32_t i = 0; i < decal_array->items.size(); i++) { auto decal_prop = decal_array->at(i); CORRADE_INTERNAL_ASSERT(decal_prop); auto& decal = decals[i]; @@ -91,7 +91,7 @@ Mass::writeDecals(Containers::ArrayView decals, ArrayProperty* decal_arra void Mass::getAccessories(Containers::ArrayView accessories, ArrayProperty* accessory_array) { - for(UnsignedInt i = 0; i < accessory_array->items.size(); i++) { + for(std::uint32_t i = 0; i < accessory_array->items.size(); i++) { auto acc_prop = accessory_array->at(i); CORRADE_INTERNAL_ASSERT(acc_prop); auto& accessory = accessories[i]; @@ -99,7 +99,7 @@ Mass::getAccessories(Containers::ArrayView accessories, ArrayProperty accessory.attachIndex = acc_prop->at(MASS_ACCESSORY_ATTACH_INDEX)->value; accessory.id = acc_prop->at(MASS_ACCESSORY_ID)->value; auto acc_styles = acc_prop->at(MASS_ACCESSORY_STYLES); - for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) { + for(std::uint32_t j = 0; j < acc_styles->items.size(); j++) { accessory.styles[j] = acc_styles->at(j)->value; } auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); @@ -117,7 +117,7 @@ Mass::getAccessories(Containers::ArrayView accessories, ArrayProperty void Mass::writeAccessories(Containers::ArrayView accessories, ArrayProperty* accs_array) { - for(UnsignedInt i = 0; i < accs_array->items.size(); i++) { + for(std::uint32_t i = 0; i < accs_array->items.size(); i++) { auto acc_prop = accs_array->at(i); CORRADE_INTERNAL_ASSERT(acc_prop); auto& accessory = accessories[i]; @@ -125,7 +125,7 @@ Mass::writeAccessories(Containers::ArrayView accessories, ArrayProper acc_prop->at(MASS_ACCESSORY_ATTACH_INDEX)->value = accessory.attachIndex; acc_prop->at(MASS_ACCESSORY_ID)->value = accessory.id; auto acc_styles = acc_prop->at(MASS_ACCESSORY_STYLES); - for(UnsignedInt j = 0; j < acc_styles->items.size(); j++) { + for(std::uint32_t j = 0; j < acc_styles->items.size(); j++) { acc_styles->at(j)->value = accessory.styles[j]; } auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index 77721d7..02f3546 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -184,7 +184,7 @@ Mass::writeJointSliders() { return true; } -Containers::ArrayView +Containers::ArrayView Mass::frameStyles() { return _frame.styles; } @@ -221,7 +221,7 @@ Mass::getFrameStyles() { return; } - for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) { + for(std::uint32_t i = 0; i < frame_styles->items.size(); i++) { _frame.styles[i] = frame_styles->at(i)->value; } } @@ -254,7 +254,7 @@ Mass::writeFrameStyles() { return false; } - for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) { + for(std::uint32_t i = 0; i < frame_styles->items.size(); i++) { frame_styles->at(i)->value = _frame.styles[i]; } @@ -374,7 +374,7 @@ Mass::getFrameCustomStyles() { } bool -Mass::writeFrameCustomStyle(UnsignedLong index) { +Mass::writeFrameCustomStyle(std::size_t index) { LOG_INFO_FORMAT("Writing frame custom style number {}.", index); if(index > _frame.customStyles.size()) { diff --git a/src/Mass/Mass_Styles.cpp b/src/Mass/Mass_Styles.cpp index a5181ef..6aeaaf1 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/Mass/Mass_Styles.cpp @@ -58,7 +58,7 @@ Mass::getGlobalStyles() { } bool -Mass::writeGlobalStyle(UnsignedLong index) { +Mass::writeGlobalStyle(std::size_t index) { LOG_INFO_FORMAT("Writing global style number {}.", index); if(index > _globalStyles.size()) { @@ -88,7 +88,7 @@ Mass::writeGlobalStyle(UnsignedLong index) { void Mass::getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array) { - for(UnsignedInt i = 0; i < style_array->items.size(); i++) { + for(std::uint32_t i = 0; i < style_array->items.size(); i++) { auto style_prop = style_array->at(i); auto& style = styles[i]; @@ -111,7 +111,7 @@ Mass::getCustomStyles(Containers::ArrayView styles, ArrayProperty* } bool -Mass::writeCustomStyle(const CustomStyle& style, UnsignedLong index, ArrayProperty* style_array) { +Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array) { if(!style_array) { _lastError = "style_array is null."_s; LOG_ERROR(_lastError); diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index a9ea9fe..ae64965 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -153,7 +153,7 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(i); auto& weapon = weapon_array[i]; @@ -171,14 +171,14 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_ELEMENT); weapon.parts = Containers::Array{ValueInit, parts_prop->items.size()}; - for(UnsignedInt j = 0; j < parts_prop->items.size(); j++) { + for(std::uint32_t j = 0; j < parts_prop->items.size(); j++) { auto part_prop = parts_prop->at(j); auto& part = weapon.parts[j]; part.id = part_prop->at(MASS_WEAPON_PART_ID)->value; auto part_styles = part_prop->at(MASS_WEAPON_PART_STYLES); - for(UnsignedInt k = 0; k < part_styles->items.size(); k++) { + for(std::uint32_t k = 0; k < part_styles->items.size(); k++) { part.styles[k] = part_styles->at(k)->value; } @@ -268,7 +268,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(i); auto& weapon = weapon_array[i]; @@ -292,14 +292,14 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewitems.size(); j++) { + for(std::uint32_t j = 0; j < parts_prop->items.size(); j++) { auto part_prop = parts_prop->at(j); auto& part = weapon.parts[j]; part_prop->at(MASS_WEAPON_PART_ID)->value = part.id; auto part_styles = part_prop->at(MASS_WEAPON_PART_STYLES); - for(UnsignedInt k = 0; k < part_styles->items.size(); k++) { + for(std::uint32_t k = 0; k < part_styles->items.size(); k++) { part_styles->at(k)->value = part.styles[k]; } @@ -338,7 +338,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView{other.parts.size()}; - for(UnsignedInt i = 0; i < parts.size(); i++) { + for(std::uint32_t i = 0; i < parts.size(); i++) { parts[i] = other.parts[i]; } customStyles = other.customStyles; @@ -35,7 +35,7 @@ Weapon& Weapon::operator=(const Weapon& other) { name = other.name; type = other.type; parts = Containers::Array{other.parts.size()}; - for(UnsignedInt i = 0; i < parts.size(); i++) { + for(std::uint32_t i = 0; i < parts.size(); i++) { parts[i] = other.parts[i]; } customStyles = other.customStyles; diff --git a/src/Mass/WeaponPart.h b/src/Mass/WeaponPart.h index 227b5af..406e23b 100644 --- a/src/Mass/WeaponPart.h +++ b/src/Mass/WeaponPart.h @@ -19,13 +19,10 @@ #include #include -#include - #include "Decal.h" #include "Accessory.h" using namespace Corrade; -using namespace Magnum; struct WeaponPart { WeaponPart() = default; @@ -34,11 +31,11 @@ struct WeaponPart { id = other.id; styles = other.styles; decals = Containers::Array{other.decals.size()}; - for(UnsignedInt i = 0; i < decals.size(); i++) { + for(auto i = 0u; i < decals.size(); i++) { decals[i] = other.decals[i]; } accessories = Containers::Array{other.accessories.size()}; - for(UnsignedInt i = 0; i < accessories.size(); i++) { + for(auto i = 0u; i < accessories.size(); i++) { accessories[i] = other.accessories[i]; } } @@ -46,11 +43,11 @@ struct WeaponPart { id = other.id; styles = other.styles; decals = Containers::Array{other.decals.size()}; - for(UnsignedInt i = 0; i < decals.size(); i++) { + for(auto i = 0u; i < decals.size(); i++) { decals[i] = other.decals[i]; } accessories = Containers::Array{other.accessories.size()}; - for(UnsignedInt i = 0; i < accessories.size(); i++) { + for(auto i = 0u; i < accessories.size(); i++) { accessories[i] = other.accessories[i]; } return *this; @@ -59,8 +56,8 @@ struct WeaponPart { WeaponPart(WeaponPart&& other) = default; WeaponPart& operator=(WeaponPart&& other) = default; - Int id = 0; - Containers::StaticArray<4, Int> styles{ValueInit}; + std::int32_t id = 0; + Containers::StaticArray<4, std::int32_t> styles{ValueInit}; Containers::Array decals{}; Containers::Array accessories{}; }; diff --git a/src/MassManager/MassManager.cpp b/src/MassManager/MassManager.cpp index 8bec3b5..0b94d6c 100644 --- a/src/MassManager/MassManager.cpp +++ b/src/MassManager/MassManager.cpp @@ -30,7 +30,7 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie _saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir} { Containers::String mass_filename = ""; - for(UnsignedInt i = 0; i < _hangars.size(); i++) { + for(std::uint32_t i = 0; i < _hangars.size(); i++) { mass_filename = Utility::Path::join(_saveDirectory, Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account)); new(&_hangars[i]) Mass{mass_filename}; @@ -45,12 +45,12 @@ MassManager::lastError() { } Mass& -MassManager::hangar(Int hangar) { +MassManager::hangar(std::int32_t hangar) { return _hangars[hangar]; } void -MassManager::refreshHangar(Int hangar) { +MassManager::refreshHangar(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -64,7 +64,7 @@ MassManager::refreshHangar(Int hangar) { } bool -MassManager::importMass(Containers::StringView staged_fn, Int hangar) { +MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -107,7 +107,7 @@ MassManager::importMass(Containers::StringView staged_fn, Int hangar) { } bool -MassManager::exportMass(Int hangar) { +MassManager::exportMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -134,7 +134,7 @@ MassManager::exportMass(Int hangar) { } bool -MassManager::moveMass(Int source, Int destination) { +MassManager::moveMass(std::int32_t source, std::int32_t destination) { if(source < 0 || source >= 32) { _lastError = "Source hangar index out of range."_s; LOG_ERROR(_lastError); @@ -172,7 +172,7 @@ MassManager::moveMass(Int source, Int destination) { } bool -MassManager::deleteMass(Int hangar) { +MassManager::deleteMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index 288e8cf..a572d00 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -189,24 +189,24 @@ Profile::renameCompany(Containers::StringView new_name) { return true; } -Int +std::int32_t Profile::activeFrameSlot() const { return _activeFrameSlot; } -Int +std::int32_t Profile::credits() const { return _credits; } bool -Profile::setCredits(Int amount) { +Profile::setCredits(std::int32_t amount) { auto credits_prop = _profile.at(PROFILE_CREDITS); if(!credits_prop) { credits_prop = new IntProperty; credits_prop->name.emplace("Credit"_s); - credits_prop->valueLength = sizeof(Int); + credits_prop->valueLength = sizeof(std::int32_t); _profile.appendProperty(IntProperty::ptr{credits_prop}); } @@ -220,19 +220,19 @@ Profile::setCredits(Int amount) { return true; } -Int +std::int32_t Profile::storyProgress() const { return _storyProgress; } bool -Profile::setStoryProgress(Int progress) { +Profile::setStoryProgress(std::int32_t progress) { auto story_progress_prop = _profile.at("StoryProgress"_s); if(!story_progress_prop) { story_progress_prop = new IntProperty; story_progress_prop->name.emplace("StoryProgress"_s); - story_progress_prop->valueLength = sizeof(Int); + story_progress_prop->valueLength = sizeof(std::int32_t); _profile.appendProperty(IntProperty::ptr{story_progress_prop}); } @@ -246,252 +246,252 @@ Profile::setStoryProgress(Int progress) { return true; } -Int +std::int32_t Profile::lastMissionId() const { return _lastMissionId; } -Int +std::int32_t Profile::verseSteel() const { return _verseSteel; } bool -Profile::setVerseSteel(Int amount) { +Profile::setVerseSteel(std::int32_t amount) { return setResource(PROFILE_MATERIAL, VerseSteel, amount); } -Int +std::int32_t Profile::undinium() const { return _undinium; } bool -Profile::setUndinium(Int amount) { +Profile::setUndinium(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Undinium, amount); } -Int +std::int32_t Profile::necriumAlloy() const { return _necriumAlloy; } bool -Profile::setNecriumAlloy(Int amount) { +Profile::setNecriumAlloy(std::int32_t amount) { return setResource(PROFILE_MATERIAL, NecriumAlloy, amount); } -Int +std::int32_t Profile::lunarite() const { return _lunarite; } bool -Profile::setLunarite(Int amount) { +Profile::setLunarite(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Lunarite, amount); } -Int +std::int32_t Profile::asterite() const { return _asterite; } bool -Profile::setAsterite(Int amount) { +Profile::setAsterite(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Asterite, amount); } -Int +std::int32_t Profile::halliteFragma() const { return _halliteFragma; } bool -Profile::setHalliteFragma(Int amount) { +Profile::setHalliteFragma(std::int32_t amount) { return setResource(PROFILE_MATERIAL, HalliteFragma, amount); } -Int +std::int32_t Profile::ednil() const { return _ednil; } bool -Profile::setEdnil(Int amount) { +Profile::setEdnil(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Ednil, amount); } -Int +std::int32_t Profile::nuflalt() const { return _nuflalt; } bool -Profile::setNuflalt(Int amount) { +Profile::setNuflalt(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Nuflalt, amount); } -Int +std::int32_t Profile::aurelene() const { return _aurelene; } bool -Profile::setAurelene(Int amount) { +Profile::setAurelene(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Aurelene, amount); } -Int +std::int32_t Profile::soldus() const { return _soldus; } bool -Profile::setSoldus(Int amount) { +Profile::setSoldus(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Soldus, amount); } -Int +std::int32_t Profile::synthesisedN() const { return _synthesisedN; } bool -Profile::setSynthesisedN(Int amount) { +Profile::setSynthesisedN(std::int32_t amount) { return setResource(PROFILE_MATERIAL, SynthesisedN, amount); } -Int +std::int32_t Profile::nanoc() const { return _nanoc; } bool -Profile::setNanoc(Int amount) { +Profile::setNanoc(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Nanoc, amount); } -Int +std::int32_t Profile::alcarbonite() const { return _alcarbonite; } bool -Profile::setAlcarbonite(Int amount) { +Profile::setAlcarbonite(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Alcarbonite, amount); } -Int +std::int32_t Profile::keriphene() const { return _keriphene; } bool -Profile::setKeriphene(Int amount) { +Profile::setKeriphene(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Keriphene, amount); } -Int +std::int32_t Profile::nitinolCM() const { return _nitinolCM; } bool -Profile::setNitinolCM(Int amount) { +Profile::setNitinolCM(std::int32_t amount) { return setResource(PROFILE_MATERIAL, NitinolCM, amount); } -Int +std::int32_t Profile::quarkium() const { return _quarkium; } bool -Profile::setQuarkium(Int amount) { +Profile::setQuarkium(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Quarkium, amount); } -Int +std::int32_t Profile::alterene() const { return _alterene; } bool -Profile::setAlterene(Int amount) { +Profile::setAlterene(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Alterene, amount); } -Int +std::int32_t Profile::cosmium() const { return _cosmium; } bool -Profile::setCosmium(Int amount) { +Profile::setCosmium(std::int32_t amount) { return setResource(PROFILE_MATERIAL, Cosmium, amount); } -Int +std::int32_t Profile::mixedComposition() const { return _mixedComposition; } bool -Profile::setMixedComposition(Int amount) { +Profile::setMixedComposition(std::int32_t amount) { return setResource(PROFILE_QUARK_DATA, MixedComposition, amount); } -Int +std::int32_t Profile::voidResidue() const { return _voidResidue; } bool -Profile::setVoidResidue(Int amount) { +Profile::setVoidResidue(std::int32_t amount) { return setResource(PROFILE_QUARK_DATA, VoidResidue, amount); } -Int +std::int32_t Profile::muscularConstruction() const { return _muscularConstruction; } bool -Profile::setMuscularConstruction(Int amount) { +Profile::setMuscularConstruction(std::int32_t amount) { return setResource(PROFILE_QUARK_DATA, MuscularConstruction, amount); } -Int +std::int32_t Profile::mineralExoskeletology() const { return _mineralExoskeletology; } bool -Profile::setMineralExoskeletology(Int amount) { +Profile::setMineralExoskeletology(std::int32_t amount) { return setResource(PROFILE_QUARK_DATA, MineralExoskeletology, amount); } -Int +std::int32_t Profile::carbonisedSkin() const { return _carbonisedSkin; } bool -Profile::setCarbonisedSkin(Int amount) { +Profile::setCarbonisedSkin(std::int32_t amount) { return setResource(PROFILE_QUARK_DATA, CarbonisedSkin, amount); } -Int +std::int32_t Profile::isolatedVoidParticle() const { return _isolatedVoidParticle; } bool -Profile::setIsolatedVoidParticle(Int amount) { +Profile::setIsolatedVoidParticle(std::int32_t amount) { return setResource(PROFILE_QUARK_DATA, IsolatedVoidParticle, amount); } -Int +std::int32_t Profile::getResource(Containers::StringView container, MaterialID id) { auto mats_prop = _profile.at(container); @@ -509,7 +509,7 @@ Profile::getResource(Containers::StringView container, MaterialID id) { } bool -Profile::setResource(Containers::StringView container, MaterialID id, Int amount) { +Profile::setResource(Containers::StringView container, MaterialID id, std::int32_t amount) { auto mats_prop = _profile.at(container); if(!mats_prop) { diff --git a/src/Profile/Profile.h b/src/Profile/Profile.h index e861160..2539de9 100644 --- a/src/Profile/Profile.h +++ b/src/Profile/Profile.h @@ -19,16 +19,13 @@ #include #include -#include - #include "../UESaveFile/UESaveFile.h" #include "ResourceIDs.h" using namespace Corrade; -using namespace Magnum; -enum class ProfileType : UnsignedByte { +enum class ProfileType: std::uint8_t { Demo, FullGame }; @@ -37,14 +34,14 @@ class Profile { public: explicit Profile(Containers::StringView path); - auto valid() const -> bool; + bool valid() const; auto lastError() const -> Containers::StringView; auto filename() const -> Containers::StringView; - auto type() const -> ProfileType; - auto isDemo() const -> bool; + ProfileType type() const; + bool isDemo() const; auto account() const -> Containers::StringView; @@ -53,91 +50,91 @@ class Profile { auto companyName() const -> Containers::StringView; bool renameCompany(Containers::StringView new_name); - auto activeFrameSlot() const -> Int; + std::int32_t activeFrameSlot() const; - auto credits() const -> Int; - bool setCredits(Int credits); + std::int32_t credits() const; + bool setCredits(std::int32_t credits); - auto storyProgress() const -> Int; - bool setStoryProgress(Int progress); + std::int32_t storyProgress() const; + bool setStoryProgress(std::int32_t progress); - auto lastMissionId() const -> Int; + std::int32_t lastMissionId() const; - auto verseSteel() const -> Int; - bool setVerseSteel(Int amount); + std::int32_t verseSteel() const; + bool setVerseSteel(std::int32_t amount); - auto undinium() const -> Int; - bool setUndinium(Int amount); + std::int32_t undinium() const; + bool setUndinium(std::int32_t amount); - auto necriumAlloy() const -> Int; - bool setNecriumAlloy(Int amount); + std::int32_t necriumAlloy() const; + bool setNecriumAlloy(std::int32_t amount); - auto lunarite() const -> Int; - bool setLunarite(Int amount); + std::int32_t lunarite() const; + bool setLunarite(std::int32_t amount); - auto asterite() const -> Int; - bool setAsterite(Int amount); + std::int32_t asterite() const; + bool setAsterite(std::int32_t amount); - Int halliteFragma() const; - bool setHalliteFragma(Int amount); + std::int32_t halliteFragma() const; + bool setHalliteFragma(std::int32_t amount); - auto ednil() const -> Int; - bool setEdnil(Int amount); + std::int32_t ednil() const; + bool setEdnil(std::int32_t amount); - auto nuflalt() const -> Int; - bool setNuflalt(Int amount); + std::int32_t nuflalt() const; + bool setNuflalt(std::int32_t amount); - auto aurelene() const -> Int; - bool setAurelene(Int amount); + std::int32_t aurelene() const; + bool setAurelene(std::int32_t amount); - auto soldus() const -> Int; - bool setSoldus(Int amount); + std::int32_t soldus() const; + bool setSoldus(std::int32_t amount); - auto synthesisedN() const -> Int; - bool setSynthesisedN(Int amount); + std::int32_t synthesisedN() const; + bool setSynthesisedN(std::int32_t amount); - Int nanoc() const; - bool setNanoc(Int amount); + std::int32_t nanoc() const; + bool setNanoc(std::int32_t amount); - auto alcarbonite() const -> Int; - bool setAlcarbonite(Int amount); + std::int32_t alcarbonite() const; + bool setAlcarbonite(std::int32_t amount); - auto keriphene() const -> Int; - bool setKeriphene(Int amount); + std::int32_t keriphene() const; + bool setKeriphene(std::int32_t amount); - auto nitinolCM() const -> Int; - bool setNitinolCM(Int amount); + std::int32_t nitinolCM() const; + bool setNitinolCM(std::int32_t amount); - auto quarkium() const -> Int; - bool setQuarkium(Int amount); + std::int32_t quarkium() const; + bool setQuarkium(std::int32_t amount); - auto alterene() const -> Int; - bool setAlterene(Int amount); + std::int32_t alterene() const; + bool setAlterene(std::int32_t amount); - Int cosmium() const; - bool setCosmium(Int amount); + std::int32_t cosmium() const; + bool setCosmium(std::int32_t amount); - auto mixedComposition() const -> Int; - bool setMixedComposition(Int amount); + std::int32_t mixedComposition() const; + bool setMixedComposition(std::int32_t amount); - auto voidResidue() const -> Int; - bool setVoidResidue(Int amount); + std::int32_t voidResidue() const; + bool setVoidResidue(std::int32_t amount); - auto muscularConstruction() const -> Int; - bool setMuscularConstruction(Int amount); + std::int32_t muscularConstruction() const; + bool setMuscularConstruction(std::int32_t amount); - auto mineralExoskeletology() const -> Int; - bool setMineralExoskeletology(Int amount); + std::int32_t mineralExoskeletology() const; + bool setMineralExoskeletology(std::int32_t amount); - auto carbonisedSkin() const -> Int; - bool setCarbonisedSkin(Int amount); + std::int32_t carbonisedSkin() const; + bool setCarbonisedSkin(std::int32_t amount); - Int isolatedVoidParticle() const; - bool setIsolatedVoidParticle(Int amount); + std::int32_t isolatedVoidParticle() const; + bool setIsolatedVoidParticle(std::int32_t amount); private: - Int getResource(Containers::StringView container, MaterialID id); - bool setResource(Containers::StringView container, MaterialID id, Int amount); + std::int32_t getResource(Containers::StringView container, MaterialID id); + bool setResource(Containers::StringView container, MaterialID id, std::int32_t amount); Containers::String _filename; @@ -146,38 +143,38 @@ class Profile { UESaveFile _profile; Containers::String _name; - Int _activeFrameSlot = 0; - Int _credits = 0; - Int _storyProgress = 0; - Int _lastMissionId = 0; + std::int32_t _activeFrameSlot = 0; + std::int32_t _credits = 0; + std::int32_t _storyProgress = 0; + std::int32_t _lastMissionId = 0; - Int _verseSteel = 0; - Int _undinium = 0; - Int _necriumAlloy = 0; - Int _lunarite = 0; - Int _asterite = 0; - Int _halliteFragma = 0; + std::int32_t _verseSteel = 0; + std::int32_t _undinium = 0; + std::int32_t _necriumAlloy = 0; + std::int32_t _lunarite = 0; + std::int32_t _asterite = 0; + std::int32_t _halliteFragma = 0; - Int _ednil = 0; - Int _nuflalt = 0; - Int _aurelene = 0; - Int _soldus = 0; - Int _synthesisedN = 0; - Int _nanoc = 0; + std::int32_t _ednil = 0; + std::int32_t _nuflalt = 0; + std::int32_t _aurelene = 0; + std::int32_t _soldus = 0; + std::int32_t _synthesisedN = 0; + std::int32_t _nanoc = 0; - Int _alcarbonite = 0; - Int _keriphene = 0; - Int _nitinolCM = 0; - Int _quarkium = 0; - Int _alterene = 0; - Int _cosmium = 0; + std::int32_t _alcarbonite = 0; + std::int32_t _keriphene = 0; + std::int32_t _nitinolCM = 0; + std::int32_t _quarkium = 0; + std::int32_t _alterene = 0; + std::int32_t _cosmium = 0; - Int _mixedComposition = 0; - Int _voidResidue = 0; - Int _muscularConstruction = 0; - Int _mineralExoskeletology = 0; - Int _carbonisedSkin = 0; - Int _isolatedVoidParticle = 0; + std::int32_t _mixedComposition = 0; + std::int32_t _voidResidue = 0; + std::int32_t _muscularConstruction = 0; + std::int32_t _mineralExoskeletology = 0; + std::int32_t _carbonisedSkin = 0; + std::int32_t _isolatedVoidParticle = 0; Containers::String _account; diff --git a/src/Profile/ResourceIDs.h b/src/Profile/ResourceIDs.h index 3b03d11..fdaf506 100644 --- a/src/Profile/ResourceIDs.h +++ b/src/Profile/ResourceIDs.h @@ -16,11 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include - -using namespace Magnum; - -enum MaterialID : Int { +enum MaterialID : std::int32_t { VerseSteel = 0xC3500, Undinium = 0xC3501, NecriumAlloy = 0xC3502, diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index b6972ac..622b066 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -114,7 +114,7 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { } if(delete_builds) { - for(UnsignedByte i = 0; i < 32; ++i) { + for(std::uint8_t i = 0; i < 32; ++i) { auto filename = Utility::format("{}Unit{:.2d}{}.sav", _profiles[index].type() == ProfileType::Demo ? "Demo": "", i, _profiles[index].account()); @@ -176,7 +176,7 @@ ProfileManager::backupProfile(std::size_t index, bool backup_builds) { zip_set_archive_comment(zip, comment.data(), comment.size()); if(backup_builds) { - for(UnsignedByte i = 0; i < 32; ++i) { + for(std::uint8_t i = 0; i < 32; ++i) { auto build_filename = Utility::format("{}Unit{:.2d}{}.sav", profile.isDemo() ? "Demo"_s : ""_s, i, profile.account()); @@ -247,7 +247,7 @@ ProfileManager::refreshBackups() { Containers::ScopeGuard guard{zip, zip_close}; - Long num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED); + auto num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED); if(num_entries == 0) { continue; @@ -291,7 +291,7 @@ ProfileManager::refreshBackups() { arrayReserve(backup.includedFiles, num_entries); - for(Long i = 0; i < num_entries; i++) { + for(auto i = 0; i < num_entries; i++) { arrayAppend(backup.includedFiles, InPlaceInit, zip_get_name(zip, i, ZIP_FL_UNCHANGED)); } @@ -358,7 +358,7 @@ ProfileManager::restoreBackup(std::size_t index) { Containers::StaticArray<8192, char> buf{ValueInit}; - Long bytes_read = 0; + auto bytes_read = 0l; while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) { if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast(bytes_read)) { _lastError = Utility::format(error_format.data(), file, "not enough bytes written."); diff --git a/src/ProfileManager/ProfileManager.h b/src/ProfileManager/ProfileManager.h index 56c5e0a..a7b8212 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/ProfileManager/ProfileManager.h @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include @@ -30,12 +32,12 @@ struct Backup { Containers::String company; ProfileType type; struct { - int year; - int month; - int day; - int hour; - int minute; - int second; + std::int32_t year; + std::int32_t month; + std::int32_t day; + std::int32_t hour; + std::int32_t minute; + std::int32_t second; } timestamp; Containers::Array includedFiles; }; diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 922e5e3..8ba92ee 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -58,8 +58,6 @@ SaveTool::SaveTool(const Arguments& arguments): LOG_INFO("Configuring OpenGL renderer."); GL::Renderer::enable(GL::Renderer::Feature::Blending); GL::Renderer::enable(GL::Renderer::Feature::ScissorTest); - GL::Renderer::disable(GL::Renderer::Feature::FaceCulling); - GL::Renderer::disable(GL::Renderer::Feature::DepthTest); GL::Renderer::setBlendFunction(GL::Renderer::BlendFunction::SourceAlpha, GL::Renderer::BlendFunction::OneMinusSourceAlpha); GL::Renderer::setBlendEquation(GL::Renderer::BlendEquation::Add, @@ -79,7 +77,7 @@ SaveTool::SaveTool(const Arguments& arguments): #endif LOG_INFO("Registering custom events."); - if((_initEventId = SDL_RegisterEvents(3)) == UnsignedInt(-1)) { + if((_initEventId = SDL_RegisterEvents(3)) == std::uint32_t(-1)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "SDL_RegisterEvents() failed in SaveTool::SaveTool(). Exiting...", window()); exit(EXIT_FAILURE); @@ -116,7 +114,7 @@ SaveTool::SaveTool(const Arguments& arguments): checkGameState(); _gameCheckTimerId = SDL_AddTimer(2000, - [](UnsignedInt interval, void* param)->UnsignedInt{ + [](std::uint32_t interval, void* param)->std::uint32_t{ static_cast(param)->checkGameState(); return interval; }, this); @@ -405,13 +403,13 @@ SaveTool::drawGameState() { } void -SaveTool::drawHelpMarker(Containers::StringView text, Float wrap_pos) { +SaveTool::drawHelpMarker(Containers::StringView text, float wrap_pos) { ImGui::TextUnformatted(ICON_FA_QUESTION_CIRCLE); drawTooltip(text, wrap_pos); } void -SaveTool::drawTooltip(Containers::StringView text, Float wrap_pos) { +SaveTool::drawTooltip(Containers::StringView text, float wrap_pos) { if(ImGui::IsItemHovered()){ ImGui::BeginTooltip(); if(wrap_pos > 0.0f) { diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index 2685921..df4ee27 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -77,20 +77,20 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void anyEvent(SDL_Event& event) override; - enum InitStatus: Int { + enum InitStatus: std::int32_t { InitSuccess, ProfileManagerFailure }; void initEvent(SDL_Event& event); - enum UpdateCheckStatus : Int { + enum UpdateCheckStatus : std::int32_t { CurlInitFailed = 0, CurlError = 1, CurlTimeout = 2, }; void updateCheckEvent(SDL_Event& event); - enum FileEventType: Int { + enum FileEventType: std::int32_t { FileAdded = efsw::Action::Add, FileDeleted = efsw::Action::Delete, FileModified = efsw::Action::Modified, @@ -126,8 +126,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawGeneralInfo(); void drawResearchInventory(); template - void drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter); - void drawUnavailableMaterialRow(Containers::StringView name, Int tier); + void drawMaterialRow(Containers::StringView name, std::int32_t tier, Getter getter, Setter setter); + void drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier); void drawMassManager(); ImGuiID drawDeleteMassPopup(int mass_index); ImGuiID drawDeleteStagedMassPopup(Containers::StringView filename); @@ -148,7 +148,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawTuning(); void drawDecalEditor(Decal& decal); void drawAccessoryEditor(Accessory& accessory, Containers::ArrayView style_view); - Containers::StringView getStyleName(Int id, Containers::ArrayView view); + Containers::StringView getStyleName(std::int32_t id, Containers::ArrayView view); enum DCSResult { DCS_Fail, @@ -161,8 +161,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawGameState(); // Convenience wrappers over ImGui stuff - void drawHelpMarker(Containers::StringView text, Float wrap_pos = 0.0f); - void drawTooltip(Containers::StringView text, Float wrap_pos = 0.0f); + void drawHelpMarker(Containers::StringView text, float wrap_pos = 0.0f); + void drawTooltip(Containers::StringView text, float wrap_pos = 0.0f); bool drawCheckbox(Containers::StringView label, bool value); template @@ -222,9 +222,9 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener std::thread _initThread; std::thread _updateThread; - UnsignedInt _initEventId; - UnsignedInt _updateEventId; - UnsignedInt _fileEventId; + std::uint32_t _initEventId; + std::uint32_t _updateEventId; + std::uint32_t _fileEventId; Containers::String _lastError; @@ -240,7 +240,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener //Containers::String _weaponsDir; //Containers::String _stylesDir; - enum class GameState : UnsignedByte { + enum class GameState : std::uint8_t { Unknown, NotRunning, Running } _gameState{GameState::Unknown}; @@ -270,12 +270,12 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener bool _jointsDirty{false}; bool _stylesDirty{false}; bool _eyeFlareDirty{false}; - Containers::StaticArray<38, Int> _selectedArmourDecals{ValueInit}; - Containers::StaticArray<38, Int> _selectedArmourAccessories{ValueInit}; - Int _selectedBLPlacement{0}; - Int _selectedWeaponPart{0}; - Int _selectedWeaponDecal{0}; - Int _selectedWeaponAccessory{0}; + Containers::StaticArray<38, std::int32_t> _selectedArmourDecals{ValueInit}; + Containers::StaticArray<38, std::int32_t> _selectedArmourAccessories{ValueInit}; + std::int32_t _selectedBLPlacement{0}; + std::int32_t _selectedWeaponPart{0}; + std::int32_t _selectedWeaponDecal{0}; + std::int32_t _selectedWeaponAccessory{0}; bool _meleeDirty{false}; bool _shieldsDirty{false}; bool _bShootersDirty{false}; diff --git a/src/SaveTool/SaveTool_FileWatcher.cpp b/src/SaveTool/SaveTool_FileWatcher.cpp index 37cbd02..d9325fa 100644 --- a/src/SaveTool/SaveTool_FileWatcher.cpp +++ b/src/SaveTool/SaveTool_FileWatcher.cpp @@ -73,8 +73,8 @@ SaveTool::fileUpdateEvent(SDL_Event& event) { Containers::String old_filename; - Int index = 0; - Int old_index = 0; + std::int32_t index = 0; + std::int32_t old_index = 0; bool is_current_profile = filename == _currentProfile->filename(); bool is_unit = filename.hasPrefix(_currentProfile->isDemo() ? "DemoUnit"_s : "Unit"_s); if(is_unit) { diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/SaveTool/SaveTool_Initialisation.cpp index 1142d1f..e14bb2b 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/SaveTool/SaveTool_Initialisation.cpp @@ -73,7 +73,7 @@ SaveTool::initialiseGui() { font_config.FontDataOwnedByAtlas = false; std::strcpy(font_config.Name, "Source Sans Pro"); io.Fonts->AddFontFromMemoryTTF(const_cast(reg_font.data()), int(reg_font.size()), - 20.0f * Float(framebufferSize().x()) / size.x(), &font_config); + 20.0f * float(framebufferSize().x()) / size.x(), &font_config); auto icon_font = _rs.getRaw(FONT_ICON_FILE_NAME_FAS); static const ImWchar icon_range[] = { ICON_MIN_FA, ICON_MAX_FA, 0 }; @@ -84,12 +84,12 @@ SaveTool::initialiseGui() { icon_config.OversampleH = icon_config.OversampleV = 1; icon_config.GlyphMinAdvanceX = 18.0f; io.Fonts->AddFontFromMemoryTTF(const_cast(icon_font.data()), int(icon_font.size()), - 16.0f * Float(framebufferSize().x()) / size.x(), &icon_config, icon_range); + 16.0f * float(framebufferSize().x()) / size.x(), &icon_config, icon_range); auto brand_font = _rs.getRaw(FONT_ICON_FILE_NAME_FAB); static const ImWchar brand_range[] = { ICON_MIN_FAB, ICON_MAX_FAB, 0 }; io.Fonts->AddFontFromMemoryTTF(const_cast(brand_font.data()), int(brand_font.size()), - 16.0f * Float(framebufferSize().x()) / size.x(), &icon_config, brand_range); + 16.0f * float(framebufferSize().x()) / size.x(), &icon_config, brand_range); auto mono_font = _rs.getRaw("SourceCodePro-Regular.ttf"_s); ImVector range; @@ -98,7 +98,7 @@ SaveTool::initialiseGui() { builder.AddChar(u'Å¡'); // This allows displaying Vladimír VondruÅ¡' name in Corrade's and Magnum's licences. builder.BuildRanges(&range); io.Fonts->AddFontFromMemoryTTF(const_cast(mono_font.data()), int(mono_font.size()), - 18.0f * Float(framebufferSize().x()) / size.x(), &font_config, range.Data); + 18.0f * float(framebufferSize().x()) / size.x(), &font_config, range.Data); _imgui = ImGuiIntegration::Context(*ImGui::GetCurrentContext(), windowSize()); diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index 671763a..ff7a90c 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -31,7 +31,7 @@ void SaveTool::drawManager() { ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); - ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y}, + ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGuiCond_Always); if(!ImGui::Begin("##MainWindow", nullptr, ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove| @@ -210,7 +210,7 @@ SaveTool::drawGeneralInfo() { drawTooltip("This is the last mission selected in the mission selection screen, not the last mission played.", float(windowSize().x()) * 0.35f); - const Float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); + const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); ImGui::Dummy({ImGui::GetContentRegionAvail().x, ImGui::GetContentRegionAvail().y - footer_height_to_reserve}); ImGui::Separator(); @@ -235,7 +235,7 @@ SaveTool::drawGeneralInfo() { ImGui::SameLine(); - static Int credits; + static std::int32_t credits; if(drawUnsafeWidget([]{ return ImGui::Button("Edit credits"); })) { credits = _currentProfile->credits(); ImGui::OpenPopup("int_edit"); @@ -302,22 +302,22 @@ SaveTool::drawResearchInventory() { drawMaterialRow("Verse steel", 1, [this]{ return _currentProfile->verseSteel(); }, - [this](Int amount){ return _currentProfile->setVerseSteel(amount); }); + [this](std::int32_t amount){ return _currentProfile->setVerseSteel(amount); }); drawMaterialRow("Undinium", 2, [this]{ return _currentProfile->undinium(); }, - [this](Int amount){ return _currentProfile->setUndinium(amount); }); + [this](std::int32_t amount){ return _currentProfile->setUndinium(amount); }); drawMaterialRow("Necrium alloy", 3, [this]{ return _currentProfile->necriumAlloy(); }, - [this](Int amount){ return _currentProfile->setNecriumAlloy(amount); }); + [this](std::int32_t amount){ return _currentProfile->setNecriumAlloy(amount); }); drawMaterialRow("Lunarite", 4, [this]{ return _currentProfile->lunarite(); }, - [this](Int amount){ return _currentProfile->setLunarite(amount); }); + [this](std::int32_t amount){ return _currentProfile->setLunarite(amount); }); drawMaterialRow("Asterite", 5, [this]{ return _currentProfile->asterite(); }, - [this](Int amount){ return _currentProfile->setAsterite(amount); }); + [this](std::int32_t amount){ return _currentProfile->setAsterite(amount); }); drawMaterialRow("Hallite fragma", 6, [this]{ return _currentProfile->halliteFragma(); }, - [this](Int amount){ return _currentProfile->setHalliteFragma(amount); }); + [this](std::int32_t amount){ return _currentProfile->setHalliteFragma(amount); }); drawUnavailableMaterialRow("Unnoctinium", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); @@ -326,22 +326,22 @@ SaveTool::drawResearchInventory() { drawMaterialRow("Ednil", 1, [this]{ return _currentProfile->ednil(); }, - [this](Int amount){ return _currentProfile->setEdnil(amount); }); + [this](std::int32_t amount){ return _currentProfile->setEdnil(amount); }); drawMaterialRow("Nuflalt", 2, [this]{ return _currentProfile->nuflalt(); }, - [this](Int amount){ return _currentProfile->setNuflalt(amount); }); + [this](std::int32_t amount){ return _currentProfile->setNuflalt(amount); }); drawMaterialRow("Aurelene", 3, [this]{ return _currentProfile->aurelene(); }, - [this](Int amount){ return _currentProfile->setAurelene(amount); }); + [this](std::int32_t amount){ return _currentProfile->setAurelene(amount); }); drawMaterialRow("Soldus", 4, [this]{ return _currentProfile->soldus(); }, - [this](Int amount){ return _currentProfile->setSoldus(amount); }); + [this](std::int32_t amount){ return _currentProfile->setSoldus(amount); }); drawMaterialRow("Synthesized N", 5, [this]{ return _currentProfile->synthesisedN(); }, - [this](Int amount){ return _currentProfile->setSynthesisedN(amount); }); + [this](std::int32_t amount){ return _currentProfile->setSynthesisedN(amount); }); drawMaterialRow("Nanoc", 6, [this]{ return _currentProfile->nanoc(); }, - [this](Int amount){ return _currentProfile->setNanoc(amount); }); + [this](std::int32_t amount){ return _currentProfile->setNanoc(amount); }); drawUnavailableMaterialRow("Abyssillite", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); @@ -350,22 +350,22 @@ SaveTool::drawResearchInventory() { drawMaterialRow("Alcarbonite", 1, [this]{ return _currentProfile->alcarbonite(); }, - [this](Int amount){ return _currentProfile->setAlcarbonite(amount); }); + [this](std::int32_t amount){ return _currentProfile->setAlcarbonite(amount); }); drawMaterialRow("Keripehene", 2, [this]{ return _currentProfile->keriphene(); }, - [this](Int amount){ return _currentProfile->setKeriphene(amount); }); + [this](std::int32_t amount){ return _currentProfile->setKeriphene(amount); }); drawMaterialRow("Nitinol-CM", 3, [this]{ return _currentProfile->nitinolCM(); }, - [this](Int amount){ return _currentProfile->setNitinolCM(amount); }); + [this](std::int32_t amount){ return _currentProfile->setNitinolCM(amount); }); drawMaterialRow("Quarkium", 4, [this]{ return _currentProfile->quarkium(); }, - [this](Int amount){ return _currentProfile->setQuarkium(amount); }); + [this](std::int32_t amount){ return _currentProfile->setQuarkium(amount); }); drawMaterialRow("Alterene", 5, [this]{ return _currentProfile->alterene(); }, - [this](Int amount){ return _currentProfile->setAlterene(amount); }); + [this](std::int32_t amount){ return _currentProfile->setAlterene(amount); }); drawMaterialRow("Cosmium", 6, [this]{ return _currentProfile->cosmium(); }, - [this](Int amount){ return _currentProfile->setCosmium(amount); }); + [this](std::int32_t amount){ return _currentProfile->setCosmium(amount); }); drawUnavailableMaterialRow("Purified quarkium", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); @@ -374,22 +374,22 @@ SaveTool::drawResearchInventory() { drawMaterialRow("Mixed composition", 1, [this]{ return _currentProfile->mixedComposition(); }, - [this](Int amount){ return _currentProfile->setMixedComposition(amount); }); + [this](std::int32_t amount){ return _currentProfile->setMixedComposition(amount); }); drawMaterialRow("Void residue", 2, [this]{ return _currentProfile->voidResidue(); }, - [this](Int amount){ return _currentProfile->setVoidResidue(amount); }); + [this](std::int32_t amount){ return _currentProfile->setVoidResidue(amount); }); drawMaterialRow("Muscular construction", 3, [this]{ return _currentProfile->muscularConstruction(); }, - [this](Int amount){ return _currentProfile->setMuscularConstruction(amount); }); + [this](std::int32_t amount){ return _currentProfile->setMuscularConstruction(amount); }); drawMaterialRow("Mineral exoskeletology", 4, [this]{ return _currentProfile->mineralExoskeletology(); }, - [this](Int amount){ return _currentProfile->setMineralExoskeletology(amount); }); + [this](std::int32_t amount){ return _currentProfile->setMineralExoskeletology(amount); }); drawMaterialRow("Carbonized skin", 5, [this]{ return _currentProfile->carbonisedSkin(); }, - [this](Int amount){ return _currentProfile->setCarbonisedSkin(amount); }); + [this](std::int32_t amount){ return _currentProfile->setCarbonisedSkin(amount); }); drawMaterialRow("Isolated void particle", 6, [this]{ return _currentProfile->isolatedVoidParticle(); }, - [this](Int amount){ return _currentProfile->setIsolatedVoidParticle(amount); }); + [this](std::int32_t amount){ return _currentProfile->setIsolatedVoidParticle(amount); }); drawUnavailableMaterialRow("Weaponised physiology", 7); ImGui::EndTable(); @@ -398,9 +398,9 @@ SaveTool::drawResearchInventory() { template void -SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter, Setter setter) { - static_assert(std::is_same::value, "getter doesn't return an Int, and/or doesn't take zero arguments."); - static_assert(std::is_same::value, "setter doesn't return a bool, and/or doesn't take a single Int as an argument."); +SaveTool::drawMaterialRow(Containers::StringView name, std::int32_t tier, Getter getter, Setter setter) { + static_assert(std::is_same::value, "getter doesn't return an std::int32_t, and/or doesn't take zero arguments."); + static_assert(std::is_same::value, "setter doesn't return a bool, and/or doesn't take a single std::int32_t as an argument."); ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -413,7 +413,7 @@ SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter, if(conf().cheatMode()) { ImGui::TableSetColumnIndex(3); ImGui::PushID(name.data()); - static Int var = 0; + static std::int32_t var = 0; if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_EDIT)) { (var) = getter(); ImGui::OpenPopup("int_edit"); @@ -433,7 +433,7 @@ SaveTool::drawMaterialRow(Containers::StringView name, Int tier, Getter getter, } void -SaveTool::drawUnavailableMaterialRow(Containers::StringView name, Int tier) { +SaveTool::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/SaveTool/SaveTool_MassViewer.cpp index f1256cf..5ec3f0c 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/SaveTool/SaveTool_MassViewer.cpp @@ -38,7 +38,7 @@ SaveTool::drawMassViewer() { } ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); - ImGui::SetNextWindowSize({Float(windowSize().x()), Float(windowSize().y()) - ImGui::GetItemRectSize().y}, + ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y}, ImGuiCond_Always); if(!ImGui::Begin("##MassViewer", nullptr, ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove| @@ -86,8 +86,8 @@ SaveTool::drawMassViewer() { _jointsDirty = false; _stylesDirty = false; _eyeFlareDirty = false; - _selectedArmourDecals = Containers::StaticArray<38, Int>{ValueInit}; - _selectedArmourAccessories = Containers::StaticArray<38, Int>{ValueInit}; + _selectedArmourDecals = Containers::StaticArray<38, std::int32_t>{ValueInit}; + _selectedArmourAccessories = Containers::StaticArray<38, std::int32_t>{ValueInit}; _selectedBLPlacement = 0; _selectedWeaponPart = 0; _selectedWeaponDecal = 0; @@ -168,7 +168,7 @@ SaveTool::drawGlobalStyles() { ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game."); - for(UnsignedInt i = 0; i < _currentMass->globalStyles().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->globalStyles().size(); i++) { ImGui::PushID(int(i)); DCSResult result; result = drawCustomStyle(_currentMass->globalStyles()[i]); @@ -225,7 +225,7 @@ SaveTool::drawTuning() { ImGui::TableNextColumn(); ImGui::TextUnformatted("Gears"); - for(UnsignedInt i = 0; i < _currentMass->gears().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->gears().size(); i++) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("%i", _currentMass->gears()[i]); @@ -251,7 +251,7 @@ SaveTool::drawTuning() { ImGui::TableNextColumn(); ImGui::TextUnformatted("Modules"); - for(UnsignedInt i = 0; i < _currentMass->modules().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->modules().size(); i++) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("%i", _currentMass->modules()[i]); @@ -277,7 +277,7 @@ SaveTool::drawTuning() { ImGui::TableNextColumn(); ImGui::TextUnformatted("Techs"); - for(UnsignedInt i = 0; i < _currentMass->techs().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->techs().size(); i++) { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::Text("%i", _currentMass->techs()[i]); @@ -515,7 +515,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView size = Containers::NullOpt; if(ImGui::SmallButton("Change")) { ImGui::OpenPopup("##AccessoryPopup"); @@ -539,7 +539,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView view) { +SaveTool::getStyleName(std::int32_t id, Containers::ArrayView view) { if(id >= 0 && id <= 15) { return view[id].name; } diff --git a/src/SaveTool/SaveTool_MassViewer_Armour.cpp b/src/SaveTool/SaveTool_MassViewer_Armour.cpp index 5c21698..76d9459 100644 --- a/src/SaveTool/SaveTool_MassViewer_Armour.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Armour.cpp @@ -43,7 +43,7 @@ SaveTool::drawArmour() { #undef c }; - for(UnsignedInt i = 0; i < _currentMass->armourParts().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->armourParts().size(); i++) { ImGui::PushID(int(i)); auto& part = _currentMass->armourParts()[i]; @@ -53,10 +53,10 @@ SaveTool::drawArmour() { std::memset(header, '\0', 129); if(armour_sets.find(part.id) != armour_sets.cend()) { - std::snprintf(header, 128, "%s: %s###%u", slot_labels[UnsignedInt(part.slot)].data(), armour_sets.at(part.id).name.data(), UnsignedInt(part.slot)); + std::snprintf(header, 128, "%s: %s###%u", slot_labels[std::uint32_t(part.slot)].data(), armour_sets.at(part.id).name.data(), std::uint32_t(part.slot)); } else { - std::snprintf(header, 128, "%s: %i###%u", slot_labels[UnsignedInt(part.slot)].data(), part.id, UnsignedInt(part.slot)); + std::snprintf(header, 128, "%s: %i###%u", slot_labels[std::uint32_t(part.slot)].data(), part.id, std::uint32_t(part.slot)); } if(ImGui::CollapsingHeader(header)) { @@ -64,7 +64,7 @@ SaveTool::drawArmour() { ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.491f); if(ImGui::BeginListBox("##ChangePart")) { - if(std::strncmp("Neck", slot_labels[UnsignedInt(part.slot)].data(), 4) != 0) { + if(std::strncmp("Neck", slot_labels[std::uint32_t(part.slot)].data(), 4) != 0) { for(auto& set : armour_sets) { if(ImGui::Selectable(set.second.name.data(), set.first == part.id, ImGuiSelectableFlags_SpanAvailWidth)) { part.id = set.first; @@ -97,7 +97,7 @@ SaveTool::drawArmour() { ImGui::TextUnformatted("Styles:"); - for(Int j = 0; j < 4; j++) { + for(std::int32_t j = 0; j < 4; j++) { drawAlignedText("Slot %d:", j + 1); ImGui::SameLine(); @@ -125,7 +125,7 @@ SaveTool::drawArmour() { ImGui::PushID("Decal"); drawAlignedText("Showing/editing decal"); - for(UnsignedInt j = 0; j < part.decals.size(); j++) { + for(std::uint32_t j = 0; j < part.decals.size(); j++) { ImGui::SameLine(); ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], int(j)); } @@ -140,7 +140,7 @@ SaveTool::drawArmour() { ImGui::PushID("Accessory"); drawAlignedText("Showing/editing accessory"); - for(UnsignedInt j = 0; j < part.accessories.size(); j++) { + for(std::uint32_t j = 0; j < part.accessories.size(); j++) { ImGui::SameLine(); ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &_selectedArmourAccessories[i], int(j)); } @@ -200,9 +200,9 @@ SaveTool::drawArmour() { drawAlignedText("Socket:"); ImGui::SameLine(); - if(ImGui::BeginCombo("##Socket", socket_labels[UnsignedInt(placement.socket)].data())) { - for(UnsignedInt i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) { - if(ImGui::Selectable(socket_labels[i].data(), i == UnsignedInt(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) { + if(ImGui::BeginCombo("##Socket", socket_labels[std::uint32_t(placement.socket)].data())) { + for(std::uint32_t i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) { + if(ImGui::Selectable(socket_labels[i].data(), i == std::uint32_t(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) { placement.socket = static_cast(i); } } @@ -302,7 +302,7 @@ SaveTool::drawCustomArmourStyles() { ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game."); - for(UnsignedInt i = 0; i < _currentMass->armourCustomStyles().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->armourCustomStyles().size(); i++) { ImGui::PushID(int(i)); DCSResult result; result = drawCustomStyle(_currentMass->armourCustomStyles()[i]); diff --git a/src/SaveTool/SaveTool_MassViewer_Frame.cpp b/src/SaveTool/SaveTool_MassViewer_Frame.cpp index bbcf609..61948b6 100644 --- a/src/SaveTool/SaveTool_MassViewer_Frame.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Frame.cpp @@ -202,7 +202,7 @@ SaveTool::drawFrameStyles() { return; } - for(Int i = 0; i < 4; i++) { + for(std::int32_t i = 0; i < 4; i++) { drawAlignedText("Slot %d:", i + 1); ImGui::SameLine(); @@ -294,7 +294,7 @@ SaveTool::drawCustomFrameStyles() { ImGui::TextWrapped("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game."); - for(UnsignedInt i = 0; i < _currentMass->frameCustomStyles().size(); i++) { + for(std::uint32_t i = 0; i < _currentMass->frameCustomStyles().size(); i++) { ImGui::PushID(int(i)); DCSResult result; result = drawCustomStyle(_currentMass->frameCustomStyles()[i]); diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp index 2bbcd3a..7e48de1 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp @@ -28,7 +28,7 @@ SaveTool::drawWeapons() { return; } - const Float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); + const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); ImGui::BeginGroup(); @@ -265,7 +265,7 @@ SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView< ImGui::PushID(payload_type.data()); - for(UnsignedInt i = 0; i < weapons_view.size(); i++) { + for(std::uint32_t i = 0; i < weapons_view.size(); i++) { auto& weapon = weapons_view[i]; ImGui::TableNextRow(); @@ -277,7 +277,7 @@ SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView< _currentWeapon = &weapon; } if(ImGui::BeginDragDropSource()) { - ImGui::SetDragDropPayload(payload_type.data(), &i, sizeof(UnsignedInt)); + ImGui::SetDragDropPayload(payload_type.data(), &i, sizeof(std::uint32_t)); if(ImGui::GetIO().KeyCtrl) { ImGui::Text("%s %i - %s (copy)", payload_tooltip.data(), i + 1, weapon.name.data()); } @@ -331,7 +331,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { #undef c }; - drawAlignedText("%s: %s", labels[UnsignedInt(weapon.type)].data(), weapon.name.data()); + drawAlignedText("%s: %s", labels[std::uint32_t(weapon.type)].data(), weapon.name.data()); ImGui::SameLine(); @@ -428,8 +428,8 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { if(ImGui::CollapsingHeader("Weapon parts")) { drawAlignedText("Viewing/editing part:"); - for(Int i = 0; UnsignedLong(i) < weapon.parts.size(); i++) { - if(UnsignedLong(_selectedWeaponPart) >= weapon.parts.size()) { + for(std::int32_t i = 0; std::size_t(i) < weapon.parts.size(); i++) { + if(std::size_t(_selectedWeaponPart) >= weapon.parts.size()) { _selectedWeaponPart = 0; } ImGui::SameLine(); @@ -438,7 +438,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { auto& part = weapon.parts[_selectedWeaponPart]; - const auto* map = [this, &weapon]()-> const std::map* { + const auto* map = [this, &weapon]()-> const std::map* { switch(weapon.type) { case WeaponType::Melee: return _selectedWeaponPart == 0 ? &melee_grips : &melee_assaulters; @@ -511,7 +511,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { if(ImGui::BeginChild("##PartDetails", {0.0f, 0.0f}, true)) { ImGui::TextUnformatted("Styles:"); - for(Int i = 0; i < 4; i++) { + for(std::int32_t i = 0; i < 4; i++) { drawAlignedText("Slot %d:", i + 1); ImGui::SameLine(); @@ -537,7 +537,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::PushID("Decal"); drawAlignedText("Showing/editing decal"); - for(UnsignedLong i = 0; i < part.decals.size(); i++) { + for(std::size_t i = 0; i < part.decals.size(); i++) { ImGui::SameLine(); ImGui::RadioButton(std::to_string(i + 1).c_str(), &_selectedWeaponDecal, int(i)); } @@ -552,7 +552,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::PushID("Accessory"); drawAlignedText("Showing/editing accessory"); - for(UnsignedLong i = 0; i < part.accessories.size(); i++) { + for(std::size_t i = 0; i < part.accessories.size(); i++) { ImGui::SameLine(); ImGui::RadioButton(std::string{char(65 + i)}.c_str(), &_selectedWeaponAccessory, int(i)); } diff --git a/src/SaveTool/SaveTool_UpdateChecker.cpp b/src/SaveTool/SaveTool_UpdateChecker.cpp index 0716744..dc42443 100644 --- a/src/SaveTool/SaveTool_UpdateChecker.cpp +++ b/src/SaveTool/SaveTool_UpdateChecker.cpp @@ -73,10 +73,10 @@ SaveTool::updateCheckEvent(SDL_Event& event) { prerelease = true; } } - Int fullVersion; - Int major = 0; - Int minor = 0; - Int patch = 0; + std::int32_t fullVersion; + std::int32_t major = 0; + std::int32_t minor = 0; + std::int32_t patch = 0; bool prerelease = false; bool operator==(const Version& other) const { @@ -161,7 +161,7 @@ SaveTool::checkForUpdates() { if(code == CURLE_OK) { long status = 0; curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); - event.user.code = Int(status); + event.user.code = std::int32_t(status); event.user.data1 = response_body.release(); } else if(code == CURLE_OPERATION_TIMEDOUT) { diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/SaveTool/SaveTool_drawMainMenu.cpp index 400c608..b204087 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/SaveTool/SaveTool_drawMainMenu.cpp @@ -113,7 +113,7 @@ SaveTool::drawMainMenu() { ImGui::SameLine(); ImGui::AlignTextToFramePadding(); drawHelpMarker("This gives access to save edition features that can be considered cheats.", - Float(windowSize().x()) * 0.4f); + float(windowSize().x()) * 0.4f); if(drawCheckbox("Advanced mode", conf().advancedMode())) { conf().setAdvancedMode(!conf().advancedMode()); @@ -121,7 +121,7 @@ SaveTool::drawMainMenu() { ImGui::SameLine(); ImGui::AlignTextToFramePadding(); drawHelpMarker("This gives access to editing values that have unknown purposes or are undocumented.", - Float(windowSize().x()) * 0.4f); + float(windowSize().x()) * 0.4f); if(drawCheckbox("Check for updates on startup", conf().checkUpdatesOnStartup())) { conf().setCheckUpdatesOnStartup(!conf().checkUpdatesOnStartup()); diff --git a/src/ToastQueue/ToastQueue.cpp b/src/ToastQueue/ToastQueue.cpp index df92ec8..0459c97 100644 --- a/src/ToastQueue/ToastQueue.cpp +++ b/src/ToastQueue/ToastQueue.cpp @@ -26,15 +26,15 @@ using namespace Containers::Literals; -constexpr UnsignedInt success_colour = 0xff67d23bu; -constexpr UnsignedInt info_colour = 0xffcc832fu; -constexpr UnsignedInt warning_colour = 0xff2fcfc7u; -constexpr UnsignedInt error_colour = 0xff3134cdu; +constexpr std::uint32_t success_colour = 0xff67d23bu; +constexpr std::uint32_t info_colour = 0xffcc832fu; +constexpr std::uint32_t warning_colour = 0xff2fcfc7u; +constexpr std::uint32_t error_colour = 0xff3134cdu; -constexpr UnsignedInt fade_time = 150; -constexpr Float base_opacity = 1.0f; +constexpr std::uint32_t fade_time = 150; +constexpr float base_opacity = 1.0f; constexpr Vector2 padding{20.0f, 20.0f}; -constexpr Float toast_spacing = 10.0f; +constexpr float toast_spacing = 10.0f; Toast::Toast(Type type, Containers::StringView message, std::chrono::milliseconds timeout): _type{type}, @@ -42,7 +42,7 @@ Toast::Toast(Type type, Containers::StringView message, std::chrono::millisecond _timeout{timeout}, _creationTime{std::chrono::steady_clock::now()} { - _phaseTrack = Animation::Track{{ + _phaseTrack = Animation::Track{{ {0, Phase::FadeIn}, {fade_time, Phase::Wait}, {fade_time + timeout.count(), Phase::FadeOut}, @@ -80,16 +80,16 @@ Toast::phase() { return _phaseTrack.at(elapsedTime().count()); } -Float +float Toast::opacity() { Phase phase = this->phase(); - Long elapsed_time = elapsedTime().count(); + std::int64_t elapsed_time = elapsedTime().count(); if(phase == Phase::FadeIn) { - return Float(elapsed_time) / Float(fade_time); + return float(elapsed_time) / float(fade_time); } else if(phase == Phase::FadeOut) { - return 1.0f - ((Float(elapsed_time) - Float(fade_time) - Float(_timeout.count())) / Float(fade_time)); + return 1.0f - ((float(elapsed_time) - float(fade_time) - float(_timeout.count())) / float(fade_time)); } return 1.0f; @@ -107,9 +107,9 @@ ToastQueue::addToast(Toast::Type type, Containers::StringView message, std::chro void ToastQueue::draw(Vector2i viewport_size) { - Float height = 0.0f; + float height = 0.0f; - for(UnsignedInt i = 0; i < _toasts.size(); i++) { + for(std::uint32_t i = 0; i < _toasts.size(); i++) { Toast* current = &_toasts[i]; if(current->phase() == Toast::Phase::TimedOut) { @@ -119,11 +119,12 @@ ToastQueue::draw(Vector2i viewport_size) { Containers::String win_id = Utility::format("##Toast{}", i); - Float opacity = base_opacity * current->opacity(); + float opacity = base_opacity * current->opacity(); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, opacity); - ImGui::SetNextWindowPos({viewport_size.x() - padding.x(), viewport_size.y() - padding.y() - height}, ImGuiCond_Always, {1.0f, 1.0f}); + ImGui::SetNextWindowPos({float(viewport_size.x()) - padding.x(), float(viewport_size.y()) - padding.y() - height}, + ImGuiCond_Always, {1.0f, 1.0f}); if(ImGui::Begin(win_id.data(), nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoDecoration| ImGuiWindowFlags_NoInputs|ImGuiWindowFlags_NoNav|ImGuiWindowFlags_NoFocusOnAppearing)) @@ -168,6 +169,6 @@ ToastQueue::draw(Vector2i viewport_size) { } void -ToastQueue::removeToast(Long index) { +ToastQueue::removeToast(std::int64_t index) { _toasts.erase(_toasts.begin() + index); } diff --git a/src/ToastQueue/ToastQueue.h b/src/ToastQueue/ToastQueue.h index 5c5365e..b141662 100644 --- a/src/ToastQueue/ToastQueue.h +++ b/src/ToastQueue/ToastQueue.h @@ -29,11 +29,11 @@ using namespace Magnum; class Toast { public: - enum class Type : UnsignedByte { + enum class Type: std::uint8_t { Default, Success, Info, Warning, Error }; - enum class Phase : UnsignedByte { + enum class Phase: std::uint8_t { FadeIn, Wait, FadeOut, TimedOut }; @@ -58,14 +58,14 @@ class Toast { Phase phase(); - Float opacity(); + float opacity(); private: Type _type{Type::Default}; Containers::String _message; std::chrono::milliseconds _timeout; std::chrono::steady_clock::time_point _creationTime; - Animation::Track _phaseTrack; + Animation::Track _phaseTrack; }; class ToastQueue { @@ -78,7 +78,7 @@ class ToastQueue { void draw(Vector2i viewport_size); private: - void removeToast(Long index); + void removeToast(std::int64_t index); std::vector _toasts; }; diff --git a/src/UESaveFile/BinaryReader.cpp b/src/UESaveFile/BinaryReader.cpp index c0ae9b2..6610ec2 100644 --- a/src/UESaveFile/BinaryReader.cpp +++ b/src/UESaveFile/BinaryReader.cpp @@ -45,13 +45,13 @@ BinaryReader::eof() { return std::feof(_file) != 0; } -Long +std::int64_t BinaryReader::position() { return _ftelli64(_file); } bool -BinaryReader::seek(Long position) { +BinaryReader::seek(std::int64_t position) { return _fseeki64(_file, position, SEEK_SET) == 0; } @@ -67,53 +67,53 @@ BinaryReader::readChar(char& value) { } bool -BinaryReader::readByte(Byte& value) { - return std::fread(&value, sizeof(Byte), 1, _file) == 1; +BinaryReader::readInt8(std::int8_t& value) { + return std::fread(&value, sizeof(std::int8_t), 1, _file) == 1; } bool -BinaryReader::readUnsignedByte(UnsignedByte& value) { - return std::fread(&value, sizeof(UnsignedByte), 1, _file) == 1; +BinaryReader::readUint8(std::uint8_t& value) { + return std::fread(&value, sizeof(std::uint8_t), 1, _file) == 1; } bool -BinaryReader::readShort(Short& value) { - return std::fread(&value, sizeof(Short), 1, _file) == 1; +BinaryReader::readInt16(std::int16_t& value) { + return std::fread(&value, sizeof(std::int16_t), 1, _file) == 1; } bool -BinaryReader::readUnsignedShort(UnsignedShort& value) { - return std::fread(&value, sizeof(UnsignedShort), 1, _file) == 1; +BinaryReader::readUint16(std::uint16_t& value) { + return std::fread(&value, sizeof(std::uint16_t), 1, _file) == 1; } bool -BinaryReader::readInt(Int& value) { - return std::fread(&value, sizeof(Int), 1, _file) == 1; +BinaryReader::readInt32(std::int32_t& value) { + return std::fread(&value, sizeof(std::int32_t), 1, _file) == 1; } bool -BinaryReader::readUnsignedInt(UnsignedInt& value) { - return std::fread(&value, sizeof(UnsignedInt), 1, _file) == 1; +BinaryReader::readUint32(std::uint32_t& value) { + return std::fread(&value, sizeof(std::uint32_t), 1, _file) == 1; } bool -BinaryReader::readLong(Long& value) { - return std::fread(&value, sizeof(Long), 1, _file) == 1; +BinaryReader::readInt64(std::int64_t& value) { + return std::fread(&value, sizeof(std::int64_t), 1, _file) == 1; } bool -BinaryReader::readUnsignedLong(UnsignedLong& value) { - return std::fread(&value, sizeof(UnsignedLong), 1, _file) == 1; +BinaryReader::readUint64(std::uint64_t& value) { + return std::fread(&value, sizeof(std::uint64_t), 1, _file) == 1; } bool -BinaryReader::readFloat(Float& value) { - return std::fread(&value, sizeof(Float), 1, _file) == 1; +BinaryReader::readFloat(float& value) { + return std::fread(&value, sizeof(float), 1, _file) == 1; } bool -BinaryReader::readDouble(Double& value) { - return std::fread(&value, sizeof(Double), 1, _file) == 1; +BinaryReader::readDouble(double& value) { + return std::fread(&value, sizeof(double), 1, _file) == 1; } bool @@ -127,8 +127,8 @@ BinaryReader::readArray(Containers::Array& array, std::size_t count) { bool BinaryReader::readUEString(Containers::String& str) { - UnsignedInt length = 0; - if(!readUnsignedInt(length) || length == 0) { + std::uint32_t length = 0; + if(!readUint32(length) || length == 0) { return false; } @@ -137,9 +137,9 @@ BinaryReader::readUEString(Containers::String& str) { return std::fread(str.data(), sizeof(char), length, _file) == length; } -Int +std::int32_t BinaryReader::peekChar() { - Int c; + std::int32_t c; c = std::fgetc(_file); std::ungetc(c, _file); return c; diff --git a/src/UESaveFile/BinaryReader.h b/src/UESaveFile/BinaryReader.h index e945938..46915f4 100644 --- a/src/UESaveFile/BinaryReader.h +++ b/src/UESaveFile/BinaryReader.h @@ -16,16 +16,14 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include #include #include #include #include -#include - using namespace Corrade; -using namespace Magnum; class BinaryReader { public: @@ -34,23 +32,23 @@ class BinaryReader { bool open(); bool eof(); - Long position(); + std::int64_t position(); - bool seek(Long position); + bool seek(std::int64_t position); void closeFile(); bool readChar(char& value); - bool readByte(Byte& value); - bool readUnsignedByte(UnsignedByte& value); - bool readShort(Short& value); - bool readUnsignedShort(UnsignedShort& value); - bool readInt(Int& value); - bool readUnsignedInt(UnsignedInt& value); - bool readLong(Long& value); - bool readUnsignedLong(UnsignedLong& value); - bool readFloat(Float& value); - bool readDouble(Double& value); + bool readInt8(std::int8_t& value); + bool readUint8(std::uint8_t& value); + bool readInt16(std::int16_t& value); + bool readUint16(std::uint16_t& value); + bool readInt32(std::int32_t& value); + bool readUint32(std::uint32_t& value); + bool readInt64(std::int64_t& value); + bool readUint64(std::uint64_t& value); + bool readFloat(float& value); + bool readDouble(double& value); bool readArray(Containers::Array& array, std::size_t count); template @@ -65,7 +63,7 @@ class BinaryReader { bool readUEString(Containers::String& str); - Int peekChar(); + std::int32_t peekChar(); private: std::FILE* _file = nullptr; diff --git a/src/UESaveFile/BinaryWriter.cpp b/src/UESaveFile/BinaryWriter.cpp index a5a2e15..ce55642 100644 --- a/src/UESaveFile/BinaryWriter.cpp +++ b/src/UESaveFile/BinaryWriter.cpp @@ -45,7 +45,7 @@ BinaryWriter::closeFile() { _file = nullptr; } -Long +std::int64_t BinaryWriter::position() { return _ftelli64(_file); } @@ -55,7 +55,7 @@ BinaryWriter::array() const { return _data; } -UnsignedLong +std::size_t BinaryWriter::arrayPosition() const { return _index; } @@ -75,53 +75,53 @@ BinaryWriter::writeChar(char value) { } bool -BinaryWriter::writeByte(Byte value) { - return std::fwrite(&value, sizeof(Byte), 1, _file) == 1; +BinaryWriter::writeInt8(std::int8_t value) { + return std::fwrite(&value, sizeof(std::int8_t), 1, _file) == 1; } bool -BinaryWriter::writeUnsignedByte(UnsignedByte value) { - return std::fwrite(&value, sizeof(UnsignedByte), 1, _file) == 1; +BinaryWriter::writeUint8(std::uint8_t value) { + return std::fwrite(&value, sizeof(std::uint8_t), 1, _file) == 1; } bool -BinaryWriter::writeShort(Short value) { - return std::fwrite(&value, sizeof(Short), 1, _file) == 1; +BinaryWriter::writeInt16(std::int16_t value) { + return std::fwrite(&value, sizeof(std::int16_t), 1, _file) == 1; } bool -BinaryWriter::writeUnsignedShort(UnsignedShort value) { - return std::fwrite(&value, sizeof(UnsignedShort), 1, _file) == 1; +BinaryWriter::writeUint16(std::uint16_t value) { + return std::fwrite(&value, sizeof(std::uint16_t), 1, _file) == 1; } bool -BinaryWriter::writeInt(Int value) { - return std::fwrite(&value, sizeof(Int), 1, _file) == 1; +BinaryWriter::writeInt32(std::int32_t value) { + return std::fwrite(&value, sizeof(std::int32_t), 1, _file) == 1; } bool -BinaryWriter::writeUnsignedInt(UnsignedInt value) { - return std::fwrite(&value, sizeof(UnsignedInt), 1, _file) == 1; +BinaryWriter::writeUint32(std::uint32_t value) { + return std::fwrite(&value, sizeof(std::uint32_t), 1, _file) == 1; } bool -BinaryWriter::writeLong(Long value) { - return std::fwrite(&value, sizeof(Long), 1, _file) == 1; +BinaryWriter::writeInt64(std::int64_t value) { + return std::fwrite(&value, sizeof(std::int64_t), 1, _file) == 1; } bool -BinaryWriter::writeUnsignedLong(UnsignedLong value) { - return std::fwrite(&value, sizeof(UnsignedLong), 1, _file) == 1; +BinaryWriter::writeUint64(std::uint64_t value) { + return std::fwrite(&value, sizeof(std::uint64_t), 1, _file) == 1; } bool -BinaryWriter::writeFloat(Float value) { - return std::fwrite(&value, sizeof(Float), 1, _file) == 1; +BinaryWriter::writeFloat(float value) { + return std::fwrite(&value, sizeof(float), 1, _file) == 1; } bool -BinaryWriter::writeDouble(Double value) { - return std::fwrite(&value, sizeof(Double), 1, _file) == 1; +BinaryWriter::writeDouble(double value) { + return std::fwrite(&value, sizeof(double), 1, _file) == 1; } bool @@ -140,7 +140,7 @@ BinaryWriter::writeUEString(Containers::StringView str) { return false; } - writeUnsignedInt(static_cast(str.size()) + 1); + writeUint32(static_cast(str.size()) + 1); if(str.size() > 0) { std::size_t count = std::fwrite(str.data(), sizeof(char), str.size(), _file); @@ -151,9 +151,9 @@ BinaryWriter::writeUEString(Containers::StringView str) { return writeChar('\0'); } -UnsignedLong +std::size_t BinaryWriter::writeUEStringToArray(Containers::StringView value) { - return writeValueToArray(UnsignedInt(value.size()) + 1u) + + return writeValueToArray(std::uint32_t(value.size()) + 1u) + writeDataToArray(Containers::ArrayView{value}) + writeValueToArray('\0'); } diff --git a/src/UESaveFile/BinaryWriter.h b/src/UESaveFile/BinaryWriter.h index 4921f1e..a479c69 100644 --- a/src/UESaveFile/BinaryWriter.h +++ b/src/UESaveFile/BinaryWriter.h @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include #include #include @@ -23,10 +24,7 @@ #include #include -#include - using namespace Corrade; -using namespace Magnum; class BinaryWriter { public: @@ -43,23 +41,23 @@ class BinaryWriter { void closeFile(); - Long position(); + std::int64_t position(); Containers::ArrayView array() const; - UnsignedLong arrayPosition() const; + std::size_t arrayPosition() const; bool flushToFile(); - bool writeByte(Byte value); bool writeChar(char value); - bool writeUnsignedByte(UnsignedByte value); - bool writeShort(Short value); - bool writeUnsignedShort(UnsignedShort value); - bool writeInt(Int value); - bool writeUnsignedInt(UnsignedInt value); - bool writeLong(Long value); - bool writeUnsignedLong(UnsignedLong value); - bool writeFloat(Float value); - bool writeDouble(Double value); + bool writeInt8(std::int8_t value); + bool writeUint8(std::uint8_t value); + bool writeInt16(std::int16_t value); + bool writeUint16(std::uint16_t value); + bool writeInt32(std::int32_t value); + bool writeUint32(std::uint32_t value); + bool writeInt64(std::int64_t value); + bool writeUint64(std::uint64_t value); + bool writeFloat(float value); + bool writeDouble(double value); bool writeArray(Containers::ArrayView array); template bool writeString(const char(&str)[size]) { @@ -74,30 +72,30 @@ class BinaryWriter { bool writeUEString(Containers::StringView str); template::value, T, T&>> - UnsignedLong writeValueToArray(U value) { + std::size_t writeValueToArray(U value) { Containers::ArrayView view{&value, 1}; return writeDataToArray(view); } - UnsignedLong writeUEStringToArray(Containers::StringView value); + std::size_t writeUEStringToArray(Containers::StringView value); template - void writeValueToArrayAt(T& value, UnsignedLong position) { + void writeValueToArrayAt(T& value, std::size_t position) { Containers::ArrayView view{&value, 1}; writeDataToArrayAt(view, position); } template - UnsignedLong writeDataToArray(Containers::ArrayView view) { + std::size_t writeDataToArray(Containers::ArrayView view) { arrayAppend(_data, Containers::arrayCast(view)); _index += sizeof(T) * view.size(); return sizeof(T) * view.size(); } template - void writeDataToArrayAt(Containers::ArrayView view, UnsignedLong position) { + void writeDataToArrayAt(Containers::ArrayView view, std::size_t position) { auto casted_view = Containers::arrayCast(view); - for(UnsignedLong i = 0; i < casted_view.size(); i++) { + for(std::size_t i = 0; i < casted_view.size(); i++) { _data[position + i] = casted_view[i]; } } @@ -106,5 +104,5 @@ class BinaryWriter { FILE* _file = nullptr; Containers::Array _data; - UnsignedLong _index = 0; + std::size_t _index = 0; }; diff --git a/src/UESaveFile/PropertySerialiser.cpp b/src/UESaveFile/PropertySerialiser.cpp index 775189f..41e3d47 100644 --- a/src/UESaveFile/PropertySerialiser.cpp +++ b/src/UESaveFile/PropertySerialiser.cpp @@ -93,8 +93,8 @@ PropertySerialiser::read(BinaryReader& reader) { return nullptr; } - UnsignedLong value_length; - if(!reader.readUnsignedLong(value_length)) { + std::size_t value_length; + if(!reader.readUint64(value_length)) { return nullptr; } @@ -102,7 +102,7 @@ PropertySerialiser::read(BinaryReader& reader) { } UnrealPropertyBase::ptr -PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length, +PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, Containers::String name) { if(reader.peekChar() < 0 || reader.eof()) { @@ -113,7 +113,7 @@ PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, Unsi } Containers::Array -PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, UnsignedInt count) { +PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; } @@ -133,8 +133,8 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty return nullptr; } - UnsignedLong value_length; - if(!reader.readUnsignedLong(value_length)) { + std::size_t value_length; + if(!reader.readUint64(value_length)) { return nullptr; } @@ -147,8 +147,8 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty } } else { - for(UnsignedInt i = 0; i < count; i++) { - auto item = readItem(reader, item_type, UnsignedLong(-1), ""); + for(std::uint32_t i = 0; i < count; i++) { + auto item = readItem(reader, item_type, std::size_t(-1), ""); arrayAppend(array, std::move(item)); } } @@ -157,7 +157,7 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty } UnrealPropertyBase::ptr -PropertySerialiser::deserialise(Containers::String name, Containers::String type, UnsignedLong value_length, +PropertySerialiser::deserialise(Containers::String name, Containers::String type, std::size_t value_length, BinaryReader& reader) { UnrealPropertyBase::ptr prop; @@ -181,7 +181,7 @@ PropertySerialiser::deserialise(Containers::String name, Containers::String type } bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer) + std::size_t& bytes_written, BinaryWriter& writer) { auto serialiser = getSerialiser(item_type); if(!serialiser) { @@ -191,7 +191,7 @@ bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::St } bool -PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer) { +PropertySerialiser::write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); return true; @@ -200,10 +200,10 @@ PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_wri bytes_written += writer.writeUEStringToArray(*prop->name); bytes_written += writer.writeUEStringToArray(prop->propertyType); - UnsignedLong value_length = 0; - UnsignedLong vl_position = writer.arrayPosition(); + std::size_t value_length = 0; + std::size_t vl_position = writer.arrayPosition(); - bytes_written += writer.writeValueToArray(value_length); + bytes_written += writer.writeValueToArray(value_length); bool ret = serialise(prop, prop->propertyType, value_length, writer); @@ -216,7 +216,7 @@ PropertySerialiser::write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_wri bool PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer) + std::size_t& bytes_written, BinaryWriter& writer) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); @@ -227,7 +227,7 @@ PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringV } bool PropertySerialiser::writeSet(Containers::ArrayView props, - Containers::StringView item_type, UnsignedLong& bytes_written, BinaryWriter& writer) + Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer) { auto serialiser = getCollectionSerialiser(item_type); if(serialiser) { diff --git a/src/UESaveFile/PropertySerialiser.h b/src/UESaveFile/PropertySerialiser.h index 579e527..b726a2d 100644 --- a/src/UESaveFile/PropertySerialiser.h +++ b/src/UESaveFile/PropertySerialiser.h @@ -35,20 +35,20 @@ class PropertySerialiser { static PropertySerialiser& instance(); UnrealPropertyBase::ptr read(BinaryReader& reader); - UnrealPropertyBase::ptr readItem(BinaryReader& reader, Containers::String type, UnsignedLong value_length, + UnrealPropertyBase::ptr readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, Containers::String name); Containers::Array readSet(BinaryReader& reader, Containers::StringView item_type, - UnsignedInt count); - UnrealPropertyBase::ptr deserialise(Containers::String name, Containers::String type, UnsignedLong value_length, + std::uint32_t count); + UnrealPropertyBase::ptr deserialise(Containers::String name, Containers::String type, std::size_t value_length, BinaryReader& reader); - bool serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written, + bool serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer); - bool write(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer); - bool writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, UnsignedLong& bytes_written, + bool write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer); + bool writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer); bool writeSet(Containers::ArrayView props, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer); + std::size_t& bytes_written, BinaryWriter& writer); private: PropertySerialiser(); diff --git a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h index a798222..61dd1c9 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h @@ -21,12 +21,9 @@ #include #include -#include - #include "../Types/UnrealPropertyBase.h" using namespace Corrade; -using namespace Magnum; class BinaryReader; class BinaryWriter; @@ -44,9 +41,9 @@ class AbstractUnrealCollectionPropertySerialiser { virtual StringArrayView types() = 0; virtual PropertyArray deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, UnsignedInt count, BinaryReader& reader, + std::size_t value_length, std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) = 0; - virtual auto serialise(Containers::ArrayView props, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) -> bool = 0; + virtual bool serialise(Containers::ArrayView props, Containers::StringView item_type, + std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; }; diff --git a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h index cd68b5e..bf6dac4 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h @@ -20,12 +20,9 @@ #include #include -#include - #include "../Types/UnrealPropertyBase.h" using namespace Corrade; -using namespace Magnum; class BinaryReader; class BinaryWriter; @@ -42,9 +39,9 @@ class AbstractUnrealPropertySerialiser { virtual StringArrayView types() = 0; virtual UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) = 0; - virtual bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + virtual bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; }; diff --git a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h index c7e9827..3db3909 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h @@ -21,12 +21,9 @@ #include #include -#include - #include "../Types/UnrealPropertyBase.h" using namespace Corrade; -using namespace Magnum; class BinaryReader; class BinaryWriter; @@ -41,6 +38,5 @@ class AbstractUnrealStructSerialiser { virtual UnrealPropertyBase::ptr deserialise(BinaryReader& reader) = 0; - virtual bool serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, - UnsignedLong& bytes_written) = 0; + virtual bool serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, std::size_t& bytes_written) = 0; }; diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp index 1b06824..b106d28 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp @@ -25,7 +25,7 @@ UnrealPropertyBase::ptr ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; @@ -40,8 +40,8 @@ ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Contai return nullptr; } - UnsignedInt item_count; - if(!reader.readUnsignedInt(item_count)) { + std::uint32_t item_count; + if(!reader.readUint32(item_count)) { LOG_ERROR_FORMAT("Couldn't read array property {}'s item count.", name); return nullptr; } @@ -54,7 +54,7 @@ ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Contai } bool -ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto array_prop = dynamic_cast(prop.get()); @@ -65,10 +65,10 @@ ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsign writer.writeUEStringToArray(array_prop->itemType); writer.writeValueToArray('\0'); - bytes_written += writer.writeValueToArray(UnsignedInt(array_prop->items.size())); + bytes_written += writer.writeValueToArray(std::uint32_t(array_prop->items.size())); - UnsignedLong start_pos = writer.arrayPosition(); - UnsignedLong dummy_bytes_written = 0; + std::size_t start_pos = writer.arrayPosition(); + std::size_t dummy_bytes_written = 0; bool ret = serialiser.writeSet(array_prop->items, array_prop->itemType, dummy_bytes_written, writer); bytes_written += writer.arrayPosition() - start_pos; diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h index 7d7eef1..7480ff5 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h @@ -18,14 +18,11 @@ #include -#include - #include "UnrealPropertySerialiser.h" #include "../Types/ArrayProperty.h" using namespace Corrade; -using namespace Magnum; class ArrayPropertySerialiser : public UnrealPropertySerialiser { public: @@ -33,8 +30,8 @@ class ArrayPropertySerialiser : public UnrealPropertySerialiser { private: UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp b/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp index b4b689b..b2cbfcb 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp @@ -28,7 +28,7 @@ BoolPropertySerialiser::types() { } UnrealPropertyBase::ptr -BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, +BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { if(value_length != 0) { @@ -36,8 +36,8 @@ BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::Str return nullptr; } - Short value; - if(!reader.readShort(value)) { + std::int16_t value; + if(!reader.readInt16(value)) { LOG_ERROR_FORMAT("Couldn't read bool property {}'s value.", name); return nullptr; } @@ -54,7 +54,7 @@ BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::Str } bool -BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, +BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto bool_prop = dynamic_cast(prop.get()); @@ -63,7 +63,7 @@ BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& b return false; } - writer.writeValueToArray(Short(bool_prop->value)); + writer.writeValueToArray(std::int16_t(bool_prop->value)); return true; } diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h b/src/UESaveFile/Serialisers/BoolPropertySerialiser.h index 2507313..163cf9d 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/BoolPropertySerialiser.h @@ -32,9 +32,9 @@ class BoolPropertySerialiser : public AbstractUnrealPropertySerialiser { StringArrayView types() override; UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp index fed7309..a5a1f94 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp @@ -28,12 +28,12 @@ BytePropertySerialiser::types() { } UnrealPropertyBase::ptr -BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, +BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); - if(value_length != UnsignedLong(-1)) { + if(value_length != std::size_t(-1)) { if(!reader.readUEString(prop->enumType)) { LOG_ERROR_FORMAT("Couldn't read byte property {}'s enum type.", name); return nullptr; @@ -53,8 +53,8 @@ BytePropertySerialiser::deserialise(Containers::StringView name, Containers::Str prop->valueLength = value_length; - //UnsignedInt count = 0; - //if(!reader.readUnsignedInt(count)) { + //std::uint32_t count = 0; + //if(!reader.readstd::uint32_t(count)) { // return nullptr; //} @@ -66,7 +66,7 @@ BytePropertySerialiser::deserialise(Containers::StringView name, Containers::Str } bool -BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, +BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto byte_prop = dynamic_cast(prop.get()); @@ -76,10 +76,10 @@ BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& b } //writer.writeValueToArray('\0'); - //bytes_written += writer.writeValueToArray(byte_prop->value.size()); + //bytes_written += writer.writeValueToArray(byte_prop->value.size()); //bytes_written += writer.writeDataToArray(byte_prop->value); - if(byte_prop->valueLength != UnsignedLong(-1)) { + if(byte_prop->valueLength != std::size_t(-1)) { writer.writeUEStringToArray(byte_prop->enumType); writer.writeValueToArray('\0'); } diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.h b/src/UESaveFile/Serialisers/BytePropertySerialiser.h index 4e1ff71..b8775ad 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.h @@ -30,9 +30,9 @@ class BytePropertySerialiser : public AbstractUnrealPropertySerialiser { StringArrayView types() override; UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp b/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp index 4972cd7..df0000d 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp @@ -22,7 +22,7 @@ UnrealPropertyBase::ptr ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -38,7 +38,7 @@ ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Conta } bool -ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto colour_prop = dynamic_cast(prop.get()); @@ -47,10 +47,10 @@ ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsig return false; } - bytes_written += writer.writeValueToArray(colour_prop->r) + - writer.writeValueToArray(colour_prop->g) + - writer.writeValueToArray(colour_prop->b) + - writer.writeValueToArray(colour_prop->a); + bytes_written += writer.writeValueToArray(colour_prop->r) + + writer.writeValueToArray(colour_prop->g) + + writer.writeValueToArray(colour_prop->b) + + writer.writeValueToArray(colour_prop->a); return true; } diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h b/src/UESaveFile/Serialisers/ColourPropertySerialiser.h index f137eee..4cc375b 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ColourPropertySerialiser.h @@ -30,8 +30,8 @@ class ColourPropertySerialiser : public UnrealPropertySerialiser(); - if(!reader.readUnsignedLong(prop->timestamp)) { + if(!reader.readInt64(prop->timestamp)) { LOG_ERROR_FORMAT("Couldn't read date/time property {}'s value.", name); return nullptr; } @@ -36,7 +36,7 @@ DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Con } bool -DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto dt_prop = dynamic_cast(prop.get()); @@ -45,7 +45,7 @@ DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Uns return false; } - bytes_written += writer.writeValueToArray(dt_prop->timestamp); + bytes_written += writer.writeValueToArray(dt_prop->timestamp); return true; } diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h index 78e3bfd..54e71b4 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h @@ -28,8 +28,8 @@ class DateTimePropertySerialiser : public UnrealPropertySerialiser(); @@ -53,7 +53,7 @@ EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::Str } bool -EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, +EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto enum_prop = dynamic_cast(prop.get()); diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h b/src/UESaveFile/Serialisers/EnumPropertySerialiser.h index c2874a3..67a6ab8 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/EnumPropertySerialiser.h @@ -30,9 +30,9 @@ class EnumPropertySerialiser : public AbstractUnrealPropertySerialiser { StringArrayView types() override; UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp b/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp index 0d229d9..5d2a2cf 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp @@ -29,7 +29,7 @@ FloatPropertySerialiser::types() { UnrealPropertyBase::ptr FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, PropertySerialiser& serialiser) + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -48,7 +48,7 @@ FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::St } bool -FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, +FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto float_prop = dynamic_cast(prop.get()); @@ -58,7 +58,7 @@ FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& } writer.writeValueToArray('\0'); - bytes_written += writer.writeValueToArray(float_prop->value); + bytes_written += writer.writeValueToArray(float_prop->value); return true; } diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h b/src/UESaveFile/Serialisers/FloatPropertySerialiser.h index 9ec5741..d1dea25 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/FloatPropertySerialiser.h @@ -30,9 +30,9 @@ class FloatPropertySerialiser : public AbstractUnrealPropertySerialiser { StringArrayView types() override; UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp b/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp index d70aefa..811196b 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp @@ -24,7 +24,7 @@ using namespace Containers::Literals; UnrealPropertyBase::ptr GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -38,7 +38,7 @@ GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain } bool -GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto guid_prop = dynamic_cast(prop.get()); diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h b/src/UESaveFile/Serialisers/GuidPropertySerialiser.h index 6094f83..506986e 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/GuidPropertySerialiser.h @@ -28,8 +28,8 @@ class GuidPropertySerialiser : public UnrealPropertySerialiser(); - if(value_length == UnsignedLong(-1)) { - if(!reader.readInt(prop->value)) { + if(value_length == std::size_t(-1)) { + if(!reader.readInt32(prop->value)) { LOG_ERROR("Couldn't read int property's value."); return nullptr; } - prop->valueLength = UnsignedLong(-1); + prop->valueLength = std::size_t(-1); return prop; } @@ -43,7 +43,7 @@ IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe return nullptr; } - if(!reader.readInt(prop->value)) { + if(!reader.readInt32(prop->value)) { LOG_ERROR_FORMAT("Couldn't read int property {}'s value.", name); return nullptr; } @@ -54,7 +54,7 @@ IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe } bool -IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto int_prop = dynamic_cast(prop.get()); @@ -63,11 +63,11 @@ IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsigned return false; } - if(prop->valueLength != UnsignedLong(-1)) { + if(prop->valueLength != std::size_t(-1)) { writer.writeValueToArray('\0'); } - bytes_written += writer.writeValueToArray(int_prop->value); + bytes_written += writer.writeValueToArray(int_prop->value); return true; } diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.h b/src/UESaveFile/Serialisers/IntPropertySerialiser.h index 6b8ef46..2d05b40 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/IntPropertySerialiser.h @@ -28,8 +28,8 @@ class IntPropertySerialiser : public UnrealPropertySerialiser { private: UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp b/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp index 7692575..0baa805 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp @@ -26,7 +26,7 @@ using namespace Containers::Literals; UnrealPropertyBase::ptr MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -47,14 +47,14 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe return nullptr; } - UnsignedInt null; - if(!reader.readUnsignedInt(null) || null != 0u) { + std::uint32_t null; + if(!reader.readUint32(null) || null != 0u) { LOG_ERROR_FORMAT("Couldn't read a null int in map property {}.", name); return nullptr; } - UnsignedInt count; - if(!reader.readUnsignedInt(count)) { + std::uint32_t count; + if(!reader.readUint32(count)) { LOG_ERROR_FORMAT("Couldn't read map property {}'s item count.", name); return nullptr; } @@ -64,7 +64,7 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe arrayReserve(prop->map, count); - for(UnsignedInt i = 0; i < count; i++) { + for(std::uint32_t i = 0; i < count; i++) { MapProperty::KeyValuePair pair; if(prop->keyType == "IntProperty"_s || prop->keyType == "StrProperty"_s) { @@ -109,7 +109,7 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe } bool -MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto map_prop = dynamic_cast(prop.get()); @@ -122,12 +122,12 @@ MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsigned writer.writeUEStringToArray(map_prop->valueType); writer.writeValueToArray('\0'); - UnsignedLong value_start = writer.arrayPosition(); - writer.writeValueToArray(0u); + std::size_t value_start = writer.arrayPosition(); + writer.writeValueToArray(0u); - writer.writeValueToArray(UnsignedInt(map_prop->map.size())); + writer.writeValueToArray(std::uint32_t(map_prop->map.size())); - UnsignedLong dummy_bytes_written = 0; + std::size_t dummy_bytes_written = 0; for(auto& pair : map_prop->map) { if(!serialiser.writeItem(pair.key, map_prop->keyType, dummy_bytes_written, writer)) { LOG_ERROR("Couldn't write a key."); diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.h b/src/UESaveFile/Serialisers/MapPropertySerialiser.h index c6150aa..447a0e9 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/MapPropertySerialiser.h @@ -28,8 +28,8 @@ class MapPropertySerialiser : public UnrealPropertySerialiser { private: UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp index 9a2ee48..23915ac 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp @@ -27,7 +27,7 @@ using namespace Containers::Literals; UnrealPropertyBase::ptr ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -79,7 +79,7 @@ ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Con } bool -ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto res_prop = dynamic_cast(prop.get()); @@ -90,15 +90,15 @@ ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Uns bytes_written += writer.writeUEStringToArray("ID_4_AAE08F17428E229EC7A2209F51081A21"_s) + writer.writeUEStringToArray("IntProperty"_s) + - writer.writeValueToArray(4ull) + + writer.writeValueToArray(4ull) + writer.writeValueToArray('\0') + - writer.writeValueToArray(res_prop->id); + writer.writeValueToArray(res_prop->id); bytes_written += writer.writeUEStringToArray("Quantity_3_560F09B5485C365D3041888910019CE3"_s) + writer.writeUEStringToArray("IntProperty"_s) + - writer.writeValueToArray(4ull) + + writer.writeValueToArray(4ull) + writer.writeValueToArray('\0') + - writer.writeValueToArray(res_prop->quantity); + writer.writeValueToArray(res_prop->quantity); bytes_written += writer.writeUEStringToArray("None"_s); diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h index 8053327..488f769 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h @@ -28,8 +28,8 @@ class ResourcePropertySerialiser : public UnrealPropertySerialiser(); @@ -36,7 +36,7 @@ RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Cont } bool -RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto rotator = dynamic_cast(prop.get()); @@ -45,8 +45,8 @@ RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsi return false; } - bytes_written += writer.writeValueToArray(rotator->x) + writer.writeValueToArray(rotator->y) + - writer.writeValueToArray(rotator->z); + bytes_written += writer.writeValueToArray(rotator->x) + writer.writeValueToArray(rotator->y) + + writer.writeValueToArray(rotator->z); return true; } diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h index 1ef9349..08d7714 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h @@ -28,8 +28,8 @@ class RotatorPropertySerialiser : public UnrealPropertySerialiser(prop.get()); @@ -70,11 +70,11 @@ SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsigned writer.writeUEStringToArray(set_prop->itemType); writer.writeValueToArray('\0'); - bytes_written += writer.writeValueToArray(0u); - bytes_written += writer.writeValueToArray(UnsignedInt(set_prop->items.size())); + bytes_written += writer.writeValueToArray(0u); + bytes_written += writer.writeValueToArray(std::uint32_t(set_prop->items.size())); - UnsignedLong start_pos = writer.arrayPosition(); - UnsignedLong dummy_bytes_written = 0; + std::size_t start_pos = writer.arrayPosition(); + std::size_t dummy_bytes_written = 0; serialiser.writeSet(set_prop->items, set_prop->itemType, dummy_bytes_written, writer); bytes_written += writer.arrayPosition() - start_pos; diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.h b/src/UESaveFile/Serialisers/SetPropertySerialiser.h index 84ed8e5..1bec9b8 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/SetPropertySerialiser.h @@ -28,8 +28,8 @@ class SetPropertySerialiser : public UnrealPropertySerialiser { private: UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp b/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp index 4c5f210..d645cfc 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp @@ -31,11 +31,11 @@ StringPropertySerialiser::types() { UnrealPropertyBase::ptr StringPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, PropertySerialiser& serialiser) + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(type); - if(value_length != UnsignedLong(-1)) { + if(value_length != std::size_t(-1)) { char terminator; if(!reader.readChar(terminator) || terminator != '\0') { LOG_ERROR_FORMAT("Couldn't read a null byte in string property {}.", name); @@ -54,7 +54,7 @@ StringPropertySerialiser::deserialise(Containers::StringView name, Containers::S } bool -StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, +StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto str_prop = dynamic_cast(prop.get()); @@ -63,7 +63,7 @@ StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& return false; } - if(str_prop->valueLength != UnsignedLong(-1)) { + if(str_prop->valueLength != std::size_t(-1)) { writer.writeValueToArray('\0'); } diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.h b/src/UESaveFile/Serialisers/StringPropertySerialiser.h index 685dfbf..779a086 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/StringPropertySerialiser.h @@ -30,9 +30,9 @@ class StringPropertySerialiser : public AbstractUnrealPropertySerialiser { StringArrayView types() override; UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/StructSerialiser.cpp b/src/UESaveFile/Serialisers/StructSerialiser.cpp index fe2e306..3c628cf 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.cpp +++ b/src/UESaveFile/Serialisers/StructSerialiser.cpp @@ -33,8 +33,8 @@ StructSerialiser::types() { } Containers::Array -StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) +StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -62,10 +62,10 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie prop->structGuid = std::move(guid); } else { - for(UnsignedInt i = 0; i < count; i++) { + for(std::uint32_t i = 0; i < count; i++) { auto prop = Containers::pointer(); - prop = serialiser.readItem(reader, item_type, UnsignedLong(-1), name); + prop = serialiser.readItem(reader, item_type, std::size_t(-1), name); if(!prop) { prop = readStructValue(name, item_type, value_length, reader, serialiser); @@ -86,7 +86,7 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie } UnrealPropertyBase::ptr -StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, +StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; @@ -125,12 +125,12 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie bool StructSerialiser::serialise(Containers::ArrayView props, Containers::StringView item_type, - UnsignedLong& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) + std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { bytes_written += writer.writeUEStringToArray(*(props.front()->name)); bytes_written += writer.writeUEStringToArray(item_type); - UnsignedLong vl_pos = writer.arrayPosition(); - bytes_written += writer.writeValueToArray(0ull); + std::size_t vl_pos = writer.arrayPosition(); + bytes_written += writer.writeValueToArray(0ull); auto struct_prop = dynamic_cast(props.front().get()); if(!struct_prop) { @@ -142,9 +142,9 @@ StructSerialiser::serialise(Containers::ArrayView props bytes_written += writer.writeDataToArray(arrayView(struct_prop->structGuid)); bytes_written += writer.writeValueToArray('\0'); - UnsignedLong vl_start = writer.arrayPosition(); + std::size_t vl_start = writer.arrayPosition(); - UnsignedLong bytes_written_here = 0; + std::size_t bytes_written_here = 0; for(auto& prop : props) { struct_prop = dynamic_cast(prop.get()); if(!struct_prop) { @@ -160,7 +160,7 @@ StructSerialiser::serialise(Containers::ArrayView props } } - UnsignedLong vl_stop = writer.arrayPosition() - vl_start; + std::size_t vl_stop = writer.arrayPosition() - vl_start; writer.writeValueToArrayAt(vl_stop, vl_pos); bytes_written += vl_stop; @@ -168,7 +168,7 @@ StructSerialiser::serialise(Containers::ArrayView props } bool -StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, +StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto struct_prop = dynamic_cast(prop.get()); @@ -182,8 +182,8 @@ StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_w writer.writeValueToArray('\0'); if(!serialiser.writeItem(prop, struct_prop->structType, bytes_written, writer)) { - UnsignedLong dummy_bytes_written = 0; - UnsignedLong vl_start = writer.arrayPosition(); + std::size_t dummy_bytes_written = 0; + std::size_t vl_start = writer.arrayPosition(); if(!writeStructValue(struct_prop, dummy_bytes_written, writer, serialiser)) { LOG_ERROR("Couldn't write the struct value."); return false; @@ -195,7 +195,7 @@ StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_w } StructProperty::ptr -StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, +StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto st_prop = Containers::pointer(); @@ -219,7 +219,7 @@ StructSerialiser::readStructValue(Containers::StringView name, Containers::Strin } bool -StructSerialiser::writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer, +StructSerialiser::writeStructValue(StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto struct_prop = dynamic_cast(prop); diff --git a/src/UESaveFile/Serialisers/StructSerialiser.h b/src/UESaveFile/Serialisers/StructSerialiser.h index 2de192d..96d6cab 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.h +++ b/src/UESaveFile/Serialisers/StructSerialiser.h @@ -31,21 +31,21 @@ class StructSerialiser : public AbstractUnrealPropertySerialiser, public Abstrac StringArrayView types() override; - PropertyArray deserialise(Containers::StringView name, Containers::StringView type, UnsignedLong value_length, - UnsignedInt count, BinaryReader& reader, PropertySerialiser& serialiser) override; + PropertyArray deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) override; UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialise(PropertyArrayView props, Containers::StringView item_type, UnsignedLong& bytes_written, + bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; private: StructProperty::ptr readStructValue(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser); - bool writeStructValue(StructProperty* prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool writeStructValue(StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser); } ; diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp index a3e2329..09698ab 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp @@ -23,12 +23,12 @@ UnrealPropertyBase::ptr TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); - Long start_position = reader.position(); + auto start_position = reader.position(); char terminator; if(!reader.readChar(terminator) || terminator != '\0') { @@ -62,7 +62,7 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain arrayAppend(prop->data, std::move(str)); interval = reader.position() - start_position; - } while(UnsignedLong(interval) < value_length); + } while(std::size_t(interval) < value_length); prop->value = prop->data.back(); @@ -70,7 +70,7 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain } bool -TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto text_prop = dynamic_cast(prop.get()); diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.h b/src/UESaveFile/Serialisers/TextPropertySerialiser.h index 08e1028..f349326 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.h @@ -28,8 +28,8 @@ class TextPropertySerialiser : public UnrealPropertySerialiser { private: UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h b/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h index 763d18f..1d3a7ab 100644 --- a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h @@ -50,13 +50,13 @@ class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser { } UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) override { return deserialiseProperty(name, type, value_length, reader, serialiser); } - bool serialise(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override { return serialiseProperty(prop, bytes_written, writer, serialiser); @@ -64,9 +64,9 @@ class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser { private: virtual UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) = 0; - virtual bool serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, BinaryWriter& writer, + virtual bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; }; diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp index 872e767..c42d3f9 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp @@ -22,7 +22,7 @@ UnrealPropertyBase::ptr Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - UnsignedLong value_length, BinaryReader& reader, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -36,7 +36,7 @@ Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Con } bool -Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto vector = dynamic_cast(prop.get()); @@ -45,7 +45,7 @@ Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Uns return false; } - bytes_written += writer.writeValueToArray(vector->x) + writer.writeValueToArray(vector->y); + bytes_written += writer.writeValueToArray(vector->x) + writer.writeValueToArray(vector->y); return true; } diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h index f6de167..b31ea51 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h @@ -28,8 +28,8 @@ class Vector2DPropertySerialiser : public UnrealPropertySerialiser(); @@ -36,7 +36,7 @@ VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Conta } bool -VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, UnsignedLong& bytes_written, +VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) { auto vector = dynamic_cast(prop.get()); @@ -45,8 +45,8 @@ VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, Unsig return false; } - bytes_written += writer.writeValueToArray(vector->x) + writer.writeValueToArray(vector->y) + - writer.writeValueToArray(vector->z); + bytes_written += writer.writeValueToArray(vector->x) + writer.writeValueToArray(vector->y) + + writer.writeValueToArray(vector->z); return true; } diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h b/src/UESaveFile/Serialisers/VectorPropertySerialiser.h index 85d2920..12b9526 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/VectorPropertySerialiser.h @@ -28,8 +28,8 @@ class VectorPropertySerialiser : public UnrealPropertySerialiser #include -#include - #include "StructProperty.h" using namespace Corrade; -using namespace Magnum; struct DateTimeStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -34,5 +31,5 @@ struct DateTimeStructProperty : public StructProperty { structType = "DateTime"_s; } - UnsignedLong timestamp = 0; + std::int64_t timestamp = 0; }; diff --git a/src/UESaveFile/Types/FloatProperty.h b/src/UESaveFile/Types/FloatProperty.h index 6f23ca9..83dfe59 100644 --- a/src/UESaveFile/Types/FloatProperty.h +++ b/src/UESaveFile/Types/FloatProperty.h @@ -19,14 +19,11 @@ #include #include -#include - #include "UnrealProperty.h" using namespace Corrade; -using namespace Magnum; -struct FloatProperty : public UnrealProperty { +struct FloatProperty : public UnrealProperty { using ptr = Containers::Pointer; FloatProperty() { diff --git a/src/UESaveFile/Types/IntProperty.h b/src/UESaveFile/Types/IntProperty.h index 8b231cf..b381136 100644 --- a/src/UESaveFile/Types/IntProperty.h +++ b/src/UESaveFile/Types/IntProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -struct IntProperty : public UnrealProperty { +struct IntProperty : public UnrealProperty { using ptr = Containers::Pointer; IntProperty() { diff --git a/src/UESaveFile/Types/ResourceItemValue.h b/src/UESaveFile/Types/ResourceItemValue.h index e4b7c17..16ed5f2 100644 --- a/src/UESaveFile/Types/ResourceItemValue.h +++ b/src/UESaveFile/Types/ResourceItemValue.h @@ -19,12 +19,9 @@ #include #include -#include - #include "StructProperty.h" using namespace Corrade; -using namespace Magnum; struct ResourceItemValue : public StructProperty { using ptr = Containers::Pointer; @@ -32,8 +29,12 @@ struct ResourceItemValue : public StructProperty { ResourceItemValue() { using namespace Containers::Literals; structType = "sttResourceItemValue"_s; - structGuid = Containers::StaticArray<16, char>{'\xB7', '\xA7', '\x77', '\xAB', '\xD3', '\x1B', '\xA6', '\x43', '\xAF', '\x42', '\xE5', '\x9E', '\xBF', '\xFD', '\x37', '\x55'}; + structGuid = Containers::StaticArray<16, char>{ + '\xB7', '\xA7', '\x77', '\xAB', '\xD3', '\x1B', '\xA6', '\x43', + '\xAF', '\x42', '\xE5', '\x9E', '\xBF', '\xFD', '\x37', '\x55' + }; } - Int id = 0, quantity = 0; + std::int32_t id = 0; + std::int32_t quantity = 0; }; diff --git a/src/UESaveFile/Types/RotatorStructProperty.h b/src/UESaveFile/Types/RotatorStructProperty.h index eb001c8..5a21991 100644 --- a/src/UESaveFile/Types/RotatorStructProperty.h +++ b/src/UESaveFile/Types/RotatorStructProperty.h @@ -19,12 +19,9 @@ #include #include -#include - #include "StructProperty.h" using namespace Corrade; -using namespace Magnum; struct RotatorStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -34,5 +31,5 @@ struct RotatorStructProperty : public StructProperty { structType = "Rotator"_s; } - Float x = 0.0f, y = 0.0f, z = 0.0f; + float x = 0.0f, y = 0.0f, z = 0.0f; }; diff --git a/src/UESaveFile/Types/UnrealPropertyBase.h b/src/UESaveFile/Types/UnrealPropertyBase.h index 47d8e52..acaf8fd 100644 --- a/src/UESaveFile/Types/UnrealPropertyBase.h +++ b/src/UESaveFile/Types/UnrealPropertyBase.h @@ -16,14 +16,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include #include -#include - using namespace Corrade; -using namespace Magnum; struct UnrealPropertyBase { using ptr = Containers::Pointer; @@ -32,5 +31,5 @@ struct UnrealPropertyBase { Containers::Optional name = Containers::NullOpt; Containers::String propertyType; - UnsignedLong valueLength = 0; + std::size_t valueLength = 0; }; diff --git a/src/UESaveFile/Types/Vector2DStructProperty.h b/src/UESaveFile/Types/Vector2DStructProperty.h index 057bfd9..17b02b7 100644 --- a/src/UESaveFile/Types/Vector2DStructProperty.h +++ b/src/UESaveFile/Types/Vector2DStructProperty.h @@ -19,12 +19,9 @@ #include #include -#include - #include "StructProperty.h" using namespace Corrade; -using namespace Magnum; struct Vector2DStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -34,5 +31,5 @@ struct Vector2DStructProperty : public StructProperty { structType = "Vector2D"_s; } - Float x = 0.0f, y = 0.0f; + float x = 0.0f, y = 0.0f; }; diff --git a/src/UESaveFile/Types/VectorStructProperty.h b/src/UESaveFile/Types/VectorStructProperty.h index b753c11..4189ab1 100644 --- a/src/UESaveFile/Types/VectorStructProperty.h +++ b/src/UESaveFile/Types/VectorStructProperty.h @@ -19,12 +19,9 @@ #include #include -#include - #include "StructProperty.h" using namespace Corrade; -using namespace Magnum; struct VectorStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -34,5 +31,5 @@ struct VectorStructProperty : public StructProperty { structType = "Vector"_s; } - Float x = 0.0f, y = 0.0f, z = 0.0f; + float x = 0.0f, y = 0.0f, z = 0.0f; }; diff --git a/src/UESaveFile/UESaveFile.cpp b/src/UESaveFile/UESaveFile.cpp index 51d5684..d754540 100644 --- a/src/UESaveFile/UESaveFile.cpp +++ b/src/UESaveFile/UESaveFile.cpp @@ -92,13 +92,13 @@ UESaveFile::saveToFile() { return false; } - if(!writer.writeArray(arrayView(_magicBytes)) || - !writer.writeUnsignedInt(_saveVersion) || - !writer.writeUnsignedInt(_packageVersion) || - !writer.writeUnsignedShort(_engineVersion.major) || - !writer.writeUnsignedShort(_engineVersion.minor) || - !writer.writeUnsignedShort(_engineVersion.patch) || - !writer.writeUnsignedInt(_engineVersion.build) || + if(!writer.writeArray(arrayView(_magicBytes)) || + !writer.writeUint32(_saveVersion) || + !writer.writeUint32(_packageVersion) || + !writer.writeUint16(_engineVersion.major) || + !writer.writeUint16(_engineVersion.minor) || + !writer.writeUint16(_engineVersion.patch) || + !writer.writeUint32(_engineVersion.build) || !writer.writeUEString(_engineVersion.buildId)) { _lastError = "Couldn't write the header."_s; @@ -106,17 +106,17 @@ UESaveFile::saveToFile() { return false; } - if(!writer.writeUnsignedInt(_customFormatVersion) || - !writer.writeUnsignedInt(_customFormatData.size())) + if(!writer.writeUint32(_customFormatVersion) || + !writer.writeUint32(_customFormatData.size())) { _lastError = "Couldn't write the custom format data."_s; LOG_ERROR(_lastError); return false; } - for(UnsignedLong i = 0; i < _customFormatData.size(); i++) { + for(std::size_t i = 0; i < _customFormatData.size(); i++) { if(!writer.writeStaticArray(Containers::StaticArrayView<16, const char>{_customFormatData[i].id}) || - !writer.writeUnsignedInt(_customFormatData[i].value)) + !writer.writeUint32(_customFormatData[i].value)) { _lastError = "Couldn't write the custom format data."_s; LOG_ERROR(_lastError); @@ -131,7 +131,7 @@ UESaveFile::saveToFile() { } for(auto& prop : _properties) { - UnsignedLong bytes_written = 0; + std::size_t bytes_written = 0; if(!_propSerialiser->write(prop, bytes_written, writer)) { _lastError = "Couldn't write the property "_s + *prop->name + " to the array."_s; LOG_ERROR(_lastError); @@ -145,7 +145,7 @@ UESaveFile::saveToFile() { } } - writer.writeUnsignedInt(0); + writer.writeUint32(0u); writer.closeFile(); @@ -197,12 +197,12 @@ UESaveFile::loadData() { return; } - if(!reader.readUnsignedInt(_saveVersion) || - !reader.readUnsignedInt(_packageVersion) || - !reader.readUnsignedShort(_engineVersion.major) || - !reader.readUnsignedShort(_engineVersion.minor) || - !reader.readUnsignedShort(_engineVersion.patch) || - !reader.readUnsignedInt(_engineVersion.build) || + if(!reader.readUint32(_saveVersion) || + !reader.readUint32(_packageVersion) || + !reader.readUint16(_engineVersion.major) || + !reader.readUint16(_engineVersion.minor) || + !reader.readUint16(_engineVersion.patch) || + !reader.readUint32(_engineVersion.build) || !reader.readUEString(_engineVersion.buildId)) { _lastError = "Couldn't read version data."; @@ -210,15 +210,15 @@ UESaveFile::loadData() { return; } - if(!reader.readUnsignedInt(_customFormatVersion)) { + if(!reader.readUint32(_customFormatVersion)) { _lastError = "Couldn't read the custom format version."; LOG_ERROR(_lastError); return; } - UnsignedInt custom_format_data_size = 0; + std::uint32_t custom_format_data_size = 0; - if(!reader.readUnsignedInt(custom_format_data_size)) { + if(!reader.readUint32(custom_format_data_size)) { _lastError = "Couldn't read the custom format data size."; LOG_ERROR(_lastError); return; @@ -226,11 +226,11 @@ UESaveFile::loadData() { _customFormatData = Containers::Array{custom_format_data_size}; - for(UnsignedInt i = 0; i < custom_format_data_size; i++) { + for(std::uint32_t i = 0; i < custom_format_data_size; i++) { CustomFormatDataEntry entry; if(!reader.readStaticArray(entry.id) || - !reader.readInt(entry.value)) + !reader.readInt32(entry.value)) { _lastError = "Couldn't read the custom format data"; LOG_ERROR(_lastError); diff --git a/src/UESaveFile/UESaveFile.h b/src/UESaveFile/UESaveFile.h index 8ed3476..91798e9 100644 --- a/src/UESaveFile/UESaveFile.h +++ b/src/UESaveFile/UESaveFile.h @@ -23,14 +23,11 @@ #include #include -#include - #include "Types/UnrealPropertyBase.h" #include "PropertySerialiser.h" using namespace Corrade; -using namespace Magnum; class UESaveFile { public: @@ -72,20 +69,20 @@ class UESaveFile { Containers::StaticArray<4, char> _magicBytes{'G', 'V', 'A', 'S'}; - UnsignedInt _saveVersion = 0; - UnsignedInt _packageVersion = 0; + std::uint32_t _saveVersion = 0; + std::uint32_t _packageVersion = 0; struct { - UnsignedShort major = 0; - UnsignedShort minor = 0; - UnsignedShort patch = 0; - UnsignedInt build = 0; + std::uint16_t major = 0; + std::uint16_t minor = 0; + std::uint16_t patch = 0; + std::uint32_t build = 0; Containers::String buildId; } _engineVersion; - UnsignedInt _customFormatVersion = 0; + std::uint32_t _customFormatVersion = 0; struct CustomFormatDataEntry { Containers::StaticArray<16, char> id; - Int value = 0; + std::int32_t value = 0; }; Containers::Array _customFormatData; diff --git a/src/Utilities/Crc32.h b/src/Utilities/Crc32.h index e6babd6..6937f28 100644 --- a/src/Utilities/Crc32.h +++ b/src/Utilities/Crc32.h @@ -16,47 +16,47 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include -#include - using namespace Corrade; -using namespace Magnum; -struct Crc32 { - static const Containers::StaticArray<256, UnsignedInt> table; +namespace Crc32 { - static auto update(UnsignedInt initial, Containers::ArrayView data) -> UnsignedInt { - UnsignedInt c = initial ^ 0xFFFFFFFF; - auto u = Containers::arrayCast(data); +std::uint32_t update(std::uint32_t initial, Containers::ArrayView data) { + static const auto table = []{ + std::uint32_t polynomial = 0xEDB88320u; + Containers::StaticArray<256, std::uint32_t> temp{ValueInit}; - for(std::size_t i = 0; i < data.size(); ++i) { - c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8); + for(std::uint32_t i = 0; i < 256; i++) { + std::uint32_t c = i; + + for(std::size_t j = 0; j < 8; j++) { + if(c & 1) { + c = polynomial ^ (c >> 1); + } + else { + c >>= 1; + } + } + + temp[i] = c; } - return c ^ 0xFFFFFFFF; - } -}; + return temp; + }(); -const Containers::StaticArray<256, UnsignedInt> Crc32::table = []{ - UnsignedInt polynomial = 0xEDB88320u; - Containers::StaticArray<256, UnsignedInt> temp{ValueInit}; + std::uint32_t c = initial ^ 0xFFFFFFFF; - for(UnsignedInt i = 0; i < 256; i++) { - UnsignedInt c = i; + auto u = Containers::arrayCast(data); - for(std::size_t j = 0; j < 8; j++) { - if(c & 1) { - c = polynomial ^ (c >> 1); - } - else { - c >>= 1; - } - } - - temp[i] = c; + for(std::size_t i = 0; i < data.size(); ++i) { + c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8); } - return temp; -}(); + return c ^ 0xFFFFFFFF; +} + +} // Crc32 diff --git a/src/main.cpp b/src/main.cpp index 5af499f..20e1be1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -81,7 +81,7 @@ int main(int argc, char** argv) { } SaveTool app({argc, argv}); - Int result = app.exec(); + int result = app.exec(); ReleaseMutex(mutex_handle); -- 2.39.5 From 8e0f0e5beb51418c32659fd011db22263f6987a4 Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 5 Dec 2022 11:50:28 +0100 Subject: [PATCH 006/126] SaveTool: update a TextUnformatted() call. --- src/SaveTool/SaveTool_MainManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index ff7a90c..cd9d6a0 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -438,7 +438,7 @@ SaveTool::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t t ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); ImGui::TableSetColumnIndex(1); - ImGui::TextUnformatted(name.data()); + ImGui::TextUnformatted(name.begin(), name.end()); ImGui::TableSetColumnIndex(2); ImGui::TextDisabled("Unavailable as of game version " SUPPORTED_GAME_VERSION); } -- 2.39.5 From 03472e56dc5e27f058fc381a88e756458ba467cf Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 5 Dec 2022 12:11:02 +0100 Subject: [PATCH 007/126] Profile,SaveTool: change how materials are handled. --- src/Profile/Profile.cpp | 324 ++++---------------------- src/Profile/Profile.h | 104 +-------- src/SaveTool/SaveTool.h | 3 +- src/SaveTool/SaveTool_MainManager.cpp | 153 ++++-------- 4 files changed, 100 insertions(+), 484 deletions(-) diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index a572d00..4c4fe6e 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -133,33 +133,33 @@ Profile::refreshValues() { _lastMissionId = prop ? prop->value : 0; LOG_INFO("Getting the materials."); - _verseSteel = getResource(PROFILE_MATERIAL, VerseSteel); - _undinium = getResource(PROFILE_MATERIAL, Undinium); - _necriumAlloy = getResource(PROFILE_MATERIAL, NecriumAlloy); - _lunarite = getResource(PROFILE_MATERIAL, Lunarite); - _asterite = getResource(PROFILE_MATERIAL, Asterite); - _halliteFragma = getResource(PROFILE_MATERIAL, HalliteFragma); + _materials[VerseSteel] = getResource(PROFILE_MATERIAL, VerseSteel); + _materials[Undinium] = getResource(PROFILE_MATERIAL, Undinium); + _materials[NecriumAlloy] = getResource(PROFILE_MATERIAL, NecriumAlloy); + _materials[Lunarite] = getResource(PROFILE_MATERIAL, Lunarite); + _materials[Asterite] = getResource(PROFILE_MATERIAL, Asterite); + _materials[HalliteFragma] = getResource(PROFILE_MATERIAL, HalliteFragma); - _ednil = getResource(PROFILE_MATERIAL, Ednil); - _nuflalt = getResource(PROFILE_MATERIAL, Nuflalt); - _aurelene = getResource(PROFILE_MATERIAL, Aurelene); - _soldus = getResource(PROFILE_MATERIAL, Soldus); - _synthesisedN = getResource(PROFILE_MATERIAL, SynthesisedN); - _nanoc = getResource(PROFILE_MATERIAL, Nanoc); + _materials[Ednil] = getResource(PROFILE_MATERIAL, Ednil); + _materials[Nuflalt] = getResource(PROFILE_MATERIAL, Nuflalt); + _materials[Aurelene] = getResource(PROFILE_MATERIAL, Aurelene); + _materials[Soldus] = getResource(PROFILE_MATERIAL, Soldus); + _materials[SynthesisedN] = getResource(PROFILE_MATERIAL, SynthesisedN); + _materials[Nanoc] = getResource(PROFILE_MATERIAL, Nanoc); - _alcarbonite = getResource(PROFILE_MATERIAL, Alcarbonite); - _keriphene = getResource(PROFILE_MATERIAL, Keriphene); - _nitinolCM = getResource(PROFILE_MATERIAL, NitinolCM); - _quarkium = getResource(PROFILE_MATERIAL, Quarkium); - _alterene = getResource(PROFILE_MATERIAL, Alterene); - _cosmium = getResource(PROFILE_MATERIAL, Cosmium); + _materials[Alcarbonite] = getResource(PROFILE_MATERIAL, Alcarbonite); + _materials[Keriphene] = getResource(PROFILE_MATERIAL, Keriphene); + _materials[NitinolCM] = getResource(PROFILE_MATERIAL, NitinolCM); + _materials[Quarkium] = getResource(PROFILE_MATERIAL, Quarkium); + _materials[Alterene] = getResource(PROFILE_MATERIAL, Alterene); + _materials[Cosmium] = getResource(PROFILE_MATERIAL, Cosmium); - _mixedComposition = getResource(PROFILE_QUARK_DATA, MixedComposition); - _voidResidue = getResource(PROFILE_QUARK_DATA, VoidResidue); - _muscularConstruction = getResource(PROFILE_QUARK_DATA, MuscularConstruction); - _mineralExoskeletology = getResource(PROFILE_QUARK_DATA, MineralExoskeletology); - _carbonisedSkin = getResource(PROFILE_QUARK_DATA, CarbonisedSkin); - _isolatedVoidParticle = getResource(PROFILE_QUARK_DATA, IsolatedVoidParticle); + _materials[MixedComposition] = getResource(PROFILE_QUARK_DATA, MixedComposition); + _materials[VoidResidue] = getResource(PROFILE_QUARK_DATA, VoidResidue); + _materials[MuscularConstruction] = getResource(PROFILE_QUARK_DATA, MuscularConstruction); + _materials[MineralExoskeletology] = getResource(PROFILE_QUARK_DATA, MineralExoskeletology); + _materials[CarbonisedSkin] = getResource(PROFILE_QUARK_DATA, CarbonisedSkin); + _materials[IsolatedVoidParticle] = getResource(PROFILE_QUARK_DATA, IsolatedVoidParticle); _valid = true; } @@ -252,264 +252,13 @@ Profile::lastMissionId() const { } std::int32_t -Profile::verseSteel() const { - return _verseSteel; +Profile::material(MaterialID id) const { + return _materials.at(id); } bool -Profile::setVerseSteel(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, VerseSteel, amount); -} - -std::int32_t -Profile::undinium() const { - return _undinium; -} - -bool -Profile::setUndinium(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Undinium, amount); -} - -std::int32_t -Profile::necriumAlloy() const { - return _necriumAlloy; -} - -bool -Profile::setNecriumAlloy(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, NecriumAlloy, amount); -} - -std::int32_t -Profile::lunarite() const { - return _lunarite; -} - -bool -Profile::setLunarite(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Lunarite, amount); -} - -std::int32_t -Profile::asterite() const { - return _asterite; -} - -bool -Profile::setAsterite(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Asterite, amount); -} - -std::int32_t -Profile::halliteFragma() const { - return _halliteFragma; -} - -bool -Profile::setHalliteFragma(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, HalliteFragma, amount); -} - -std::int32_t -Profile::ednil() const { - return _ednil; -} - -bool -Profile::setEdnil(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Ednil, amount); -} - -std::int32_t -Profile::nuflalt() const { - return _nuflalt; -} - -bool -Profile::setNuflalt(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Nuflalt, amount); -} - -std::int32_t -Profile::aurelene() const { - return _aurelene; -} - -bool -Profile::setAurelene(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Aurelene, amount); -} - -std::int32_t -Profile::soldus() const { - return _soldus; -} - -bool -Profile::setSoldus(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Soldus, amount); -} - -std::int32_t -Profile::synthesisedN() const { - return _synthesisedN; -} - -bool -Profile::setSynthesisedN(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, SynthesisedN, amount); -} - -std::int32_t -Profile::nanoc() const { - return _nanoc; -} - -bool -Profile::setNanoc(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Nanoc, amount); -} - -std::int32_t -Profile::alcarbonite() const { - return _alcarbonite; -} - -bool -Profile::setAlcarbonite(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Alcarbonite, amount); -} - -std::int32_t -Profile::keriphene() const { - return _keriphene; -} - -bool -Profile::setKeriphene(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Keriphene, amount); -} - -std::int32_t -Profile::nitinolCM() const { - return _nitinolCM; -} - -bool -Profile::setNitinolCM(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, NitinolCM, amount); -} - -std::int32_t -Profile::quarkium() const { - return _quarkium; -} - -bool -Profile::setQuarkium(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Quarkium, amount); -} - -std::int32_t -Profile::alterene() const { - return _alterene; -} - -bool -Profile::setAlterene(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Alterene, amount); -} - -std::int32_t -Profile::cosmium() const { - return _cosmium; -} - -bool -Profile::setCosmium(std::int32_t amount) { - return setResource(PROFILE_MATERIAL, Cosmium, amount); -} - -std::int32_t -Profile::mixedComposition() const { - return _mixedComposition; -} - -bool -Profile::setMixedComposition(std::int32_t amount) { - return setResource(PROFILE_QUARK_DATA, MixedComposition, amount); -} - -std::int32_t -Profile::voidResidue() const { - return _voidResidue; -} - -bool -Profile::setVoidResidue(std::int32_t amount) { - return setResource(PROFILE_QUARK_DATA, VoidResidue, amount); -} - -std::int32_t -Profile::muscularConstruction() const { - return _muscularConstruction; -} - -bool -Profile::setMuscularConstruction(std::int32_t amount) { - return setResource(PROFILE_QUARK_DATA, MuscularConstruction, amount); -} - -std::int32_t -Profile::mineralExoskeletology() const { - return _mineralExoskeletology; -} - -bool -Profile::setMineralExoskeletology(std::int32_t amount) { - return setResource(PROFILE_QUARK_DATA, MineralExoskeletology, amount); -} - -std::int32_t -Profile::carbonisedSkin() const { - return _carbonisedSkin; -} - -bool -Profile::setCarbonisedSkin(std::int32_t amount) { - return setResource(PROFILE_QUARK_DATA, CarbonisedSkin, amount); -} - -std::int32_t -Profile::isolatedVoidParticle() const { - return _isolatedVoidParticle; -} - -bool -Profile::setIsolatedVoidParticle(std::int32_t amount) { - return setResource(PROFILE_QUARK_DATA, IsolatedVoidParticle, amount); -} - -std::int32_t -Profile::getResource(Containers::StringView container, MaterialID id) { - auto mats_prop = _profile.at(container); - - if(!mats_prop) { - return 0; - } - - auto predicate = [&id](UnrealPropertyBase::ptr& prop){ - auto res_prop = static_cast(prop.get()); - return res_prop->id == id; - }; - - auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate); - return it != mats_prop->items.end() ? static_cast(it->get())->quantity : 0; -} - -bool -Profile::setResource(Containers::StringView container, MaterialID id, std::int32_t amount) { +Profile::setMaterial(MaterialID id, std::int32_t amount) { + Containers::StringView container = id > MixedComposition ? PROFILE_QUARK_DATA : PROFILE_MATERIAL; auto mats_prop = _profile.at(container); if(!mats_prop) { @@ -549,3 +298,20 @@ Profile::setResource(Containers::StringView container, MaterialID id, std::int32 return true; } + +std::int32_t +Profile::getResource(Containers::StringView container, MaterialID id) { + auto mats_prop = _profile.at(container); + + if(!mats_prop) { + return 0; + } + + auto predicate = [&id](UnrealPropertyBase::ptr& prop){ + auto res_prop = static_cast(prop.get()); + return res_prop->id == id; + }; + + auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate); + return it != mats_prop->items.end() ? static_cast(it->get())->quantity : 0; +} diff --git a/src/Profile/Profile.h b/src/Profile/Profile.h index 2539de9..46c9c08 100644 --- a/src/Profile/Profile.h +++ b/src/Profile/Profile.h @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include @@ -60,81 +62,11 @@ class Profile { std::int32_t lastMissionId() const; - std::int32_t verseSteel() const; - bool setVerseSteel(std::int32_t amount); - - std::int32_t undinium() const; - bool setUndinium(std::int32_t amount); - - std::int32_t necriumAlloy() const; - bool setNecriumAlloy(std::int32_t amount); - - std::int32_t lunarite() const; - bool setLunarite(std::int32_t amount); - - std::int32_t asterite() const; - bool setAsterite(std::int32_t amount); - - std::int32_t halliteFragma() const; - bool setHalliteFragma(std::int32_t amount); - - std::int32_t ednil() const; - bool setEdnil(std::int32_t amount); - - std::int32_t nuflalt() const; - bool setNuflalt(std::int32_t amount); - - std::int32_t aurelene() const; - bool setAurelene(std::int32_t amount); - - std::int32_t soldus() const; - bool setSoldus(std::int32_t amount); - - std::int32_t synthesisedN() const; - bool setSynthesisedN(std::int32_t amount); - - std::int32_t nanoc() const; - bool setNanoc(std::int32_t amount); - - std::int32_t alcarbonite() const; - bool setAlcarbonite(std::int32_t amount); - - std::int32_t keriphene() const; - bool setKeriphene(std::int32_t amount); - - std::int32_t nitinolCM() const; - bool setNitinolCM(std::int32_t amount); - - std::int32_t quarkium() const; - bool setQuarkium(std::int32_t amount); - - std::int32_t alterene() const; - bool setAlterene(std::int32_t amount); - - std::int32_t cosmium() const; - bool setCosmium(std::int32_t amount); - - std::int32_t mixedComposition() const; - bool setMixedComposition(std::int32_t amount); - - std::int32_t voidResidue() const; - bool setVoidResidue(std::int32_t amount); - - std::int32_t muscularConstruction() const; - bool setMuscularConstruction(std::int32_t amount); - - std::int32_t mineralExoskeletology() const; - bool setMineralExoskeletology(std::int32_t amount); - - std::int32_t carbonisedSkin() const; - bool setCarbonisedSkin(std::int32_t amount); - - std::int32_t isolatedVoidParticle() const; - bool setIsolatedVoidParticle(std::int32_t amount); + std::int32_t material(MaterialID id) const; + bool setMaterial(MaterialID id, std::int32_t amount); private: std::int32_t getResource(Containers::StringView container, MaterialID id); - bool setResource(Containers::StringView container, MaterialID id, std::int32_t amount); Containers::String _filename; @@ -148,33 +80,7 @@ class Profile { std::int32_t _storyProgress = 0; std::int32_t _lastMissionId = 0; - std::int32_t _verseSteel = 0; - std::int32_t _undinium = 0; - std::int32_t _necriumAlloy = 0; - std::int32_t _lunarite = 0; - std::int32_t _asterite = 0; - std::int32_t _halliteFragma = 0; - - std::int32_t _ednil = 0; - std::int32_t _nuflalt = 0; - std::int32_t _aurelene = 0; - std::int32_t _soldus = 0; - std::int32_t _synthesisedN = 0; - std::int32_t _nanoc = 0; - - std::int32_t _alcarbonite = 0; - std::int32_t _keriphene = 0; - std::int32_t _nitinolCM = 0; - std::int32_t _quarkium = 0; - std::int32_t _alterene = 0; - std::int32_t _cosmium = 0; - - std::int32_t _mixedComposition = 0; - std::int32_t _voidResidue = 0; - std::int32_t _muscularConstruction = 0; - std::int32_t _mineralExoskeletology = 0; - std::int32_t _carbonisedSkin = 0; - std::int32_t _isolatedVoidParticle = 0; + std::map _materials; Containers::String _account; diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index df4ee27..dfd9de9 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -125,8 +125,7 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener bool drawRenamePopup(Containers::ArrayView name_view); void drawGeneralInfo(); void drawResearchInventory(); - template - void drawMaterialRow(Containers::StringView name, std::int32_t tier, Getter getter, Setter setter); + void drawMaterialRow(Containers::StringView name, std::int32_t tier, MaterialID id); void drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier); void drawMassManager(); ImGuiID drawDeleteMassPopup(int mass_index); diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index cd9d6a0..93ec331 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -106,7 +106,7 @@ SaveTool::drawIntEditPopup(int* value_to_edit, int max) { drawHelpMarker("You can either drag the widget left or right to change the value,\n" "or click on it while holding Ctrl to edit the value directly."); ImGui::SameLine(); - drawUnsafeWidget([](auto... args){ return ImGui::SliderInt("", args...); }, + drawUnsafeWidget([](auto... args){ return ImGui::SliderInt("##IntSlider", args...); }, value_to_edit, 0, max, "%d", ImGuiSliderFlags_AlwaysClamp); ImGui::SameLine(); if(drawUnsafeWidget([]{ return ImGui::Button("Apply"); })) { @@ -137,13 +137,15 @@ SaveTool::drawRenamePopup(Containers::ArrayView name_view) { (name_view[0] != ' ' && name_view[len - 1] != ' ') ? ICON_FA_CHECK : ICON_FA_TIMES); static auto callback = [](ImGuiInputTextCallbackData* data)->int { - if(data->EventChar < 256 && std::strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789- ", char(data->EventChar))) { + if(data->EventChar < 256 && + std::strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789- ", char(data->EventChar))) + { return 0; } return 1; }; - drawUnsafeWidget([](auto... args){ return ImGui::InputText("", args...); }, + drawUnsafeWidget([](auto... args){ return ImGui::InputText("##NameField", args...); }, name_view.data(), name_view.size(), ImGuiInputTextFlags_CallbackCharFilter, callback, nullptr); @@ -298,137 +300,80 @@ SaveTool::drawResearchInventory() { ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); - ImGui::Text("Engine materials"); + ImGui::TextUnformatted("Engine materials"); - drawMaterialRow("Verse steel", 1, - [this]{ return _currentProfile->verseSteel(); }, - [this](std::int32_t amount){ return _currentProfile->setVerseSteel(amount); }); - drawMaterialRow("Undinium", 2, - [this]{ return _currentProfile->undinium(); }, - [this](std::int32_t amount){ return _currentProfile->setUndinium(amount); }); - drawMaterialRow("Necrium alloy", 3, - [this]{ return _currentProfile->necriumAlloy(); }, - [this](std::int32_t amount){ return _currentProfile->setNecriumAlloy(amount); }); - drawMaterialRow("Lunarite", 4, - [this]{ return _currentProfile->lunarite(); }, - [this](std::int32_t amount){ return _currentProfile->setLunarite(amount); }); - drawMaterialRow("Asterite", 5, - [this]{ return _currentProfile->asterite(); }, - [this](std::int32_t amount){ return _currentProfile->setAsterite(amount); }); - drawMaterialRow("Hallite fragma", 6, - [this]{ return _currentProfile->halliteFragma(); }, - [this](std::int32_t amount){ return _currentProfile->setHalliteFragma(amount); }); + drawMaterialRow("Verse steel", 1, VerseSteel); + drawMaterialRow("Undinium", 2, Undinium); + drawMaterialRow("Necrium alloy", 3, NecriumAlloy); + drawMaterialRow("Lunarite", 4, Lunarite); + drawMaterialRow("Asterite", 5, Asterite); + drawMaterialRow("Hallite fragma", 6, HalliteFragma); drawUnavailableMaterialRow("Unnoctinium", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); - ImGui::Text("OS materials"); + ImGui::TextUnformatted("OS materials"); - drawMaterialRow("Ednil", 1, - [this]{ return _currentProfile->ednil(); }, - [this](std::int32_t amount){ return _currentProfile->setEdnil(amount); }); - drawMaterialRow("Nuflalt", 2, - [this]{ return _currentProfile->nuflalt(); }, - [this](std::int32_t amount){ return _currentProfile->setNuflalt(amount); }); - drawMaterialRow("Aurelene", 3, - [this]{ return _currentProfile->aurelene(); }, - [this](std::int32_t amount){ return _currentProfile->setAurelene(amount); }); - drawMaterialRow("Soldus", 4, - [this]{ return _currentProfile->soldus(); }, - [this](std::int32_t amount){ return _currentProfile->setSoldus(amount); }); - drawMaterialRow("Synthesized N", 5, - [this]{ return _currentProfile->synthesisedN(); }, - [this](std::int32_t amount){ return _currentProfile->setSynthesisedN(amount); }); - drawMaterialRow("Nanoc", 6, - [this]{ return _currentProfile->nanoc(); }, - [this](std::int32_t amount){ return _currentProfile->setNanoc(amount); }); + drawMaterialRow("Ednil", 1, Ednil); + drawMaterialRow("Nuflalt", 2, Nuflalt); + drawMaterialRow("Aurelene", 3, Aurelene); + drawMaterialRow("Soldus", 4, Soldus); + drawMaterialRow("Synthesized N", 5, SynthesisedN); + drawMaterialRow("Nanoc", 6, Nanoc); drawUnavailableMaterialRow("Abyssillite", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); - ImGui::Text("Architect materials"); + ImGui::TextUnformatted("Architect materials"); - drawMaterialRow("Alcarbonite", 1, - [this]{ return _currentProfile->alcarbonite(); }, - [this](std::int32_t amount){ return _currentProfile->setAlcarbonite(amount); }); - drawMaterialRow("Keripehene", 2, - [this]{ return _currentProfile->keriphene(); }, - [this](std::int32_t amount){ return _currentProfile->setKeriphene(amount); }); - drawMaterialRow("Nitinol-CM", 3, - [this]{ return _currentProfile->nitinolCM(); }, - [this](std::int32_t amount){ return _currentProfile->setNitinolCM(amount); }); - drawMaterialRow("Quarkium", 4, - [this]{ return _currentProfile->quarkium(); }, - [this](std::int32_t amount){ return _currentProfile->setQuarkium(amount); }); - drawMaterialRow("Alterene", 5, - [this]{ return _currentProfile->alterene(); }, - [this](std::int32_t amount){ return _currentProfile->setAlterene(amount); }); - drawMaterialRow("Cosmium", 6, - [this]{ return _currentProfile->cosmium(); }, - [this](std::int32_t amount){ return _currentProfile->setCosmium(amount); }); + drawMaterialRow("Alcarbonite", 1, Alcarbonite); + drawMaterialRow("Keriphene", 2, Keriphene); + drawMaterialRow("Nitinol-CM", 3, NitinolCM); + drawMaterialRow("Quarkium", 4, Quarkium); + drawMaterialRow("Alterene", 5, Alterene); + drawMaterialRow("Cosmium", 6, Cosmium); drawUnavailableMaterialRow("Purified quarkium", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); - ImGui::Text("Quark data"); + ImGui::TextUnformatted("Quark data"); - drawMaterialRow("Mixed composition", 1, - [this]{ return _currentProfile->mixedComposition(); }, - [this](std::int32_t amount){ return _currentProfile->setMixedComposition(amount); }); - drawMaterialRow("Void residue", 2, - [this]{ return _currentProfile->voidResidue(); }, - [this](std::int32_t amount){ return _currentProfile->setVoidResidue(amount); }); - drawMaterialRow("Muscular construction", 3, - [this]{ return _currentProfile->muscularConstruction(); }, - [this](std::int32_t amount){ return _currentProfile->setMuscularConstruction(amount); }); - drawMaterialRow("Mineral exoskeletology", 4, - [this]{ return _currentProfile->mineralExoskeletology(); }, - [this](std::int32_t amount){ return _currentProfile->setMineralExoskeletology(amount); }); - drawMaterialRow("Carbonized skin", 5, - [this]{ return _currentProfile->carbonisedSkin(); }, - [this](std::int32_t amount){ return _currentProfile->setCarbonisedSkin(amount); }); - drawMaterialRow("Isolated void particle", 6, - [this]{ return _currentProfile->isolatedVoidParticle(); }, - [this](std::int32_t amount){ return _currentProfile->setIsolatedVoidParticle(amount); }); + drawMaterialRow("Mixed composition", 1, MixedComposition); + drawMaterialRow("Void residue", 2, VoidResidue); + drawMaterialRow("Muscular construction", 3, MuscularConstruction); + drawMaterialRow("Mineral exoskeletology", 4, MineralExoskeletology); + drawMaterialRow("Carbonized skin", 5, CarbonisedSkin); + drawMaterialRow("Isolated void particle", 6, IsolatedVoidParticle); drawUnavailableMaterialRow("Weaponised physiology", 7); ImGui::EndTable(); } } -template void -SaveTool::drawMaterialRow(Containers::StringView name, std::int32_t tier, Getter getter, Setter setter) { - static_assert(std::is_same::value, "getter doesn't return an std::int32_t, and/or doesn't take zero arguments."); - static_assert(std::is_same::value, "setter doesn't return a bool, and/or doesn't take a single std::int32_t as an argument."); - +SaveTool::drawMaterialRow(Containers::StringView name, std::int32_t tier, MaterialID id) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted(name.data()); ImGui::TableSetColumnIndex(2); - if(getter() != -1) { - ImGui::Text("%i", getter()); - if(conf().cheatMode()) { - ImGui::TableSetColumnIndex(3); - ImGui::PushID(name.data()); - static std::int32_t var = 0; - if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_EDIT)) { - (var) = getter(); - ImGui::OpenPopup("int_edit"); - } - drawTooltip("Edit"); - if(drawIntEditPopup(&(var), 9999)) { - if(!setter(var)) { - _queue.addToast(Toast::Type::Error, _currentProfile->lastError()); - } - } - ImGui::PopID(); + ImGui::Text("%i", _currentProfile->material(id)); + if(conf().cheatMode()) { + ImGui::TableSetColumnIndex(3); + ImGui::PushID(name.data()); + static std::int32_t var = 0; + if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_EDIT)) { + var = _currentProfile->material(id); + ImGui::OpenPopup("int_edit"); } - } - else { - ImGui::TextDisabled("Not found in the save file"); + drawTooltip("Edit"); + if(drawIntEditPopup(&var, 9999)) { + if(!_currentProfile->setMaterial(id, var)) { + _queue.addToast(Toast::Type::Error, _currentProfile->lastError()); + } + } + ImGui::PopID(); } } -- 2.39.5 From 5f43e143dce2ae777c877a2500498911bbdc4067 Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 5 Dec 2022 14:38:50 +0100 Subject: [PATCH 008/126] CMakeLists: change how defines are handled. --- src/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 939fd4c..a3191ae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -188,9 +188,10 @@ add_executable(MassBuilderSaveTool WIN32 ) if(CMAKE_BUILD_TYPE STREQUAL Debug) - add_compile_definitions(SAVETOOL_DEBUG_BUILD) + target_compile_definitions(Logger PRIVATE SAVETOOL_DEBUG_BUILD) + target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_DEBUG_BUILD) endif() -add_compile_definitions( +target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_VERSION="${SAVETOOL_PROJECT_VERSION}" SAVETOOL_CODENAME="Enigmatic Ellenier" SUPPORTED_GAME_VERSION="0.9.x" -- 2.39.5 From dc8fd24cb74e08b48f999a6b90fd67c7994abd9c Mon Sep 17 00:00:00 2001 From: William JCM Date: Mon, 5 Dec 2022 14:39:06 +0100 Subject: [PATCH 009/126] CMakeLists: we're working on 1.5 now. --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a3191ae..5c084f5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,7 +18,7 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(SAVETOOL_PROJECT_VERSION 1.4.3) +set(SAVETOOL_PROJECT_VERSION 1.5.0-pre) find_package(Corrade REQUIRED Main Containers Utility) find_package(Magnum REQUIRED GL Sdl2Application) @@ -193,7 +193,7 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug) endif() target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_VERSION="${SAVETOOL_PROJECT_VERSION}" - SAVETOOL_CODENAME="Enigmatic Ellenier" + SAVETOOL_CODENAME="Friendly Valkyrie" SUPPORTED_GAME_VERSION="0.9.x" ) -- 2.39.5 From c4f061aa65ff194f27705e9fe3841a3666026f87 Mon Sep 17 00:00:00 2001 From: William JCM Date: Tue, 13 Dec 2022 22:23:47 +0100 Subject: [PATCH 010/126] CMakeLists: reorganise the sub-libs. --- src/CMakeLists.txt | 97 +--------------------------------- src/Logger/CMakeLists.txt | 28 ++++++++++ src/UESaveFile/CMakeLists.txt | 98 +++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 95 deletions(-) create mode 100644 src/Logger/CMakeLists.txt create mode 100644 src/UESaveFile/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5c084f5..9022e66 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -28,101 +28,8 @@ set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) corrade_add_resource(Assets assets.conf) -add_library(Logger STATIC EXCLUDE_FROM_ALL - Logger/Logger.h - Logger/Logger.cpp - Logger/EntryType.h - Logger/MagnumLogBuffer.h - Logger/MagnumLogBuffer.cpp -) - -target_link_libraries(Logger PRIVATE - Corrade::Utility - Magnum::Magnum -) - -add_library(UESaveFile STATIC EXCLUDE_FROM_ALL - UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h - UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h - UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h - UESaveFile/Serialisers/ArrayPropertySerialiser.h - UESaveFile/Serialisers/ArrayPropertySerialiser.cpp - UESaveFile/Serialisers/BoolPropertySerialiser.h - UESaveFile/Serialisers/BoolPropertySerialiser.cpp - UESaveFile/Serialisers/BytePropertySerialiser.h - UESaveFile/Serialisers/BytePropertySerialiser.cpp - UESaveFile/Serialisers/ColourPropertySerialiser.h - UESaveFile/Serialisers/ColourPropertySerialiser.cpp - UESaveFile/Serialisers/DateTimePropertySerialiser.h - UESaveFile/Serialisers/DateTimePropertySerialiser.cpp - UESaveFile/Serialisers/EnumPropertySerialiser.h - UESaveFile/Serialisers/EnumPropertySerialiser.cpp - UESaveFile/Serialisers/FloatPropertySerialiser.h - UESaveFile/Serialisers/FloatPropertySerialiser.cpp - UESaveFile/Serialisers/GuidPropertySerialiser.h - UESaveFile/Serialisers/GuidPropertySerialiser.cpp - UESaveFile/Serialisers/IntPropertySerialiser.h - UESaveFile/Serialisers/IntPropertySerialiser.cpp - UESaveFile/Serialisers/MapPropertySerialiser.h - UESaveFile/Serialisers/MapPropertySerialiser.cpp - UESaveFile/Serialisers/ResourcePropertySerialiser.h - UESaveFile/Serialisers/ResourcePropertySerialiser.cpp - UESaveFile/Serialisers/RotatorPropertySerialiser.h - UESaveFile/Serialisers/RotatorPropertySerialiser.cpp - UESaveFile/Serialisers/StringPropertySerialiser.h - UESaveFile/Serialisers/StringPropertySerialiser.cpp - UESaveFile/Serialisers/SetPropertySerialiser.h - UESaveFile/Serialisers/SetPropertySerialiser.cpp - UESaveFile/Serialisers/StructSerialiser.h - UESaveFile/Serialisers/StructSerialiser.cpp - UESaveFile/Serialisers/TextPropertySerialiser.h - UESaveFile/Serialisers/TextPropertySerialiser.cpp - UESaveFile/Serialisers/UnrealPropertySerialiser.h - UESaveFile/Serialisers/VectorPropertySerialiser.h - UESaveFile/Serialisers/VectorPropertySerialiser.cpp - UESaveFile/Serialisers/Vector2DPropertySerialiser.h - UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp - - UESaveFile/Types/ArrayProperty.h - UESaveFile/Types/BoolProperty.h - UESaveFile/Types/ByteProperty.h - UESaveFile/Types/ColourStructProperty.h - UESaveFile/Types/DateTimeStructProperty.h - UESaveFile/Types/EnumProperty.h - UESaveFile/Types/FloatProperty.h - UESaveFile/Types/GenericStructProperty.h - UESaveFile/Types/GuidStructProperty.h - UESaveFile/Types/IntProperty.h - UESaveFile/Types/MapProperty.h - UESaveFile/Types/NoneProperty.h - UESaveFile/Types/RotatorStructProperty.h - UESaveFile/Types/SetProperty.h - UESaveFile/Types/StringProperty.h - UESaveFile/Types/StructProperty.h - UESaveFile/Types/ResourceItemValue.h - UESaveFile/Types/TextProperty.h - UESaveFile/Types/UnrealProperty.h - UESaveFile/Types/UnrealPropertyBase.h - UESaveFile/Types/VectorStructProperty.h - - UESaveFile/Debug.h - UESaveFile/Debug.cpp - UESaveFile/UESaveFile.h - UESaveFile/UESaveFile.cpp - UESaveFile/BinaryReader.h - UESaveFile/BinaryReader.cpp - UESaveFile/BinaryWriter.h - UESaveFile/BinaryWriter.cpp - UESaveFile/PropertySerialiser.h - UESaveFile/PropertySerialiser.cpp -) - -target_link_libraries(UESaveFile PRIVATE - Corrade::Containers - Corrade::Utility - Magnum::Magnum - Logger -) +add_subdirectory(Logger EXCLUDE_FROM_ALL) +add_subdirectory(UESaveFile EXCLUDE_FROM_ALL) add_executable(MassBuilderSaveTool WIN32 main.cpp diff --git a/src/Logger/CMakeLists.txt b/src/Logger/CMakeLists.txt new file mode 100644 index 0000000..d26eb1d --- /dev/null +++ b/src/Logger/CMakeLists.txt @@ -0,0 +1,28 @@ +# MassBuilderSaveTool +# Copyright (C) 2021-2022 Guillaume Jacquemin +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +add_library(Logger STATIC EXCLUDE_FROM_ALL + Logger.h + Logger.cpp + EntryType.h + MagnumLogBuffer.h + MagnumLogBuffer.cpp +) + +target_link_libraries(Logger PRIVATE + Corrade::Utility + Magnum::Magnum +) diff --git a/src/UESaveFile/CMakeLists.txt b/src/UESaveFile/CMakeLists.txt new file mode 100644 index 0000000..97c036c --- /dev/null +++ b/src/UESaveFile/CMakeLists.txt @@ -0,0 +1,98 @@ +# MassBuilderSaveTool +# Copyright (C) 2021-2022 Guillaume Jacquemin +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +add_library(UESaveFile STATIC EXCLUDE_FROM_ALL + Serialisers/AbstractUnrealCollectionPropertySerialiser.h + Serialisers/AbstractUnrealPropertySerialiser.h + Serialisers/AbstractUnrealStructSerialiser.h + Serialisers/ArrayPropertySerialiser.h + Serialisers/ArrayPropertySerialiser.cpp + Serialisers/BoolPropertySerialiser.h + Serialisers/BoolPropertySerialiser.cpp + Serialisers/BytePropertySerialiser.h + Serialisers/BytePropertySerialiser.cpp + Serialisers/ColourPropertySerialiser.h + Serialisers/ColourPropertySerialiser.cpp + Serialisers/DateTimePropertySerialiser.h + Serialisers/DateTimePropertySerialiser.cpp + Serialisers/EnumPropertySerialiser.h + Serialisers/EnumPropertySerialiser.cpp + Serialisers/FloatPropertySerialiser.h + Serialisers/FloatPropertySerialiser.cpp + Serialisers/GuidPropertySerialiser.h + Serialisers/GuidPropertySerialiser.cpp + Serialisers/IntPropertySerialiser.h + Serialisers/IntPropertySerialiser.cpp + Serialisers/MapPropertySerialiser.h + Serialisers/MapPropertySerialiser.cpp + Serialisers/ResourcePropertySerialiser.h + Serialisers/ResourcePropertySerialiser.cpp + Serialisers/RotatorPropertySerialiser.h + Serialisers/RotatorPropertySerialiser.cpp + Serialisers/StringPropertySerialiser.h + Serialisers/StringPropertySerialiser.cpp + Serialisers/SetPropertySerialiser.h + Serialisers/SetPropertySerialiser.cpp + Serialisers/StructSerialiser.h + Serialisers/StructSerialiser.cpp + Serialisers/TextPropertySerialiser.h + Serialisers/TextPropertySerialiser.cpp + Serialisers/UnrealPropertySerialiser.h + Serialisers/VectorPropertySerialiser.h + Serialisers/VectorPropertySerialiser.cpp + Serialisers/Vector2DPropertySerialiser.h + Serialisers/Vector2DPropertySerialiser.cpp + + Types/ArrayProperty.h + Types/BoolProperty.h + Types/ByteProperty.h + Types/ColourStructProperty.h + Types/DateTimeStructProperty.h + Types/EnumProperty.h + Types/FloatProperty.h + Types/GenericStructProperty.h + Types/GuidStructProperty.h + Types/IntProperty.h + Types/MapProperty.h + Types/NoneProperty.h + Types/RotatorStructProperty.h + Types/SetProperty.h + Types/StringProperty.h + Types/StructProperty.h + Types/ResourceItemValue.h + Types/TextProperty.h + Types/UnrealProperty.h + Types/UnrealPropertyBase.h + Types/VectorStructProperty.h + + Debug.h + Debug.cpp + UESaveFile.h + UESaveFile.cpp + BinaryReader.h + BinaryReader.cpp + BinaryWriter.h + BinaryWriter.cpp + PropertySerialiser.h + PropertySerialiser.cpp +) + +target_link_libraries(UESaveFile PRIVATE + Corrade::Containers + Corrade::Utility + Magnum::Magnum + Logger +) -- 2.39.5 From c3453ebfc7dfafc564003d6039675828a626935e Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 27 Aug 2023 15:54:06 +0200 Subject: [PATCH 011/126] Update most dependencies. I'll update SDL2 separately. --- third-party/corrade | 2 +- third-party/curl | 2 +- third-party/efsw | 2 +- third-party/imgui | 2 +- third-party/magnum | 2 +- third-party/magnum-integration | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/third-party/corrade b/third-party/corrade index 41b2e25..183b375 160000 --- a/third-party/corrade +++ b/third-party/corrade @@ -1 +1 @@ -Subproject commit 41b2e250b7e1e09c2ed057f079617e3d77393c47 +Subproject commit 183b375b73fa3e819a6b41dbcc0cf2f06773d2b4 diff --git a/third-party/curl b/third-party/curl index 280cbee..864090c 160000 --- a/third-party/curl +++ b/third-party/curl @@ -1 +1 @@ -Subproject commit 280cbeee2789749fa9b2267ce7a07813645897de +Subproject commit 864090ca39c3c9fe994104ed23d29c37caa61a8e diff --git a/third-party/efsw b/third-party/efsw index f3914e4..19398b8 160000 --- a/third-party/efsw +++ b/third-party/efsw @@ -1 +1 @@ -Subproject commit f3914e475cc8cec461ac05060470c6510ee81246 +Subproject commit 19398b80bc5161b9a890035d1de47244165c2f17 diff --git a/third-party/imgui b/third-party/imgui index a8df192..f617fe7 160000 --- a/third-party/imgui +++ b/third-party/imgui @@ -1 +1 @@ -Subproject commit a8df192df022ed6ac447e7b7ada718c4c4824b41 +Subproject commit f617fe7890f78bc300e7a068a1c2acc9e9ce1e97 diff --git a/third-party/magnum b/third-party/magnum index a496029..0d31f74 160000 --- a/third-party/magnum +++ b/third-party/magnum @@ -1 +1 @@ -Subproject commit a49602987499379e4a2d155472961d99ddfc75ba +Subproject commit 0d31f7461b31698ea5bf92ec66ff5056a6ad7360 diff --git a/third-party/magnum-integration b/third-party/magnum-integration index 883bd0c..35c05fd 160000 --- a/third-party/magnum-integration +++ b/third-party/magnum-integration @@ -1 +1 @@ -Subproject commit 883bd0cb6e00172b6fca34ff8cc4bc70bc302637 +Subproject commit 35c05fda3e243b696e2b3a3dcd230c819ca108e0 -- 2.39.5 From eef4c72d3dd21d176428cefece66228bc7b76f0b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 27 Aug 2023 21:40:45 +0200 Subject: [PATCH 012/126] Update SDL2 to latest version. The .gitmodules file was also updated so that future submodule updates will track the SDL2 branch from the repo. This will prevent updates from accidentally checking out SDL3. --- .gitmodules | 2 +- third-party/SDL | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index e4ea8a8..a4d5f8f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -17,7 +17,7 @@ [submodule "SDL2"] path = third-party/SDL url = https://github.com/libsdl-org/SDL - branch = main + branch = SDL2 [submodule "libzip"] path = third-party/libzip url = https://github.com/nih-at/libzip diff --git a/third-party/SDL b/third-party/SDL index 0bfeed0..f032e8c 160000 --- a/third-party/SDL +++ b/third-party/SDL @@ -1 +1 @@ -Subproject commit 0bfeed061b10ea7dd37c88d9bae1824bad760f3a +Subproject commit f032e8c19165aeee6f9b47e82fb56809d4aeae1e -- 2.39.5 From 245b7415906af732e123ee6dcdf16ee38880280f Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 27 Aug 2023 21:51:16 +0200 Subject: [PATCH 013/126] CMakeLists: remove a duplicated variable. Additionally, I started signing my commits with my SSH key, starting with the previous one (eef4c72d3d). That was long overdue. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ae29bf..9ec823a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -101,7 +101,6 @@ add_subdirectory(third-party/efsw EXCLUDE_FROM_ALL) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE) -set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(ENABLE_UNICODE ON CACHE BOOL "" FORCE) set(ENABLE_INET_PTON OFF CACHE BOOL "" FORCE) set(ENABLE_DEBUG OFF CACHE BOOL "" FORCE) -- 2.39.5 From abac0570a442624fa72a00433b67324857ba1422 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 27 Aug 2023 21:56:06 +0200 Subject: [PATCH 014/126] CMakeLists: WHY IS THIS COMMAND SCREAMING ? --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ec823a..e239333 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ project(MassBuilderSaveTool) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH}) -SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) +set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE) -- 2.39.5 From 1af948fe035b4ed7b1fb378d98d1aea2a2a5d886 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 27 Aug 2023 21:58:14 +0200 Subject: [PATCH 015/126] CMakeLists: add potential support for MSVC. I won't provide actual support for it because MSVC sucks, but if someone wants to use it or Clang-cl, now they can. --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e239333..47f6ce9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,9 @@ project(MassBuilderSaveTool) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH}) -set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) +if(MINGW) + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # This _shouldn't_ be needed, but, anything's possible... +endif() set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE) -- 2.39.5 From e9ce919fd092e54aa4570d39adc4bd2199d41536 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 27 Aug 2023 22:31:54 +0200 Subject: [PATCH 016/126] CMakeLists: allow using system libs. This should be useful for some setups, like my current one (see #31's opening message). --- CMakeLists.txt | 176 +++++++++++++++++++++++++------------------------ 1 file changed, 91 insertions(+), 85 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47f6ce9..d69cd1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,97 +23,103 @@ if(MINGW) set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # This _shouldn't_ be needed, but, anything's possible... endif() -set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) -set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE) -set(CORRADE_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) -set(CORRADE_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE) -set(CORRADE_BUILD_TESTS OFF CACHE BOOL "" FORCE) -set(CORRADE_WITH_INTERCONNECT OFF CACHE BOOL "" FORCE) -set(CORRADE_WITH_PLUGINMANAGER OFF CACHE BOOL "" FORCE) -set(CORRADE_WITH_TESTSUITE OFF CACHE BOOL "" FORCE) -set(CORRADE_WITH_MAIN ON CACHE BOOL "" FORCE) -set(CORRADE_UTILITY_USE_ANSI_COLORS ON CACHE BOOL "" FORCE) -add_subdirectory(third-party/corrade EXCLUDE_FROM_ALL) +option(SAVETOOL_USE_SYSTEM_LIBS "Use system-wide versions of the dependencies instead of the versions provided by submodules." OFF) -set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) -set(DIRECTX OFF CACHE BOOL "" FORCE) # We use OpenGL. -set(SDL_ATOMIC OFF CACHE BOOL "" FORCE) -set(SDL_CPUINFO OFF CACHE BOOL "" FORCE) -set(SDL_EVENTS ON CACHE BOOL "" FORCE) -set(SDL_FILE OFF CACHE BOOL "" FORCE) -set(SDL_FILESYSTEM OFF CACHE BOOL "" FORCE) -set(SDL_HAPTIC OFF CACHE BOOL "" FORCE) -set(SDL_LOCALE OFF CACHE BOOL "" FORCE) -set(SDL_POWER OFF CACHE BOOL "" FORCE) -set(SDL_RENDER OFF CACHE BOOL "" FORCE) -set(SDL_SENSOR OFF CACHE BOOL "" FORCE) -set(SDL_THREADS ON CACHE BOOL "" FORCE) -set(SDL_TIMERS ON CACHE BOOL "" FORCE) -set(SDL_SHARED OFF CACHE BOOL "" FORCE) -add_subdirectory(third-party/SDL EXCLUDE_FROM_ALL) +if(SAVETOOL_USE_SYSTEM_LIBS) + # Generic variables shared by multiple libs that don't provide their own. + set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + set(BUILD_TESTING OFF CACHE BOOL "" FORCE) -set(MAGNUM_BUILD_STATIC ON CACHE BOOL "" FORCE) -set(MAGNUM_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) -set(MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE) -set(MAGNUM_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) -set(MAGNUM_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) + set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE) + set(CORRADE_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) + set(CORRADE_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE) + set(CORRADE_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_INTERCONNECT OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_PLUGINMANAGER OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_TESTSUITE OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_MAIN ON CACHE BOOL "" FORCE) + set(CORRADE_UTILITY_USE_ANSI_COLORS ON CACHE BOOL "" FORCE) + add_subdirectory(third-party/corrade EXCLUDE_FROM_ALL) -set(MAGNUM_TARGET_GL ON CACHE BOOL "" FORCE) -set(MAGNUM_TARGET_GLES OFF CACHE BOOL "" FORCE) -set(MAGNUM_TARGET_VK OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_AUDIO OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_DEBUGTOOLS OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_GL ON CACHE BOOL "" FORCE) -set(MAGNUM_WITH_MATERIALTOOLS OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_MESHTOOLS OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_PRIMITIVES OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_SCENEGRAPH OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_SCENETOOLS OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_SHADERS ON CACHE BOOL "" FORCE) -set(MAGNUM_WITH_SHADERTOOLS OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_TEXT OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_TEXTURETOOLS OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_TRADE OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_VK OFF CACHE BOOL "" FORCE) -set(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE) -add_subdirectory(third-party/magnum EXCLUDE_FROM_ALL) + set(DIRECTX OFF CACHE BOOL "" FORCE) # We use OpenGL. + set(SDL_ATOMIC OFF CACHE BOOL "" FORCE) + set(SDL_CPUINFO OFF CACHE BOOL "" FORCE) + set(SDL_EVENTS ON CACHE BOOL "" FORCE) + set(SDL_FILE OFF CACHE BOOL "" FORCE) + set(SDL_FILESYSTEM OFF CACHE BOOL "" FORCE) + set(SDL_HAPTIC OFF CACHE BOOL "" FORCE) + set(SDL_LOCALE OFF CACHE BOOL "" FORCE) + set(SDL_POWER OFF CACHE BOOL "" FORCE) + set(SDL_RENDER OFF CACHE BOOL "" FORCE) + set(SDL_SENSOR OFF CACHE BOOL "" FORCE) + set(SDL_THREADS ON CACHE BOOL "" FORCE) + set(SDL_TIMERS ON CACHE BOOL "" FORCE) + set(SDL_SHARED OFF CACHE BOOL "" FORCE) + add_subdirectory(third-party/SDL EXCLUDE_FROM_ALL) -set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party/imgui) -set(MAGNUM_WITH_IMGUI ON CACHE BOOL "" FORCE) -add_subdirectory(third-party/magnum-integration EXCLUDE_FROM_ALL) + set(MAGNUM_BUILD_STATIC ON CACHE BOOL "" FORCE) + set(MAGNUM_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) + set(MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE) + set(MAGNUM_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) + set(MAGNUM_BUILD_TESTS OFF CACHE BOOL "" FORCE) -set(ENABLE_COMMONCRYPTO OFF CACHE BOOL "" FORCE) -set(ENABLE_GNUTLS OFF CACHE BOOL "" FORCE) -set(ENABLE_MBEDTLS OFF CACHE BOOL "" FORCE) -set(ENABLE_OPENSSL OFF CACHE BOOL "" FORCE) -set(ENABLE_WINDOWS_CRYPTO OFF CACHE BOOL "" FORCE) -set(ENABLE_BZIP2 OFF CACHE BOOL "" FORCE) -set(ENABLE_LZMA OFF CACHE BOOL "" FORCE) -set(ENABLE_ZSTD OFF CACHE BOOL "" FORCE) -set(BUILD_TOOLS OFF CACHE BOOL "" FORCE) -set(BUILD_REGRESS OFF CACHE BOOL "" FORCE) -set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) -set(BUILD_DOC OFF CACHE BOOL "" FORCE) -add_subdirectory(third-party/libzip EXCLUDE_FROM_ALL) + set(MAGNUM_TARGET_GL ON CACHE BOOL "" FORCE) + set(MAGNUM_TARGET_GLES OFF CACHE BOOL "" FORCE) + set(MAGNUM_TARGET_VK OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_AUDIO OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_DEBUGTOOLS OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_GL ON CACHE BOOL "" FORCE) + set(MAGNUM_WITH_MATERIALTOOLS OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_MESHTOOLS OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_PRIMITIVES OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_SCENEGRAPH OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_SCENETOOLS OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_SHADERS ON CACHE BOOL "" FORCE) + set(MAGNUM_WITH_SHADERTOOLS OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_TEXT OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_TEXTURETOOLS OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_TRADE OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_VK OFF CACHE BOOL "" FORCE) + set(MAGNUM_WITH_SDL2APPLICATION ON CACHE BOOL "" FORCE) + add_subdirectory(third-party/magnum EXCLUDE_FROM_ALL) -set(VERBOSE OFF CACHE BOOL "" FORCE) -set(BUILD_TEST_APP OFF CACHE BOOL "" FORCE) -set(EFSW_INSTALL OFF CACHE BOOL "" FORCE) -add_subdirectory(third-party/efsw EXCLUDE_FROM_ALL) + set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party/imgui) + set(MAGNUM_WITH_IMGUI ON CACHE BOOL "" FORCE) + add_subdirectory(third-party/magnum-integration EXCLUDE_FROM_ALL) -set(BUILD_TESTING OFF CACHE BOOL "" FORCE) -set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE) -set(ENABLE_UNICODE ON CACHE BOOL "" FORCE) -set(ENABLE_INET_PTON OFF CACHE BOOL "" FORCE) -set(ENABLE_DEBUG OFF CACHE BOOL "" FORCE) -set(ENABLE_THREADED_RESOLVER OFF CACHE BOOL "" FORCE) -set(HTTP_ONLY ON CACHE BOOL "" FORCE) -set(USE_LIBIDN2 OFF CACHE BOOL "" FORCE) -set(USE_WIN32_IDN ON CACHE BOOL "" FORCE) -set(CURL_USE_LIBPSL OFF CACHE BOOL "" FORCE) -set(CURL_STATIC_CRT OFF CACHE BOOL "" FORCE) -set(CURL_USE_SCHANNEL ON CACHE BOOL "" FORCE) -set(CURL_USE_LIBSSH2 OFF CACHE BOOL "" FORCE) # For some reason, even when HTTP_ONLY is set to ON, libcurl will try to link to libssh2. -add_subdirectory(third-party/curl EXCLUDE_FROM_ALL) + set(ENABLE_COMMONCRYPTO OFF CACHE BOOL "" FORCE) + set(ENABLE_GNUTLS OFF CACHE BOOL "" FORCE) + set(ENABLE_MBEDTLS OFF CACHE BOOL "" FORCE) + set(ENABLE_OPENSSL OFF CACHE BOOL "" FORCE) + set(ENABLE_WINDOWS_CRYPTO OFF CACHE BOOL "" FORCE) + set(ENABLE_BZIP2 OFF CACHE BOOL "" FORCE) + set(ENABLE_LZMA OFF CACHE BOOL "" FORCE) + set(ENABLE_ZSTD OFF CACHE BOOL "" FORCE) + set(BUILD_TOOLS OFF CACHE BOOL "" FORCE) + set(BUILD_REGRESS OFF CACHE BOOL "" FORCE) + set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + set(BUILD_DOC OFF CACHE BOOL "" FORCE) + add_subdirectory(third-party/libzip EXCLUDE_FROM_ALL) + + set(VERBOSE OFF CACHE BOOL "" FORCE) + set(BUILD_TEST_APP OFF CACHE BOOL "" FORCE) + set(EFSW_INSTALL OFF CACHE BOOL "" FORCE) + add_subdirectory(third-party/efsw EXCLUDE_FROM_ALL) + + set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE) + set(ENABLE_UNICODE ON CACHE BOOL "" FORCE) + set(ENABLE_INET_PTON OFF CACHE BOOL "" FORCE) + set(ENABLE_DEBUG OFF CACHE BOOL "" FORCE) + set(ENABLE_THREADED_RESOLVER OFF CACHE BOOL "" FORCE) + set(HTTP_ONLY ON CACHE BOOL "" FORCE) + set(USE_LIBIDN2 OFF CACHE BOOL "" FORCE) + set(USE_WIN32_IDN ON CACHE BOOL "" FORCE) + set(CURL_USE_LIBPSL OFF CACHE BOOL "" FORCE) + set(CURL_STATIC_CRT OFF CACHE BOOL "" FORCE) + set(CURL_USE_SCHANNEL ON CACHE BOOL "" FORCE) + set(CURL_USE_LIBSSH2 OFF CACHE BOOL "" FORCE) # For some reason, even when HTTP_ONLY is set to ON, libcurl will try to link to libssh2. + add_subdirectory(third-party/curl EXCLUDE_FROM_ALL) +endif(SAVETOOL_USE_SYSTEM_LIBS) add_subdirectory(src) -- 2.39.5 From 9f8c8191cacdcafd46924a23720f6de228d31ecc Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 13:10:41 +0200 Subject: [PATCH 017/126] CMakeLists: fix a condition. Submodules should _not_ be used when using system libs, after all. Derp. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d69cd1d..8f06cac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,7 @@ endif() option(SAVETOOL_USE_SYSTEM_LIBS "Use system-wide versions of the dependencies instead of the versions provided by submodules." OFF) -if(SAVETOOL_USE_SYSTEM_LIBS) +if(NOT SAVETOOL_USE_SYSTEM_LIBS) # Generic variables shared by multiple libs that don't provide their own. set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) @@ -120,6 +120,6 @@ if(SAVETOOL_USE_SYSTEM_LIBS) set(CURL_USE_SCHANNEL ON CACHE BOOL "" FORCE) set(CURL_USE_LIBSSH2 OFF CACHE BOOL "" FORCE) # For some reason, even when HTTP_ONLY is set to ON, libcurl will try to link to libssh2. add_subdirectory(third-party/curl EXCLUDE_FROM_ALL) -endif(SAVETOOL_USE_SYSTEM_LIBS) +endif(NOT SAVETOOL_USE_SYSTEM_LIBS) add_subdirectory(src) -- 2.39.5 From 4e98a89b9d5c9b1ff82c9648bdb67f66d5a25b1f Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 13:14:00 +0200 Subject: [PATCH 018/126] CMakeLists: add a better way to force static zlib. This requires a minimum CMake version bump, but most systems should have access to 3.24 by now, as it was released last year. --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f06cac..59945a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,14 +14,12 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -cmake_minimum_required(VERSION 3.5) +cmake_minimum_required(VERSION 3.24) project(MassBuilderSaveTool) set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/modules/" ${CMAKE_MODULE_PATH}) -if(MINGW) - set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) # This _shouldn't_ be needed, but, anything's possible... -endif() +set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "" FORCE) # Required on setups where zlib is available as both dynamic and static libs. Which is pretty much everywhere, actually. option(SAVETOOL_USE_SYSTEM_LIBS "Use system-wide versions of the dependencies instead of the versions provided by submodules." OFF) -- 2.39.5 From 4b3912f6ef467b878cd8db78a0edc14aaec8ddb2 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 13:17:54 +0200 Subject: [PATCH 019/126] src/CMakeLists: change how deps are linked to. This might break submodule builds on MSYS2. Not like I care anyway, as they were already broken on my Arch rig. --- src/CMakeLists.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9022e66..821544f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,6 +23,9 @@ set(SAVETOOL_PROJECT_VERSION 1.5.0-pre) find_package(Corrade REQUIRED Main Containers Utility) find_package(Magnum REQUIRED GL Sdl2Application) find_package(MagnumIntegration REQUIRED ImGui) +find_package(CURL REQUIRED HTTPS) +find_package(libzip REQUIRED) +find_package(efsw REQUIRED) set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) @@ -124,9 +127,9 @@ target_link_libraries(MassBuilderSaveTool PRIVATE MagnumIntegration::ImGui Logger UESaveFile - efsw - zip - libcurl + efsw::efsw + libzip::zip + CURL::libcurl_static imm32 wtsapi32 ) -- 2.39.5 From 39d71a7a0998027104faa40264c7cc75b8e76e66 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 13:32:06 +0200 Subject: [PATCH 020/126] SaveTool: remove licences for third-party deps. This should thin the exe up a bit. --- src/SaveTool/SaveTool_drawAbout.cpp | 56 ----------------------------- src/assets.conf | 28 --------------- 2 files changed, 84 deletions(-) diff --git a/src/SaveTool/SaveTool_drawAbout.cpp b/src/SaveTool/SaveTool_drawAbout.cpp index 9c1927f..3f1cb92 100644 --- a/src/SaveTool/SaveTool_drawAbout.cpp +++ b/src/SaveTool/SaveTool_drawAbout.cpp @@ -115,14 +115,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: MIT"); - static auto corrade_licence = _rs.getRaw("COPYING.Corrade"); - if(ImGui::BeginChild("##CorradeLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(corrade_licence.begin(), corrade_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } @@ -143,14 +135,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: MIT"); - static auto magnum_licence = _rs.getRaw("COPYING.Magnum"); - if(ImGui::BeginChild("##MagnumLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(magnum_licence.begin(), magnum_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } @@ -169,14 +153,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: MIT"); - static auto imgui_licence = _rs.getRaw("LICENSE.ImGui"); - if(ImGui::BeginChild("##ImGuiLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(imgui_licence.begin(), imgui_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } @@ -195,14 +171,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: zlib"); - static auto sdl_licence = _rs.getRaw("LICENSE.SDL"); - if(ImGui::BeginChild("##SDLLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(sdl_licence.begin(), sdl_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } @@ -221,14 +189,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: 3-clause BSD"); - static auto libzip_licence = _rs.getRaw("LICENSE.libzip"); - if(ImGui::BeginChild("##libzipLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(libzip_licence.begin(), libzip_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } @@ -246,14 +206,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: MIT"); - static auto efsw_licence = _rs.getRaw("LICENSE.efsw"); - if(ImGui::BeginChild("##efswLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(efsw_licence.begin(), efsw_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } @@ -272,14 +224,6 @@ SaveTool::drawAbout() { ImGui::TextUnformatted("Licence: MIT/X derivative"); - static auto curl_licence = _rs.getRaw("LICENSE.curl"); - if(ImGui::BeginChild("##libcurlLicence", {0.0f, float(windowSize().y()) * 0.3f}, true)) { - ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(curl_licence.begin(), curl_licence.end()); - ImGui::PopFont(); - } - ImGui::EndChild(); - ImGui::TreePop(); } diff --git a/src/assets.conf b/src/assets.conf index 212724e..e0035cc 100644 --- a/src/assets.conf +++ b/src/assets.conf @@ -19,31 +19,3 @@ alias=fa-brands-400.ttf [file] filename=../COPYING alias=COPYING - -[file] -filename=../third-party/corrade/COPYING -alias=COPYING.Corrade - -[file] -filename=../third-party/magnum/COPYING -alias=COPYING.Magnum - -[file] -filename=../third-party/imgui/LICENSE.txt -alias=LICENSE.ImGui - -[file] -filename=../third-party/SDL/LICENSE.txt -alias=LICENSE.SDL - -[file] -filename=../third-party/libzip/LICENSE -alias=LICENSE.libzip - -[file] -filename=../third-party/efsw/LICENSE -alias=LICENSE.efsw - -[file] -filename=../third-party/curl/COPYING -alias=LICENSE.curl -- 2.39.5 From 81430de34557eb8679dd9408a77e82207d76c575 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 13:51:32 +0200 Subject: [PATCH 021/126] main: support running the app in Wine/Proton. Turns out the flag I used for SHGetKnownFolderPath() is not only deprecated starting with Win10 1703, but it also isn't implemented in Wine. It also was completely useless because the Save Tool isn't a "packaged process", as the docs call it. Ah, the joys of using WinAPI... --- src/SaveTool/SaveTool_Initialisation.cpp | 12 ++++++++++-- src/main.cpp | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/SaveTool/SaveTool_Initialisation.cpp index e14bb2b..ba0441a 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/SaveTool/SaveTool_Initialisation.cpp @@ -198,9 +198,17 @@ SaveTool::findGameDataDirectory() -> bool { wchar_t* localappdata_path = nullptr; Containers::ScopeGuard guard{localappdata_path, CoTaskMemFree}; - if(SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_NO_APPCONTAINER_REDIRECTION, nullptr, &localappdata_path) != S_OK) + auto result = SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr, &localappdata_path); + if(result != S_OK) { - _lastError = Utility::format("SHGetKnownFolderPath() failed with error code {}.", GetLastError()); + char* message_buffer = nullptr; + auto size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + nullptr, result, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + reinterpret_cast(&message_buffer), 0, nullptr); + String message{message_buffer, size}; + LocalFree(message_buffer); + + _lastError = Utility::format("SHGetKnownFolderPath() failed with error code {}: {}", result, message); LOG_ERROR(_lastError); return false; } diff --git a/src/main.cpp b/src/main.cpp index 20e1be1..13e958c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,7 +45,7 @@ int main(int argc, char** argv) { Containers::StringView locale{str}; LOG_INFO_FORMAT("Current locale: {}", locale); - if(!locale.hasSuffix(".utf8")) { + if(!locale.hasSuffix(".utf8") && !locale.hasSuffix(".65001")) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", "Your system doesn't support UTF-8.", nullptr); return EXIT_FAILURE; -- 2.39.5 From 3fc9243c81a67f21fdbbda3df19a3d9119653b91 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 15:46:13 +0200 Subject: [PATCH 022/126] Logger: also output to a file in debug mode. CLion can't grab stdout on Wine/Proton, so this is the only way to get any kind of output there. --- src/Logger/Logger.cpp | 28 ++++++++++------------------ src/Logger/Logger.h | 6 +----- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 7ae0f9d..3758e44 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -16,7 +16,10 @@ #include +#include +#include #include +#include #include "Logger.h" @@ -33,12 +36,13 @@ Logger::instance() { void Logger::initialise() { + auto exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first(); + _logFile.open(Utility::Path::join(exe_path, "SaveToolLog.txt").cbegin(), std::ios::trunc); #ifndef SAVETOOL_DEBUG_BUILD - _logFile.open("SaveToolLog.txt", std::ios::trunc); _logFile << "In case you encounter a bug:\n" << "1. Do not run the Save Tool again, as this log will be cleared.\n" << "2. Go to either the official Sekai Project Discord guild, or the community M.A.S.S. Builder one.\n" << - "3. Mention me (William JCM#2301) to get my attention, with a description of the bug.\n" + "3. Mention me (@williamjcm) to get my attention, with a description of the bug.\n" " Please include as many details as possible, I don't want to play \"20 questions\", and neither do you.\n" << "4. Send me this file _when I ask for it_, preferably in DMs.\n" << std::endl; @@ -59,31 +63,19 @@ Logger::unindent() { void Logger::log(EntryType type, StringView location, StringView message) { - Debug d{ - #ifndef SAVETOOL_DEBUG_BUILD - &_logFile - #else - &std::cout - #endif - }; + Debug d{&_logFile}; - #ifdef SAVETOOL_DEBUG_BUILD - #define COLOURED_TEXT(colour, text) Debug::color(Debug::Color::colour) << (text) << Debug::resetColor - #else - #define COLOURED_TEXT(colour, text) (text) - #endif switch(type) { case EntryType::Info: - d << COLOURED_TEXT(Default, "[ INFO]"_s); + d << "[ INFO]"_s; break; case EntryType::Warning: - d << COLOURED_TEXT(Yellow, "[WARNING]"_s); + d << "[WARNING]"_s; break; case EntryType::Error: - d << COLOURED_TEXT(Red, "[ ERROR]"_s); + d << "[ ERROR]"_s; break; } - #undef COLOURED_TEXT d << "["_s << Debug::nospace << location << Debug::nospace << "]"; diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index 9bb793b..ef35418 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -18,10 +18,8 @@ #include -#include -#ifndef SAVETOOL_DEBUG_BUILD #include -#endif +#include #include #include @@ -60,9 +58,7 @@ class Logger { private: Logger() = default; - #ifndef SAVETOOL_DEBUG_BUILD std::ofstream _logFile; - #endif std::uint32_t _indentLevel = 0; -- 2.39.5 From ecdf7d736fac5c0709341df3f2862b9a86db530d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 28 Aug 2023 15:47:39 +0200 Subject: [PATCH 023/126] SaveTool: add a TODO for later. --- src/SaveTool/SaveTool.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 8ba92ee..7d2a009 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -431,6 +431,8 @@ SaveTool::drawCheckbox(Containers::StringView label, bool value) { void SaveTool::openUri(Containers::StringView uri) { ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri.data()), nullptr, nullptr, SW_SHOWDEFAULT); + // TODO: have it open folders through winebrowser.exe when running using Wine/Proton. + // URLs like Discord invites or Steam Browser Protocol links should be disabled entirely there. } void -- 2.39.5 From a1a155d0ac722b683c15d18e736d5f239a4751d8 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 31 Aug 2023 11:52:52 +0200 Subject: [PATCH 024/126] Update CMake Find* modules. --- modules/FindCorrade.cmake | 60 +++++++---- modules/FindImGui.cmake | 2 +- modules/FindMagnum.cmake | 152 ++++++++++++++++------------ modules/FindMagnumIntegration.cmake | 4 +- modules/FindSDL2.cmake | 6 +- 5 files changed, 132 insertions(+), 92 deletions(-) diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index 780932b..d7806e0 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -16,6 +16,8 @@ # components, which are: # # Containers - Containers library +# Interconnect - Interconnect library +# Main - Main library # PluginManager - PluginManager library # TestSuite - TestSuite library # Utility - Utility library @@ -68,7 +70,7 @@ # mode for MSVC 2017 # CORRADE_MSVC2015_COMPATIBILITY - Defined if compiled with compatibility # mode for MSVC 2015 -# CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated APIs +# CORRADE_BUILD_DEPRECATED - Defined if compiled with deprecated features # included # CORRADE_BUILD_STATIC - Defined if compiled as static libraries. # Default are shared libraries. @@ -78,6 +80,9 @@ # CORRADE_BUILD_MULTITHREADED - Defined if compiled in a way that makes it # possible to safely use certain Corrade features simultaneously in multiple # threads +# CORRADE_BUILD_CPU_RUNTIME_DISPATCH - Defined if built with code paths +# optimized for multiple architectres with the best matching variant selected +# at runtime based on detected CPU features # CORRADE_TARGET_UNIX - Defined if compiled for some Unix flavor # (Linux, BSD, macOS) # CORRADE_TARGET_APPLE - Defined if compiled for Apple platforms @@ -98,6 +103,8 @@ # CORRADE_TARGET_MSVC - Defined if compiling with MSVC or Clang with # a MSVC frontend # CORRADE_TARGET_MINGW - Defined if compiling under MinGW +# CORRADE_CPU_USE_IFUNC - Defined if GNU IFUNC is allowed to be used +# for runtime dispatch in the Cpu library # CORRADE_PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT - Defined if PluginManager # doesn't support dynamic plugin loading due to platform limitations # CORRADE_TESTSUITE_TARGET_XCTEST - Defined if TestSuite is targeting Xcode @@ -208,7 +215,7 @@ # # ...) # -# Unline the above version this puts everything into ```` on +# Unlike the above version this puts everything into ```` on # both DLL and non-DLL platforms. If ```` is set to # :variable:`CMAKE_CURRENT_BINARY_DIR` (e.g. for testing purposes), the files # are copied directly, without the need to perform install step. Note that the @@ -264,7 +271,7 @@ # This file is part of Corrade. # # Copyright © 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, -# 2017, 2018, 2019, 2020, 2021, 2022 +# 2017, 2018, 2019, 2020, 2021, 2022, 2023 # Vladimír VondruÅ¡ # # Permission is hereby granted, free of charge, to any person obtaining a @@ -317,6 +324,7 @@ set(_corradeFlags BUILD_STATIC BUILD_STATIC_UNIQUE_GLOBALS BUILD_MULTITHREADED + BUILD_CPU_RUNTIME_DISPATCH TARGET_UNIX TARGET_APPLE TARGET_IOS @@ -325,10 +333,12 @@ set(_corradeFlags TARGET_WINDOWS_RT TARGET_EMSCRIPTEN TARGET_ANDROID - # TARGET_X86 etc and TARGET_LIBCXX are not exposed to CMake as the meaning - # is unclear on platforms with multi-arch binaries or when mixing different - # STL implementations. TARGET_GCC etc are figured out via UseCorrade.cmake, - # as the compiler can be different when compiling the lib & when using it. + # TARGET_X86 etc, TARGET_32BIT, TARGET_BIG_ENDIAN and TARGET_LIBCXX etc. + # are not exposed to CMake as the meaning is unclear on platforms with + # multi-arch binaries or when mixing different STL implementations. + # TARGET_GCC etc are figured out via UseCorrade.cmake, as the compiler can + # be different when compiling the lib & when using it. + CPU_USE_IFUNC PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT TESTSUITE_TARGET_XCTEST UTILITY_USE_ANSI_COLORS) @@ -406,6 +416,8 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) if(TARGET Corrade::${_component}) set(Corrade_${_component}_FOUND TRUE) else() + unset(Corrade_${_component}_FOUND) + # Library (and not header-only) components if(_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND NOT _component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS) add_library(Corrade::${_component} UNKNOWN IMPORTED) @@ -496,25 +508,33 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) elseif(_component STREQUAL PluginManager) # -ldl is handled by Utility now - # TestSuite library has some additional files + # TestSuite library has some additional files. If those are not found, + # set the component _FOUND variable to false so it works properly both + # when the component is required and when it's optional. elseif(_component STREQUAL TestSuite) # XCTest runner file if(CORRADE_TESTSUITE_TARGET_XCTEST) find_file(CORRADE_TESTSUITE_XCTEST_RUNNER XCTestRunner.mm.in PATH_SUFFIXES share/corrade/TestSuite) - set(CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED CORRADE_TESTSUITE_XCTEST_RUNNER) + if(NOT CORRADE_TESTSUITE_XCTEST_RUNNER) + set(Corrade_${_component}_FOUND FALSE) + endif() # ADB runner file elseif(CORRADE_TARGET_ANDROID) find_file(CORRADE_TESTSUITE_ADB_RUNNER AdbRunner.sh PATH_SUFFIXES share/corrade/TestSuite) - set(CORRADE_TESTSUITE_ADB_RUNNER_NEEDED CORRADE_TESTSUITE_ADB_RUNNER) + if(NOT CORRADE_TESTSUITE_ADB_RUNNER) + set(Corrade_${_component}_FOUND FALSE) + endif() # Emscripten runner file elseif(CORRADE_TARGET_EMSCRIPTEN) find_file(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER EmscriptenRunner.html.in PATH_SUFFIXES share/corrade/TestSuite) - set(CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER) + if(NOT CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER) + set(Corrade_${_component}_FOUND FALSE) + endif() endif() # Utility library (contains all setup that is used by others) @@ -559,11 +579,14 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) endforeach() endif() - # Decide if the component was found - if((_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS AND CORRADE_${_COMPONENT}_EXECUTABLE)) - set(Corrade_${_component}_FOUND TRUE) - else() - set(Corrade_${_component}_FOUND FALSE) + # Decide if the component was found, unless the _FOUND is already set + # by something above. + if(NOT DEFINED Corrade_${_component}_FOUND) + if((_component IN_LIST _CORRADE_LIBRARY_COMPONENTS AND _CORRADE_${_COMPONENT}_INCLUDE_DIR AND (_component IN_LIST _CORRADE_HEADER_ONLY_COMPONENTS OR CORRADE_${_COMPONENT}_LIBRARY_RELEASE OR CORRADE_${_COMPONENT}_LIBRARY_DEBUG)) OR (_component IN_LIST _CORRADE_EXECUTABLE_COMPONENTS AND CORRADE_${_COMPONENT}_EXECUTABLE)) + set(Corrade_${_component}_FOUND TRUE) + else() + set(Corrade_${_component}_FOUND FALSE) + endif() endif() endif() endforeach() @@ -590,7 +613,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16) # misleading messages. elseif(NOT _component IN_LIST _CORRADE_IMPLICITLY_ENABLED_COMPONENTS) string(TOUPPER ${_component} _COMPONENT) - list(APPEND _CORRADE_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled WITH_${_COMPONENT} when building Corrade.") + list(APPEND _CORRADE_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled CORRADE_WITH_${_COMPONENT} when building Corrade.") # Otherwise we have no idea. Better be silent than to print something # misleading. else() @@ -606,9 +629,6 @@ find_package_handle_standard_args(Corrade REQUIRED_VARS CORRADE_INCLUDE_DIR _CORRADE_MODULE_DIR _CORRADE_CONFIGURE_FILE - ${CORRADE_TESTSUITE_XCTEST_RUNNER_NEEDED} - ${CORRADE_TESTSUITE_ADB_RUNNER_NEEDED} - ${CORRADE_TESTSUITE_EMSCRIPTEN_RUNNER_NEEDED} HANDLE_COMPONENTS ${_CORRADE_REASON_FAILURE_MESSAGE}) diff --git a/modules/FindImGui.cmake b/modules/FindImGui.cmake index 2bd46c5..0219051 100644 --- a/modules/FindImGui.cmake +++ b/modules/FindImGui.cmake @@ -36,7 +36,7 @@ # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, -# 2020, 2021, 2022 Vladimír VondruÅ¡ +# 2020, 2021, 2022, 2023 Vladimír VondruÅ¡ # Copyright © 2018 Jonathan Hale # # Permission is hereby granted, free of charge, to any person obtaining a diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index caa6999..9fdbd6e 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -57,6 +57,7 @@ # Audio - Audio library # DebugTools - DebugTools library # GL - GL library +# MaterialTools - MaterialTools library # MeshTools - MeshTools library # Primitives - Primitives library # SceneGraph - SceneGraph library @@ -78,7 +79,6 @@ # WindowlessGlxApplication - Windowless GLX application # WindowlessIosApplication - Windowless iOS application # WindowlessWglApplication - Windowless WGL application -# WindowlessWindowsEglApplication - Windowless Windows/EGL application # CglContext - CGL context # EglContext - EGL context # GlxContext - GLX context @@ -128,7 +128,7 @@ # # Features of found Magnum library are exposed in these variables: # -# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated APIs +# MAGNUM_BUILD_DEPRECATED - Defined if compiled with deprecated features # included # MAGNUM_BUILD_STATIC - Defined if compiled as static libraries # MAGNUM_BUILD_STATIC_UNIQUE_GLOBALS - Defined if static libraries keep the @@ -137,10 +137,9 @@ # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES # MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 # MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 -# MAGNUM_TARGET_DESKTOP_GLES - Defined if compiled with OpenGL ES -# emulation on desktop OpenGL # MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL -# MAGNUM_TARGET_HEADLESS - Defined if compiled for headless machines +# MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a +# platform-specific OpenGL support library like CGL, EAGL, GLX or WGL # MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop # # The following variables are provided for backwards compatibility purposes @@ -149,6 +148,10 @@ # # MAGNUM_BUILD_MULTITHREADED - Alias to CORRADE_BUILD_MULTITHREADED. Use # CORRADE_BUILD_MULTITHREADED instead. +# MAGNUM_TARGET_HEADLESS - Alias to MAGNUM_TARGET_EGL, unless on iOS, +# Android, Emscripten or Windows RT. Use MAGNUM_TARGET_EGL instead. +# MAGNUM_TARGET_DESKTOP_GLES` - Defined if compiled for OpenGL ES but +# GLX / WGL is used instead of EGL. Use MAGNUM_TARGET_EGL instead. # # Additionally these variables are defined for internal usage: # @@ -202,7 +205,7 @@ # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, -# 2020, 2021, 2022 Vladimír VondruÅ¡ +# 2020, 2021, 2022, 2023 Vladimír VondruÅ¡ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), @@ -225,16 +228,26 @@ # Corrade library dependencies set(_MAGNUM_CORRADE_DEPENDENCIES ) -foreach(_component ${Magnum_FIND_COMPONENTS}) - string(TOUPPER ${_component} _COMPONENT) +foreach(_magnum_component ${Magnum_FIND_COMPONENTS}) + set(_MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES ) # Unrolling the transitive dependencies here so this doesn't need to be # after resolving inter-component dependencies. Listing also all plugins. - if(_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$") - set(_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES PluginManager) + if(_magnum_component MATCHES "^(Audio|DebugTools|MeshTools|Primitives|SceneTools|ShaderTools|Text|TextureTools|Trade|.+Importer|.+ImageConverter|.+Font|.+ShaderConverter)$") + list(APPEND _MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES PluginManager) + endif() + if(_magnum_component STREQUAL DebugTools) + # DebugTools depends on TestSuite optionally, so if it's not there + # assume it wasn't compiled against it. Also, all variables from the + # FindCorrade module overwrite the local variables here (in particular + # _component, _COMPONENT and such), so we need to prefix extensively. + find_package(Corrade QUIET COMPONENTS TestSuite) + if(Corrade_TestSuite_FOUND) + list(APPEND _MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES TestSuite) + endif() endif() - list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_COMPONENT}_CORRADE_DEPENDENCIES}) + list(APPEND _MAGNUM_CORRADE_DEPENDENCIES ${_MAGNUM_${_magnum_component}_CORRADE_DEPENDENCIES}) endforeach() find_package(Corrade REQUIRED Utility ${_MAGNUM_CORRADE_DEPENDENCIES}) @@ -269,9 +282,8 @@ set(_magnumFlags TARGET_GLES TARGET_GLES2 TARGET_GLES3 - TARGET_DESKTOP_GLES TARGET_WEBGL - TARGET_HEADLESS + TARGET_EGL TARGET_VK) foreach(_magnumFlag ${_magnumFlags}) list(FIND _magnumConfigure "#define MAGNUM_${_magnumFlag}" _magnum_${_magnumFlag}) @@ -280,9 +292,20 @@ foreach(_magnumFlag ${_magnumFlags}) endif() endforeach() -# For compatibility only, to be removed at some point -if(MAGNUM_BUILD_DEPRECATED AND CORRADE_BUILD_MULTITHREADED) - set(MAGNUM_BUILD_MULTITHREADED 1) +# For compatibility only, to be removed at some point. Refer to +# src/Magnum/configure.h.cmake for the decision logic here. +if(MAGNUM_BUILD_DEPRECATED) + if(CORRADE_BUILD_MULTITHREADED) + set(MAGNUM_BUILD_MULTITHREADED 1) + endif() + if(NOT CORRADE_TARGET_IOS AND NOT CORRADE_TARGET_ANDROID AND NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_WINDOWS_RT) + if(NOT MAGNUM_TARGET_GLES AND MAGNUM_TARGET_EGL) + set(MAGNUM_TARGET_HEADLESS 1) + endif() + if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL) + set(MAGNUM_TARGET_DESKTOP_GLES 1) + endif() + endif() endif() # OpenGL library preference. Prefer to use GLVND, since that's the better @@ -355,8 +378,8 @@ endif() # Component distinction (listing them explicitly to avoid mistakes with finding # components from other repositories) set(_MAGNUM_LIBRARY_COMPONENTS - Audio DebugTools GL MeshTools Primitives SceneGraph SceneTools Shaders - ShaderTools Text TextureTools Trade + Audio DebugTools GL MaterialTools MeshTools Primitives SceneGraph + SceneTools Shaders ShaderTools Text TextureTools Trade WindowlessEglApplication EglContext OpenGLTester) set(_MAGNUM_PLUGIN_COMPONENTS AnyAudioImporter AnyImageConverter AnyImageImporter AnySceneConverter @@ -395,7 +418,7 @@ if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE) list(APPEND _MAGNUM_LIBRARY_COMPONENTS GlxApplication XEglApplication WindowlessGlxApplication GlxContext) endif() if(CORRADE_TARGET_WINDOWS) - list(APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext WindowlessWindowsEglApplication) + list(APPEND _MAGNUM_LIBRARY_COMPONENTS WindowlessWglApplication WglContext) endif() if(CORRADE_TARGET_UNIX OR CORRADE_TARGET_WINDOWS) list(APPEND _MAGNUM_EXECUTABLE_COMPONENTS fontconverter distancefieldconverter) @@ -420,30 +443,24 @@ if(MAGNUM_TARGET_GL) set(_MAGNUM_DebugTools_GL_DEPENDENCY_IS_OPTIONAL ON) endif() +set(_MAGNUM_MaterialTools_DEPENDENCIES Trade) + set(_MAGNUM_MeshTools_DEPENDENCIES Trade) if(MAGNUM_TARGET_GL) list(APPEND _MAGNUM_MeshTools_DEPENDENCIES GL) endif() set(_MAGNUM_OpenGLTester_DEPENDENCIES GL) -if(MAGNUM_TARGET_HEADLESS OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID) +if(MAGNUM_TARGET_EGL) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication) elseif(CORRADE_TARGET_IOS) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessIosApplication) -elseif(CORRADE_TARGET_APPLE AND NOT MAGNUM_TARGET_GLES) +elseif(CORRADE_TARGET_APPLE) list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessCglApplication) elseif(CORRADE_TARGET_UNIX) - if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES) - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessEglApplication) - else() - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication) - endif() + list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessGlxApplication) elseif(CORRADE_TARGET_WINDOWS) - if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES) - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication) - else() - list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWindowsEglApplication) - endif() + list(APPEND _MAGNUM_OpenGLTester_DEPENDENCIES WindowlessWglApplication) endif() set(_MAGNUM_Primitives_DEPENDENCIES MeshTools Trade) @@ -492,7 +509,6 @@ set(_MAGNUM_WindowlessEglApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessGlxApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessIosApplication_DEPENDENCIES GL) set(_MAGNUM_WindowlessWglApplication_DEPENDENCIES GL) -set(_MAGNUM_WindowlessWindowsEglApplication_DEPENDENCIES GL) set(_MAGNUM_XEglApplication_DEPENDENCIES GL) set(_MAGNUM_CglContext_DEPENDENCIES GL) set(_MAGNUM_EglContext_DEPENDENCIES GL) @@ -708,16 +724,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # OPENGL_opengl_LIBRARY because that's set even if # OpenGL_GL_PREFERENCE is explicitly set to LEGACY. if(MAGNUM_TARGET_GL) - if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) + if(MAGNUM_TARGET_EGL) + find_package(EGL) + set_property(TARGET Magnum::${_component} APPEND + PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) + elseif(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE) find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX) endif() - elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN) - find_package(EGL) - set_property(TARGET Magnum::${_component} APPEND - PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) endif() endif() @@ -747,16 +763,16 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # OPENGL_opengl_LIBRARY because that's set even if # OpenGL_GL_PREFERENCE is explicitly set to LEGACY. if(MAGNUM_TARGET_GL) - if(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE AND (NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES)) + if(MAGNUM_TARGET_EGL) + find_package(EGL) + set_property(TARGET Magnum::${_component} APPEND + PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) + elseif(CORRADE_TARGET_UNIX AND NOT CORRADE_TARGET_APPLE) find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGL::GLX) endif() - elseif(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_DESKTOP_GLES AND NOT CORRADE_TARGET_EMSCRIPTEN) - find_package(EGL) - set_property(TARGET Magnum::${_component} APPEND - PROPERTY INTERFACE_LINK_LIBRARIES EGL::EGL) endif() endif() @@ -799,12 +815,6 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # Windowless WGL application has no additional dependencies - # Windowless Windows/EGL application dependencies - elseif(_component STREQUAL WindowlessWindowsEglApplication) - find_package(EGL) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES EGL::EGL) - # X/EGL application dependencies elseif(_component STREQUAL XEglApplication) find_package(EGL) @@ -854,13 +864,13 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) elseif(_component STREQUAL Audio) find_package(OpenAL) set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager OpenAL::OpenAL) + INTERFACE_LINK_LIBRARIES OpenAL::OpenAL) # No special setup for DebugTools library # GL library elseif(_component STREQUAL GL) - if(NOT MAGNUM_TARGET_GLES OR MAGNUM_TARGET_DESKTOP_GLES) + if(NOT MAGNUM_TARGET_GLES OR (MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS)) # If the GLVND library (CMake 3.11+) was found, link to the # imported target. Otherwise (and also on all systems except # Linux) link to the classic libGL. Can't use @@ -886,6 +896,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3) endif() + # MaterialTools library + elseif(_component STREQUAL MaterialTools) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES PhongToPbrMetallicRoughness.h) + # MeshTools library elseif(_component STREQUAL MeshTools) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES CompressIndices.h) @@ -904,26 +918,19 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # No special setup for SceneGraph library - # ShaderTools library - elseif(_component STREQUAL ShaderTools) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager) + # SceneTools library + elseif(_component STREQUAL SceneTools) + set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Hierarchy.h) + # No special setup for ShaderTools library # No special setup for Shaders library - - # Text library - elseif(_component STREQUAL Text) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager) + # No special setup for Text library # TextureTools library elseif(_component STREQUAL TextureTools) set(_MAGNUM_${_COMPONENT}_INCLUDE_PATH_NAMES Atlas.h) - # Trade library - elseif(_component STREQUAL Trade) - set_property(TARGET Magnum::${_component} APPEND PROPERTY - INTERFACE_LINK_LIBRARIES Corrade::PluginManager) + # No special setup for Trade library # Vk library elseif(_component STREQUAL Vk) @@ -952,8 +959,13 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) endif() # Automatic import of static plugins. Skip in case the include dir was - # not found -- that'll fail later with a proper message. - if(_component IN_LIST _MAGNUM_PLUGIN_COMPONENTS AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR) + # not found -- that'll fail later with a proper message. Skip it also + # if the include dir doesn't contain the generated configure.h, which + # is the case with Magnum as a subproject and given plugin not enabled + # -- there it finds just the sources, where's just configure.h.cmake, + # and that's not useful for anything. The assumption here is that it + # will fail later anyway on the binary not being found. + if(_component IN_LIST _MAGNUM_PLUGIN_COMPONENTS AND _MAGNUM_${_COMPONENT}_INCLUDE_DIR AND EXISTS ${_MAGNUM_${_COMPONENT}_INCLUDE_DIR}/configure.h) # Automatic import of static plugins file(READ ${_MAGNUM_${_COMPONENT}_INCLUDE_DIR}/configure.h _magnum${_component}Configure) string(FIND "${_magnum${_component}Configure}" "#define MAGNUM_${_COMPONENT}_BUILD_STATIC" _magnum${_component}_BUILD_STATIC) @@ -967,6 +979,10 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # are optional dependencies, defer adding them to later once we know if # they were found or not. if(_component IN_LIST _MAGNUM_LIBRARY_COMPONENTS OR _component IN_LIST _MAGNUM_PLUGIN_COMPONENTS) + foreach(_dependency ${_MAGNUM_${_component}_CORRADE_DEPENDENCIES}) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + INTERFACE_LINK_LIBRARIES Corrade::${_dependency}) + endforeach() set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Magnum::Magnum) set(_MAGNUM_${component}_OPTIONAL_DEPENDENCIES_TO_ADD ) @@ -1042,6 +1058,10 @@ if(CORRADE_TARGET_EMSCRIPTEN) # IN_LIST as an operator since 3.1 (Emscripten needs at least 3.7), but # it's behind a policy, so enable that one as well. cmake_policy(SET CMP0057 NEW) + # TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be + # then passed via target_link_libraries() etc. without requiring CMake + # 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020 + # -- change to that once we drop support for older Emscripten versions if(CMAKE_VERSION VERSION_LESS 3.13 AND GL IN_LIST Magnum_FIND_COMPONENTS AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-s USE_WEBGL2=1") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") endif() @@ -1069,7 +1089,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16) # misleading messages. elseif(NOT _component IN_LIST _MAGNUM_IMPLICITLY_ENABLED_COMPONENTS) string(TOUPPER ${_component} _COMPONENT) - list(APPEND _MAGNUM_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled WITH_${_COMPONENT} when building Magnum.") + list(APPEND _MAGNUM_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum.") # Otherwise we have no idea. Better be silent than to print something # misleading. else() diff --git a/modules/FindMagnumIntegration.cmake b/modules/FindMagnumIntegration.cmake index f0d5351..d2e64de 100644 --- a/modules/FindMagnumIntegration.cmake +++ b/modules/FindMagnumIntegration.cmake @@ -48,7 +48,7 @@ # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, -# 2020, 2021, 2022 Vladimír VondruÅ¡ +# 2020, 2021, 2022, 2023 Vladimír VondruÅ¡ # Copyright © 2018 Konstantinos Chatzilygeroudis # # Permission is hereby granted, free of charge, to any person obtaining a @@ -314,7 +314,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.16) # misleading messages. elseif(NOT _component IN_LIST _MAGNUMINTEGRATION_IMPLICITLY_ENABLED_COMPONENTS) string(TOUPPER ${_component} _COMPONENT) - list(APPEND _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled WITH_${_COMPONENT} when building Magnum Integration.") + list(APPEND _MAGNUMINTEGRATION_REASON_FAILURE_MESSAGE "${_component} is not built by default. Make sure you enabled MAGNUM_WITH_${_COMPONENT} when building Magnum Integration.") # Otherwise we have no idea. Better be silent than to print something # misleading. else() diff --git a/modules/FindSDL2.cmake b/modules/FindSDL2.cmake index 311b052..2ce89ca 100644 --- a/modules/FindSDL2.cmake +++ b/modules/FindSDL2.cmake @@ -20,7 +20,7 @@ # This file is part of Magnum. # # Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, -# 2020, 2021, 2022 Vladimír VondruÅ¡ +# 2020, 2021, 2022, 2023 Vladimír VondruÅ¡ # Copyright © 2018 Jonathan Hale # # Permission is hereby granted, free of charge, to any person obtaining a @@ -138,10 +138,10 @@ else() # which CMake somehow prefers before the SDL2-2.0.dylib file. Making # the dylib first so it is preferred. Not sure how this maps to debug # config though :/ - NAMES SDL2-2.0 SDL2 + NAMES SDL2-2.0 SDL2 SDL2-static PATH_SUFFIXES ${_SDL2_LIBRARY_PATH_SUFFIX}) find_library(SDL2_LIBRARY_DEBUG - NAMES SDL2d + NAMES SDL2d SDL2-staticd PATH_SUFFIXES ${_SDL2_LIBRARY_PATH_SUFFIX}) # FPHSA needs one of the _DEBUG/_RELEASE variables to check that the # library was found -- using SDL_LIBRARY, which will get populated by -- 2.39.5 From f7a89621944076ed9b2187680b05413d36ca758d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 31 Aug 2023 12:34:34 +0200 Subject: [PATCH 025/126] main,SaveTool,Configuration: further Wine support. --- src/Configuration/Configuration.cpp | 8 ++++++++ src/Configuration/Configuration.h | 5 +++++ src/SaveTool/SaveTool.cpp | 15 ++++++++++++--- src/SaveTool/SaveTool_drawMainMenu.cpp | 5 +++++ src/main.cpp | 6 ++++++ 5 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index c1a4545..61a86bd 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -156,6 +156,14 @@ Configuration::setSkipDisclaimer(bool mode) { _conf.save(); } +bool Configuration::isRunningInWine() const { + return _isRunningInWine; +} + +void Configuration::setRunningInWine(bool wine) { + _isRunningInWine = wine; +} + Configuration& Configuration::instance() { static Configuration conf{}; diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index 5b9a0ca..884e522 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -46,6 +46,9 @@ class Configuration { bool skipDisclaimer() const; void setSkipDisclaimer(bool mode); + bool isRunningInWine() const; + void setRunningInWine(bool wine); + private: explicit Configuration(); @@ -57,6 +60,8 @@ class Configuration { bool _advancedMode = false; bool _checkUpdatesOnStartup = true; bool _skipDisclaimer = false; + + bool _isRunningInWine = false; }; Configuration& conf(); diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 7d2a009..7fd17bf 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -337,6 +337,12 @@ SaveTool::drawDisclaimer() { ImGui::SameLine(); ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version " SUPPORTED_GAME_VERSION ". It may or may not work with other versions of the game."); + if(conf().isRunningInWine()) { + ImGui::Bullet(); + ImGui::SameLine(); + ImGui::TextUnformatted("You are currently running this application in Wine/Proton. It hasn't been fully tested, so some issues may arise. Furthermore, features may be unavailable."); + } + ImGui::PopTextWrapPos(); if(ImGui::BeginTable("##DisclaimerLayoutTable", 3)) { @@ -430,9 +436,12 @@ SaveTool::drawCheckbox(Containers::StringView label, bool value) { void SaveTool::openUri(Containers::StringView uri) { - ShellExecuteW(nullptr, nullptr, Utility::Unicode::widen(uri.data()), nullptr, nullptr, SW_SHOWDEFAULT); - // TODO: have it open folders through winebrowser.exe when running using Wine/Proton. - // URLs like Discord invites or Steam Browser Protocol links should be disabled entirely there. + if(!conf().isRunningInWine()) { + ShellExecuteA(nullptr, nullptr, uri.data(), nullptr, nullptr, SW_SHOWDEFAULT); + } + else { + std::system(Utility::format("winebrowser.exe {}", uri).cbegin()); + } } void diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/SaveTool/SaveTool_drawMainMenu.cpp index b204087..2e74919 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/SaveTool/SaveTool_drawMainMenu.cpp @@ -159,6 +159,7 @@ SaveTool::drawMainMenu() { ImGui::EndMenu(); } + ImGui::BeginDisabled(conf().isRunningInWine()); if(ImGui::BeginMenu("Game##GameMenu")) { if(ImGui::MenuItem(ICON_FA_PLAY " Run demo##RunDemoMenuItem")) { openUri("steam://run/1048390"); @@ -185,6 +186,10 @@ SaveTool::drawMainMenu() { ImGui::EndMenu(); } + ImGui::EndDisabled(); + if(conf().isRunningInWine() && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled)) { + ImGui::SetTooltip("Not available when running in Wine."); + } #ifdef SAVETOOL_DEBUG_BUILD if(ImGui::BeginMenu("Debug tools")) { diff --git a/src/main.cpp b/src/main.cpp index 13e958c..e76d422 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ #include #include +#include "Configuration/Configuration.h" #include "Logger/MagnumLogBuffer.h" #include "SaveTool/SaveTool.h" @@ -50,6 +51,11 @@ int main(int argc, char** argv) { "Your system doesn't support UTF-8.", nullptr); return EXIT_FAILURE; } + + if(locale.hasSuffix(".65001")) { + LOG_INFO("Wine detected."); + conf().setRunningInWine(true); + } } auto mutex_handle = CreateMutexW(nullptr, 0, L"MassBuilderSaveTool"); -- 2.39.5 From d612b0afe60bd58fbeee6a6d30670d8ac4dac891 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 2 Sep 2023 14:28:28 +0200 Subject: [PATCH 026/126] SaveTool: various fixes for HiDPI screens. --- src/SaveTool/SaveTool.cpp | 8 ++++++-- src/SaveTool/SaveTool_Initialisation.cpp | 11 +++-------- src/SaveTool/SaveTool_MainManager.cpp | 4 +++- src/SaveTool/SaveTool_MassViewer.cpp | 2 +- src/SaveTool/SaveTool_MassViewer_Frame.cpp | 11 +++++++++-- src/SaveTool/SaveTool_MassViewer_Weapons.cpp | 10 ++++------ src/SaveTool/SaveTool_ProfileManager.cpp | 4 ++-- 7 files changed, 28 insertions(+), 22 deletions(-) diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 7fd17bf..6d31180 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -55,6 +55,10 @@ SaveTool::SaveTool(const Arguments& arguments): tweak.enable("", "../../"); #endif + LOG_INFO_FORMAT("Framebuffer size: {}x{}", framebufferSize().x(), framebufferSize().y()); + LOG_INFO_FORMAT("Window size: {}x{}", windowSize().x(), windowSize().y()); + LOG_INFO_FORMAT("DPI scaling: {}x{}", dpiScaling().x(), dpiScaling().y()); + LOG_INFO("Configuring OpenGL renderer."); GL::Renderer::enable(GL::Renderer::Feature::Blending); GL::Renderer::enable(GL::Renderer::Feature::ScissorTest); @@ -306,7 +310,7 @@ SaveTool::drawGui() { void SaveTool::drawDisclaimer() { - ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); + ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(ImGui::Begin("Disclaimer##DisclaimerWindow", nullptr, ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoBringToFrontOnFocus| @@ -374,7 +378,7 @@ SaveTool::drawDisclaimer() { void SaveTool::drawInitialisation() { - ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); + ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(ImGui::BeginPopupModal("##InitPopup", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoTitleBar)) diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/SaveTool/SaveTool_Initialisation.cpp index ba0441a..2473242 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/SaveTool/SaveTool_Initialisation.cpp @@ -62,7 +62,7 @@ void SaveTool::initialiseGui() { LOG_INFO("Initialising Dear ImGui."); - ImGui::CreateContext(); + auto ctx = ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); @@ -92,15 +92,10 @@ SaveTool::initialiseGui() { 16.0f * float(framebufferSize().x()) / size.x(), &icon_config, brand_range); auto mono_font = _rs.getRaw("SourceCodePro-Regular.ttf"_s); - ImVector range; - ImFontGlyphRangesBuilder builder; - builder.AddRanges(io.Fonts->GetGlyphRangesDefault()); - builder.AddChar(u'Å¡'); // This allows displaying Vladimír VondruÅ¡' name in Corrade's and Magnum's licences. - builder.BuildRanges(&range); io.Fonts->AddFontFromMemoryTTF(const_cast(mono_font.data()), int(mono_font.size()), - 18.0f * float(framebufferSize().x()) / size.x(), &font_config, range.Data); + 18.0f * float(framebufferSize().x()) / size.x(), &font_config); - _imgui = ImGuiIntegration::Context(*ImGui::GetCurrentContext(), windowSize()); + _imgui = ImGuiIntegration::Context(*ctx, Vector2{windowSize()}/dpiScaling(), windowSize(), framebufferSize()); io.IniFilename = nullptr; diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index 93ec331..82759f9 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -19,6 +19,8 @@ #include #include +#include + #include #include "../Configuration/Configuration.h" @@ -31,7 +33,7 @@ void SaveTool::drawManager() { ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); - ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y}, + ImGui::SetNextWindowSize(ImVec2{Vector2{float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y} / dpiScaling()}, ImGuiCond_Always); if(!ImGui::Begin("##MainWindow", nullptr, ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove| diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/SaveTool/SaveTool_MassViewer.cpp index 5ec3f0c..3fa25e8 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/SaveTool/SaveTool_MassViewer.cpp @@ -38,7 +38,7 @@ SaveTool::drawMassViewer() { } ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); - ImGui::SetNextWindowSize({float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y}, + ImGui::SetNextWindowSize(ImVec2{Vector2{float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y} / dpiScaling()}, ImGuiCond_Always); if(!ImGui::Begin("##MassViewer", nullptr, ImGuiWindowFlags_NoDecoration|ImGuiWindowFlags_NoMove| diff --git a/src/SaveTool/SaveTool_MassViewer_Frame.cpp b/src/SaveTool/SaveTool_MassViewer_Frame.cpp index 61948b6..c670599 100644 --- a/src/SaveTool/SaveTool_MassViewer_Frame.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Frame.cpp @@ -32,7 +32,11 @@ SaveTool::drawFrameInfo() { ImGui::BeginGroup(); - if(ImGui::BeginChild("##JointSliders", {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 300.0f}, true, ImGuiWindowFlags_MenuBar)) { + if(ImGui::BeginChild("##JointSliders", + {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), + (ImGui::GetContentRegionAvail().y / 1.75f) - (ImGui::GetStyle().WindowPadding.y / 2.0f)}, + true, ImGuiWindowFlags_MenuBar)) + { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Joint sliders"); @@ -43,7 +47,10 @@ SaveTool::drawFrameInfo() { } ImGui::EndChild(); - if(ImGui::BeginChild("##FrameStyles", {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 0.0f}, true, ImGuiWindowFlags_MenuBar)) { + if(ImGui::BeginChild("##FrameStyles", + {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 0.0f}, + true, ImGuiWindowFlags_MenuBar)) + { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Frame styles"); diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp index 7e48de1..f98e31e 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp @@ -51,11 +51,11 @@ SaveTool::drawWeapons() { ImGui::EndTable(); + ImGui::Separator(); + bool dirty = _meleeDirty || _shieldsDirty || _bShootersDirty || _eShootersDirty || _bLaunchersDirty || _eLaunchersDirty; - if(!dirty) { - ImGui::BeginDisabled(); - } + ImGui::BeginDisabled(!dirty); if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) { if(_meleeDirty) { @@ -154,9 +154,7 @@ SaveTool::drawWeapons() { } } - if(!dirty) { - ImGui::EndDisabled(); - } + ImGui::EndDisabled(); ImGui::EndGroup(); diff --git a/src/SaveTool/SaveTool_ProfileManager.cpp b/src/SaveTool/SaveTool_ProfileManager.cpp index 0ce5262..c47f684 100644 --- a/src/SaveTool/SaveTool_ProfileManager.cpp +++ b/src/SaveTool/SaveTool_ProfileManager.cpp @@ -28,7 +28,7 @@ void SaveTool::drawProfileManager() { static std::size_t profile_index = 0; - ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); + ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(ImGui::Begin("Profile management##ProfileManager", nullptr, ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoBringToFrontOnFocus| ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_MenuBar)) @@ -128,7 +128,7 @@ SaveTool::drawProfileManager() { ImGuiID SaveTool::drawBackupListPopup() { - ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); + ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(!ImGui::BeginPopupModal("Backups##BackupsModal", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { -- 2.39.5 From 1851867b7e20142a13466e66833032efe30bc63c Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 2 Sep 2023 18:30:29 +0200 Subject: [PATCH 027/126] Update copyright year. This was long overdue... --- src/CMakeLists.txt | 2 +- src/Configuration/Configuration.cpp | 2 +- src/Configuration/Configuration.h | 2 +- src/Logger/CMakeLists.txt | 2 +- src/Logger/EntryType.h | 2 +- src/Logger/Logger.cpp | 2 +- src/Logger/Logger.h | 2 +- src/Logger/MagnumLogBuffer.cpp | 2 +- src/Logger/MagnumLogBuffer.h | 2 +- src/Maps/Accessories.h | 2 +- src/Maps/ArmourSets.h | 2 +- src/Maps/ArmourSlots.hpp | 2 +- src/Maps/BulletLauncherAttachmentStyles.hpp | 2 +- src/Maps/BulletLauncherSockets.hpp | 2 +- src/Maps/DamageTypes.hpp | 2 +- src/Maps/EffectColourModes.hpp | 2 +- src/Maps/LastMissionId.h | 2 +- src/Maps/StoryProgress.h | 2 +- src/Maps/StyleNames.h | 2 +- src/Maps/WeaponParts.h | 2 +- src/Maps/WeaponTypes.hpp | 2 +- src/Mass/Accessory.h | 2 +- src/Mass/ArmourPart.h | 2 +- src/Mass/BulletLauncherAttachment.h | 2 +- src/Mass/CustomStyle.h | 2 +- src/Mass/Decal.h | 2 +- src/Mass/Joints.h | 2 +- src/Mass/Mass.cpp | 2 +- src/Mass/Mass.h | 2 +- src/Mass/Mass_Armour.cpp | 2 +- src/Mass/Mass_DecalsAccessories.cpp | 2 +- src/Mass/Mass_Frame.cpp | 2 +- src/Mass/Mass_Styles.cpp | 2 +- src/Mass/Mass_Weapons.cpp | 2 +- src/Mass/Weapon.cpp | 2 +- src/Mass/Weapon.h | 2 +- src/Mass/WeaponPart.h | 2 +- src/MassManager/MassManager.cpp | 2 +- src/MassManager/MassManager.h | 2 +- src/Profile/Profile.cpp | 2 +- src/Profile/Profile.h | 2 +- src/Profile/ResourceIDs.h | 2 +- src/ProfileManager/ProfileManager.cpp | 2 +- src/ProfileManager/ProfileManager.h | 2 +- src/SaveTool/SaveTool.cpp | 2 +- src/SaveTool/SaveTool.h | 2 +- src/SaveTool/SaveTool_FileWatcher.cpp | 2 +- src/SaveTool/SaveTool_Initialisation.cpp | 2 +- src/SaveTool/SaveTool_MainManager.cpp | 2 +- src/SaveTool/SaveTool_MassViewer.cpp | 2 +- src/SaveTool/SaveTool_MassViewer_Armour.cpp | 2 +- src/SaveTool/SaveTool_MassViewer_Frame.cpp | 2 +- src/SaveTool/SaveTool_MassViewer_Weapons.cpp | 2 +- src/SaveTool/SaveTool_ProfileManager.cpp | 2 +- src/SaveTool/SaveTool_UpdateChecker.cpp | 2 +- src/SaveTool/SaveTool_drawAbout.cpp | 2 +- src/SaveTool/SaveTool_drawMainMenu.cpp | 2 +- src/ToastQueue/ToastQueue.cpp | 2 +- src/ToastQueue/ToastQueue.h | 2 +- src/UESaveFile/BinaryReader.cpp | 2 +- src/UESaveFile/BinaryReader.h | 2 +- src/UESaveFile/BinaryWriter.cpp | 2 +- src/UESaveFile/BinaryWriter.h | 2 +- src/UESaveFile/CMakeLists.txt | 2 +- src/UESaveFile/Debug.cpp | 2 +- src/UESaveFile/Debug.h | 2 +- src/UESaveFile/PropertySerialiser.cpp | 2 +- src/UESaveFile/PropertySerialiser.h | 2 +- .../Serialisers/AbstractUnrealCollectionPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h | 2 +- src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/ArrayPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/BoolPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/BytePropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/BytePropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/ColourPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/DateTimePropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/EnumPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/FloatPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/GuidPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/IntPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/IntPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/MapPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/MapPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/ResourcePropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/RotatorPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/SetPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/SetPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/StringPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/StringPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/StructSerialiser.cpp | 2 +- src/UESaveFile/Serialisers/StructSerialiser.h | 2 +- src/UESaveFile/Serialisers/TextPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/TextPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/UnrealPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h | 2 +- src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp | 2 +- src/UESaveFile/Serialisers/VectorPropertySerialiser.h | 2 +- src/UESaveFile/Types/ArrayProperty.h | 2 +- src/UESaveFile/Types/BoolProperty.h | 2 +- src/UESaveFile/Types/ByteProperty.h | 2 +- src/UESaveFile/Types/ColourStructProperty.h | 2 +- src/UESaveFile/Types/DateTimeStructProperty.h | 2 +- src/UESaveFile/Types/EnumProperty.h | 2 +- src/UESaveFile/Types/FloatProperty.h | 2 +- src/UESaveFile/Types/GenericStructProperty.h | 2 +- src/UESaveFile/Types/GuidStructProperty.h | 2 +- src/UESaveFile/Types/IntProperty.h | 2 +- src/UESaveFile/Types/MapProperty.h | 2 +- src/UESaveFile/Types/NoneProperty.h | 2 +- src/UESaveFile/Types/ResourceItemValue.h | 2 +- src/UESaveFile/Types/RotatorStructProperty.h | 2 +- src/UESaveFile/Types/SetProperty.h | 2 +- src/UESaveFile/Types/StringProperty.h | 2 +- src/UESaveFile/Types/StructProperty.h | 2 +- src/UESaveFile/Types/TextProperty.h | 4 ++-- src/UESaveFile/Types/UnrealProperty.h | 2 +- src/UESaveFile/Types/UnrealPropertyBase.h | 2 +- src/UESaveFile/Types/Vector2DStructProperty.h | 2 +- src/UESaveFile/Types/VectorStructProperty.h | 2 +- src/UESaveFile/UESaveFile.cpp | 2 +- src/UESaveFile/UESaveFile.h | 2 +- src/Utilities/Crc32.h | 2 +- src/main.cpp | 2 +- src/resource.rc | 2 +- 135 files changed, 136 insertions(+), 136 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 821544f..6b49022 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2022 Guillaume Jacquemin +# Copyright (C) 2021-2023 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index 61a86bd..12c5555 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index 884e522..a685e30 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/CMakeLists.txt b/src/Logger/CMakeLists.txt index d26eb1d..2f4611e 100644 --- a/src/Logger/CMakeLists.txt +++ b/src/Logger/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2022 Guillaume Jacquemin +# Copyright (C) 2021-2023 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/Logger/EntryType.h b/src/Logger/EntryType.h index ac34d5c..2fd79b9 100644 --- a/src/Logger/EntryType.h +++ b/src/Logger/EntryType.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 3758e44..7e70431 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index ef35418..86721db 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/MagnumLogBuffer.cpp b/src/Logger/MagnumLogBuffer.cpp index 6436009..82f3d4a 100644 --- a/src/Logger/MagnumLogBuffer.cpp +++ b/src/Logger/MagnumLogBuffer.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/MagnumLogBuffer.h b/src/Logger/MagnumLogBuffer.h index ea7888c..e03b303 100644 --- a/src/Logger/MagnumLogBuffer.h +++ b/src/Logger/MagnumLogBuffer.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/Accessories.h b/src/Maps/Accessories.h index 61b664a..ab3e6e1 100644 --- a/src/Maps/Accessories.h +++ b/src/Maps/Accessories.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/ArmourSets.h b/src/Maps/ArmourSets.h index 167c471..a59fe8b 100644 --- a/src/Maps/ArmourSets.h +++ b/src/Maps/ArmourSets.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/ArmourSlots.hpp b/src/Maps/ArmourSlots.hpp index 73f7393..0db50e7 100644 --- a/src/Maps/ArmourSlots.hpp +++ b/src/Maps/ArmourSlots.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/BulletLauncherAttachmentStyles.hpp b/src/Maps/BulletLauncherAttachmentStyles.hpp index 53dd9db..20cb257 100644 --- a/src/Maps/BulletLauncherAttachmentStyles.hpp +++ b/src/Maps/BulletLauncherAttachmentStyles.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/BulletLauncherSockets.hpp b/src/Maps/BulletLauncherSockets.hpp index 3c50a60..50114ec 100644 --- a/src/Maps/BulletLauncherSockets.hpp +++ b/src/Maps/BulletLauncherSockets.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/DamageTypes.hpp b/src/Maps/DamageTypes.hpp index edfdaad..f80064e 100644 --- a/src/Maps/DamageTypes.hpp +++ b/src/Maps/DamageTypes.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/EffectColourModes.hpp b/src/Maps/EffectColourModes.hpp index 9e18866..f5fb64d 100644 --- a/src/Maps/EffectColourModes.hpp +++ b/src/Maps/EffectColourModes.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/LastMissionId.h b/src/Maps/LastMissionId.h index bcc60d3..4d8a4f0 100644 --- a/src/Maps/LastMissionId.h +++ b/src/Maps/LastMissionId.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/StoryProgress.h b/src/Maps/StoryProgress.h index 040aa01..b6432ea 100644 --- a/src/Maps/StoryProgress.h +++ b/src/Maps/StoryProgress.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/StyleNames.h b/src/Maps/StyleNames.h index 675a117..b54a7ef 100644 --- a/src/Maps/StyleNames.h +++ b/src/Maps/StyleNames.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/WeaponParts.h b/src/Maps/WeaponParts.h index 8de7269..878fa96 100644 --- a/src/Maps/WeaponParts.h +++ b/src/Maps/WeaponParts.h @@ -1,6 +1,6 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/WeaponTypes.hpp b/src/Maps/WeaponTypes.hpp index 9ef7858..878846a 100644 --- a/src/Maps/WeaponTypes.hpp +++ b/src/Maps/WeaponTypes.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Accessory.h b/src/Mass/Accessory.h index 4f326f4..c82b24b 100644 --- a/src/Mass/Accessory.h +++ b/src/Mass/Accessory.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/ArmourPart.h b/src/Mass/ArmourPart.h index c30dc79..300948e 100644 --- a/src/Mass/ArmourPart.h +++ b/src/Mass/ArmourPart.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/BulletLauncherAttachment.h b/src/Mass/BulletLauncherAttachment.h index 028c7a4..5be79e0 100644 --- a/src/Mass/BulletLauncherAttachment.h +++ b/src/Mass/BulletLauncherAttachment.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/CustomStyle.h b/src/Mass/CustomStyle.h index 8dbc832..73d7cb3 100644 --- a/src/Mass/CustomStyle.h +++ b/src/Mass/CustomStyle.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Decal.h b/src/Mass/Decal.h index 727147b..3bf7f14 100644 --- a/src/Mass/Decal.h +++ b/src/Mass/Decal.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Joints.h b/src/Mass/Joints.h index a1c358e..d2bb3fa 100644 --- a/src/Mass/Joints.h +++ b/src/Mass/Joints.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass.cpp b/src/Mass/Mass.cpp index d585c74..f34475e 100644 --- a/src/Mass/Mass.cpp +++ b/src/Mass/Mass.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index 74292ec..eb1398b 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 5450319..834bd07 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_DecalsAccessories.cpp b/src/Mass/Mass_DecalsAccessories.cpp index dfb8d00..002a95b 100644 --- a/src/Mass/Mass_DecalsAccessories.cpp +++ b/src/Mass/Mass_DecalsAccessories.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index 02f3546..510bcdb 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Styles.cpp b/src/Mass/Mass_Styles.cpp index 6aeaaf1..ea22921 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/Mass/Mass_Styles.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index ae64965..ba21459 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Weapon.cpp b/src/Mass/Weapon.cpp index 5431fb7..7de58ff 100644 --- a/src/Mass/Weapon.cpp +++ b/src/Mass/Weapon.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Weapon.h b/src/Mass/Weapon.h index 7fc8c45..63fc5b1 100644 --- a/src/Mass/Weapon.h +++ b/src/Mass/Weapon.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/WeaponPart.h b/src/Mass/WeaponPart.h index 406e23b..2afdd0f 100644 --- a/src/Mass/WeaponPart.h +++ b/src/Mass/WeaponPart.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/MassManager/MassManager.cpp b/src/MassManager/MassManager.cpp index 0b94d6c..9b21197 100644 --- a/src/MassManager/MassManager.cpp +++ b/src/MassManager/MassManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/MassManager/MassManager.h b/src/MassManager/MassManager.h index c3e495b..8ede9aa 100644 --- a/src/MassManager/MassManager.h +++ b/src/MassManager/MassManager.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index 4c4fe6e..8090cd1 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Profile/Profile.h b/src/Profile/Profile.h index 46c9c08..64b036a 100644 --- a/src/Profile/Profile.h +++ b/src/Profile/Profile.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Profile/ResourceIDs.h b/src/Profile/ResourceIDs.h index fdaf506..b1b2735 100644 --- a/src/Profile/ResourceIDs.h +++ b/src/Profile/ResourceIDs.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index 622b066..318c332 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ProfileManager/ProfileManager.h b/src/ProfileManager/ProfileManager.h index a7b8212..5b9db95 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/ProfileManager/ProfileManager.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 6d31180..1aaba10 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index dfd9de9..9e0a8c6 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_FileWatcher.cpp b/src/SaveTool/SaveTool_FileWatcher.cpp index d9325fa..59b1f61 100644 --- a/src/SaveTool/SaveTool_FileWatcher.cpp +++ b/src/SaveTool/SaveTool_FileWatcher.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/SaveTool/SaveTool_Initialisation.cpp index 2473242..b6f6449 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/SaveTool/SaveTool_Initialisation.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index 82759f9..c94ac50 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/SaveTool/SaveTool_MassViewer.cpp index 3fa25e8..62762ca 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/SaveTool/SaveTool_MassViewer.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_MassViewer_Armour.cpp b/src/SaveTool/SaveTool_MassViewer_Armour.cpp index 76d9459..7b9e560 100644 --- a/src/SaveTool/SaveTool_MassViewer_Armour.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Armour.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_MassViewer_Frame.cpp b/src/SaveTool/SaveTool_MassViewer_Frame.cpp index c670599..7b93155 100644 --- a/src/SaveTool/SaveTool_MassViewer_Frame.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Frame.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp index f98e31e..014eb11 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_ProfileManager.cpp b/src/SaveTool/SaveTool_ProfileManager.cpp index c47f684..cdeb37e 100644 --- a/src/SaveTool/SaveTool_ProfileManager.cpp +++ b/src/SaveTool/SaveTool_ProfileManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_UpdateChecker.cpp b/src/SaveTool/SaveTool_UpdateChecker.cpp index dc42443..a89a482 100644 --- a/src/SaveTool/SaveTool_UpdateChecker.cpp +++ b/src/SaveTool/SaveTool_UpdateChecker.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_drawAbout.cpp b/src/SaveTool/SaveTool_drawAbout.cpp index 3f1cb92..1598e35 100644 --- a/src/SaveTool/SaveTool_drawAbout.cpp +++ b/src/SaveTool/SaveTool_drawAbout.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/SaveTool/SaveTool_drawMainMenu.cpp index 2e74919..fdc4d35 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/SaveTool/SaveTool_drawMainMenu.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ToastQueue/ToastQueue.cpp b/src/ToastQueue/ToastQueue.cpp index 0459c97..637f87b 100644 --- a/src/ToastQueue/ToastQueue.cpp +++ b/src/ToastQueue/ToastQueue.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ToastQueue/ToastQueue.h b/src/ToastQueue/ToastQueue.h index b141662..8d2ce40 100644 --- a/src/ToastQueue/ToastQueue.h +++ b/src/ToastQueue/ToastQueue.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/BinaryReader.cpp b/src/UESaveFile/BinaryReader.cpp index 6610ec2..131607d 100644 --- a/src/UESaveFile/BinaryReader.cpp +++ b/src/UESaveFile/BinaryReader.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/BinaryReader.h b/src/UESaveFile/BinaryReader.h index 46915f4..e04d711 100644 --- a/src/UESaveFile/BinaryReader.h +++ b/src/UESaveFile/BinaryReader.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/BinaryWriter.cpp b/src/UESaveFile/BinaryWriter.cpp index ce55642..658d1a1 100644 --- a/src/UESaveFile/BinaryWriter.cpp +++ b/src/UESaveFile/BinaryWriter.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/BinaryWriter.h b/src/UESaveFile/BinaryWriter.h index a479c69..3c11eed 100644 --- a/src/UESaveFile/BinaryWriter.h +++ b/src/UESaveFile/BinaryWriter.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/CMakeLists.txt b/src/UESaveFile/CMakeLists.txt index 97c036c..7a9c7fa 100644 --- a/src/UESaveFile/CMakeLists.txt +++ b/src/UESaveFile/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2022 Guillaume Jacquemin +# Copyright (C) 2021-2023 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Debug.cpp b/src/UESaveFile/Debug.cpp index d10a752..050fa4c 100644 --- a/src/UESaveFile/Debug.cpp +++ b/src/UESaveFile/Debug.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Debug.h b/src/UESaveFile/Debug.h index 4a85ca1..1f6f879 100644 --- a/src/UESaveFile/Debug.h +++ b/src/UESaveFile/Debug.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/PropertySerialiser.cpp b/src/UESaveFile/PropertySerialiser.cpp index 41e3d47..1e89498 100644 --- a/src/UESaveFile/PropertySerialiser.cpp +++ b/src/UESaveFile/PropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/PropertySerialiser.h b/src/UESaveFile/PropertySerialiser.h index b726a2d..db89fa9 100644 --- a/src/UESaveFile/PropertySerialiser.h +++ b/src/UESaveFile/PropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h index 61dd1c9..4a974ab 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h index bf6dac4..6b2e615 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h b/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h index 3db3909..57e79d7 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h +++ b/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp index b106d28..ed412af 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h index 7480ff5..6f6b741 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp b/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp index b2cbfcb..8e2c1ea 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h b/src/UESaveFile/Serialisers/BoolPropertySerialiser.h index 163cf9d..6e41afc 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/BoolPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp index a5a1f94..45b7934 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.h b/src/UESaveFile/Serialisers/BytePropertySerialiser.h index b8775ad..fb2b2d4 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/BytePropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp b/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp index df0000d..9e5cd9a 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h b/src/UESaveFile/Serialisers/ColourPropertySerialiser.h index 4cc375b..812f7a9 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ColourPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp index 14109d9..9724dfb 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h index 54e71b4..68f2476 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp b/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp index 8ff91c8..f7e1246 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h b/src/UESaveFile/Serialisers/EnumPropertySerialiser.h index 67a6ab8..077eeae 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/EnumPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp b/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp index 5d2a2cf..d643ca0 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h b/src/UESaveFile/Serialisers/FloatPropertySerialiser.h index d1dea25..9aa8ee9 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/FloatPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp b/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp index 811196b..46715b6 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h b/src/UESaveFile/Serialisers/GuidPropertySerialiser.h index 506986e..1a2a7c4 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/GuidPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp b/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp index 489ef7f..76a8443 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.h b/src/UESaveFile/Serialisers/IntPropertySerialiser.h index 2d05b40..4cf7c93 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/IntPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp b/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp index 0baa805..b2f9057 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.h b/src/UESaveFile/Serialisers/MapPropertySerialiser.h index 447a0e9..0b59b4d 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/MapPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp index 23915ac..9182591 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h index 488f769..4e5e360 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h +++ b/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp index 7748b1e..5a0b9e2 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h index 08d7714..ec56385 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp b/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp index 69ab555..2bef358 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.h b/src/UESaveFile/Serialisers/SetPropertySerialiser.h index 1bec9b8..083e2c8 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/SetPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp b/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp index d645cfc..177dacc 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.h b/src/UESaveFile/Serialisers/StringPropertySerialiser.h index 779a086..cfca6ce 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/StringPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/StructSerialiser.cpp b/src/UESaveFile/Serialisers/StructSerialiser.cpp index 3c628cf..770a079 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.cpp +++ b/src/UESaveFile/Serialisers/StructSerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/StructSerialiser.h b/src/UESaveFile/Serialisers/StructSerialiser.h index 96d6cab..2644e6c 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.h +++ b/src/UESaveFile/Serialisers/StructSerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp index 09698ab..ce519b3 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.h b/src/UESaveFile/Serialisers/TextPropertySerialiser.h index f349326..865b63e 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h b/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h index 1d3a7ab..d351030 100644 --- a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp index c42d3f9..6cb611a 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h index b31ea51..cc40bb1 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp b/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp index b2fada5..7e07989 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h b/src/UESaveFile/Serialisers/VectorPropertySerialiser.h index 12b9526..212adef 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h +++ b/src/UESaveFile/Serialisers/VectorPropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/ArrayProperty.h b/src/UESaveFile/Types/ArrayProperty.h index ab6bbec..4c4f476 100644 --- a/src/UESaveFile/Types/ArrayProperty.h +++ b/src/UESaveFile/Types/ArrayProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/BoolProperty.h b/src/UESaveFile/Types/BoolProperty.h index ccb6630..cc70178 100644 --- a/src/UESaveFile/Types/BoolProperty.h +++ b/src/UESaveFile/Types/BoolProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/ByteProperty.h b/src/UESaveFile/Types/ByteProperty.h index fc1bb05..7c55d9d 100644 --- a/src/UESaveFile/Types/ByteProperty.h +++ b/src/UESaveFile/Types/ByteProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/ColourStructProperty.h b/src/UESaveFile/Types/ColourStructProperty.h index 6e19f36..38878f3 100644 --- a/src/UESaveFile/Types/ColourStructProperty.h +++ b/src/UESaveFile/Types/ColourStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/DateTimeStructProperty.h b/src/UESaveFile/Types/DateTimeStructProperty.h index c6605b7..4f3f37c 100644 --- a/src/UESaveFile/Types/DateTimeStructProperty.h +++ b/src/UESaveFile/Types/DateTimeStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/EnumProperty.h b/src/UESaveFile/Types/EnumProperty.h index b6c9730..c3941a5 100644 --- a/src/UESaveFile/Types/EnumProperty.h +++ b/src/UESaveFile/Types/EnumProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/FloatProperty.h b/src/UESaveFile/Types/FloatProperty.h index 83dfe59..c5ec882 100644 --- a/src/UESaveFile/Types/FloatProperty.h +++ b/src/UESaveFile/Types/FloatProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/GenericStructProperty.h b/src/UESaveFile/Types/GenericStructProperty.h index 6472fd0..5c72bb6 100644 --- a/src/UESaveFile/Types/GenericStructProperty.h +++ b/src/UESaveFile/Types/GenericStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/GuidStructProperty.h b/src/UESaveFile/Types/GuidStructProperty.h index 34619a6..8a8e490 100644 --- a/src/UESaveFile/Types/GuidStructProperty.h +++ b/src/UESaveFile/Types/GuidStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/IntProperty.h b/src/UESaveFile/Types/IntProperty.h index b381136..a92e807 100644 --- a/src/UESaveFile/Types/IntProperty.h +++ b/src/UESaveFile/Types/IntProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/MapProperty.h b/src/UESaveFile/Types/MapProperty.h index 62a26b3..306552c 100644 --- a/src/UESaveFile/Types/MapProperty.h +++ b/src/UESaveFile/Types/MapProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/NoneProperty.h b/src/UESaveFile/Types/NoneProperty.h index 4985642..68cc44a 100644 --- a/src/UESaveFile/Types/NoneProperty.h +++ b/src/UESaveFile/Types/NoneProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/ResourceItemValue.h b/src/UESaveFile/Types/ResourceItemValue.h index 16ed5f2..c5d9e7c 100644 --- a/src/UESaveFile/Types/ResourceItemValue.h +++ b/src/UESaveFile/Types/ResourceItemValue.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/RotatorStructProperty.h b/src/UESaveFile/Types/RotatorStructProperty.h index 5a21991..c8e5a7c 100644 --- a/src/UESaveFile/Types/RotatorStructProperty.h +++ b/src/UESaveFile/Types/RotatorStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/SetProperty.h b/src/UESaveFile/Types/SetProperty.h index fa6389c..6e51a18 100644 --- a/src/UESaveFile/Types/SetProperty.h +++ b/src/UESaveFile/Types/SetProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/StringProperty.h b/src/UESaveFile/Types/StringProperty.h index bc28a92..0a0526e 100644 --- a/src/UESaveFile/Types/StringProperty.h +++ b/src/UESaveFile/Types/StringProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/StructProperty.h b/src/UESaveFile/Types/StructProperty.h index a0ddb16..3bb8d14 100644 --- a/src/UESaveFile/Types/StructProperty.h +++ b/src/UESaveFile/Types/StructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/TextProperty.h b/src/UESaveFile/Types/TextProperty.h index 409b393..8f4e8ad 100644 --- a/src/UESaveFile/Types/TextProperty.h +++ b/src/UESaveFile/Types/TextProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ struct TextProperty : public UnrealProperty { using namespace Containers::Literals; propertyType = "TextProperty"_s; } - + Containers::Array flags; char id = 0; Containers::Array data; diff --git a/src/UESaveFile/Types/UnrealProperty.h b/src/UESaveFile/Types/UnrealProperty.h index adccf4c..33b63b7 100644 --- a/src/UESaveFile/Types/UnrealProperty.h +++ b/src/UESaveFile/Types/UnrealProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/UnrealPropertyBase.h b/src/UESaveFile/Types/UnrealPropertyBase.h index acaf8fd..d27714f 100644 --- a/src/UESaveFile/Types/UnrealPropertyBase.h +++ b/src/UESaveFile/Types/UnrealPropertyBase.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/Vector2DStructProperty.h b/src/UESaveFile/Types/Vector2DStructProperty.h index 17b02b7..64682d3 100644 --- a/src/UESaveFile/Types/Vector2DStructProperty.h +++ b/src/UESaveFile/Types/Vector2DStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/Types/VectorStructProperty.h b/src/UESaveFile/Types/VectorStructProperty.h index 4189ab1..ecf2328 100644 --- a/src/UESaveFile/Types/VectorStructProperty.h +++ b/src/UESaveFile/Types/VectorStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/UESaveFile.cpp b/src/UESaveFile/UESaveFile.cpp index d754540..15c892e 100644 --- a/src/UESaveFile/UESaveFile.cpp +++ b/src/UESaveFile/UESaveFile.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UESaveFile/UESaveFile.h b/src/UESaveFile/UESaveFile.h index 91798e9..7aa72f2 100644 --- a/src/UESaveFile/UESaveFile.h +++ b/src/UESaveFile/UESaveFile.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Utilities/Crc32.h b/src/Utilities/Crc32.h index 6937f28..08e819a 100644 --- a/src/Utilities/Crc32.h +++ b/src/Utilities/Crc32.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/main.cpp b/src/main.cpp index e76d422..93c6353 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/resource.rc b/src/resource.rc index df99b1e..1adeb1e 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2022 Guillaume Jacquemin +// Copyright (C) 2021-2023 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by -- 2.39.5 From b19c3e00259f2a047cd175cd98a2582af6297c00 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 30 Sep 2023 11:06:19 +0200 Subject: [PATCH 028/126] Logger: indent some preprocessor stuff. Should have been indented from the get-go, but I forgot about it. --- src/Logger/Logger.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 7e70431..37209c9 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -38,7 +38,7 @@ void Logger::initialise() { auto exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first(); _logFile.open(Utility::Path::join(exe_path, "SaveToolLog.txt").cbegin(), std::ios::trunc); -#ifndef SAVETOOL_DEBUG_BUILD + #ifndef SAVETOOL_DEBUG_BUILD _logFile << "In case you encounter a bug:\n" << "1. Do not run the Save Tool again, as this log will be cleared.\n" << "2. Go to either the official Sekai Project Discord guild, or the community M.A.S.S. Builder one.\n" << @@ -46,7 +46,7 @@ Logger::initialise() { " Please include as many details as possible, I don't want to play \"20 questions\", and neither do you.\n" << "4. Send me this file _when I ask for it_, preferably in DMs.\n" << std::endl; -#endif + #endif } void -- 2.39.5 From bb85c3d6b0ed94cf1b5872312cbf17e1f2bc6c73 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 10:36:46 +0100 Subject: [PATCH 029/126] src/CMakeLists: make project less Windows-only. --- src/CMakeLists.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6b49022..37eb4c6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,7 +20,10 @@ set(CMAKE_CXX_EXTENSIONS OFF) set(SAVETOOL_PROJECT_VERSION 1.5.0-pre) -find_package(Corrade REQUIRED Main Containers Utility) +find_package(Corrade REQUIRED Containers Utility) +if(CORRADE_TARGET_WINDOWS) + find_package(Corrade REQUIRED Main) +endif() find_package(Magnum REQUIRED GL Sdl2Application) find_package(MagnumIntegration REQUIRED ImGui) find_package(CURL REQUIRED HTTPS) @@ -34,6 +37,10 @@ corrade_add_resource(Assets assets.conf) add_subdirectory(Logger EXCLUDE_FROM_ALL) add_subdirectory(UESaveFile EXCLUDE_FROM_ALL) +if(CORRADE_TARGET_WINDOWS) + set(SAVETOOL_RC_FILE resource.rc) +endif() + add_executable(MassBuilderSaveTool WIN32 main.cpp SaveTool/SaveTool.h @@ -93,7 +100,7 @@ add_executable(MassBuilderSaveTool WIN32 Utilities/Crc32.h FontAwesome/IconsFontAwesome5.h FontAwesome/IconsFontAwesome5Brands.h - resource.rc + ${SAVETOOL_RC_FILE} ${Assets} ) @@ -120,7 +127,6 @@ endif() target_link_libraries(MassBuilderSaveTool PRIVATE Corrade::Containers Corrade::Utility - Corrade::Main Magnum::Magnum Magnum::GL Magnum::Sdl2Application @@ -130,6 +136,12 @@ target_link_libraries(MassBuilderSaveTool PRIVATE efsw::efsw libzip::zip CURL::libcurl_static - imm32 - wtsapi32 ) + +if(CORRADE_TARGET_WINDOWS) + target_link_libraries(MassBuilderSaveTool PRIVATE + Corrade::Main + imm32 + wtsapi32 + ) +endif() -- 2.39.5 From e634ef037dcb10beb0cd62f73fffe97e203c60fb Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 10:40:02 +0100 Subject: [PATCH 030/126] Change how the project version is defined. --- src/CMakeLists.txt | 8 ++++++-- src/SaveTool/SaveTool.cpp | 4 ++-- src/SaveTool/SaveTool_MainManager.cpp | 2 +- src/main.cpp | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37eb4c6..fbef083 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -109,9 +109,13 @@ if(CMAKE_BUILD_TYPE STREQUAL Debug) target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_DEBUG_BUILD) endif() target_compile_definitions(MassBuilderSaveTool PRIVATE - SAVETOOL_VERSION="${SAVETOOL_PROJECT_VERSION}" + SAVETOOL_VERSION_STRING="${SAVETOOL_PROJECT_VERSION}" + SAVETOOL_VERSION_MAJOR=1 + SAVETOOL_VERSION_MINOR=5 + SAVETOOL_VERSION_PATCH=0 + SAVETOOL_VERSION_PRERELEASE=true SAVETOOL_CODENAME="Friendly Valkyrie" - SUPPORTED_GAME_VERSION="0.9.x" + SAVETOOL_SUPPORTED_GAME_VERSION="0.10.x" ) if(CMAKE_BUILD_TYPE STREQUAL Release) diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 1aaba10..6402768 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -48,7 +48,7 @@ Utility::Tweakable tweak; SaveTool::SaveTool(const Arguments& arguments): Platform::Sdl2Application{arguments, - Configuration{}.setTitle("M.A.S.S. Builder Save Tool " SAVETOOL_VERSION " (\"" SAVETOOL_CODENAME "\")") + Configuration{}.setTitle("M.A.S.S. Builder Save Tool " SAVETOOL_VERSION_STRING " (\"" SAVETOOL_CODENAME "\")") .setSize({960, 720})} { #ifdef SAVETOOL_DEBUG_BUILD @@ -339,7 +339,7 @@ SaveTool::drawDisclaimer() { ImGui::Bullet(); ImGui::SameLine(); - ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version " SUPPORTED_GAME_VERSION ". It may or may not work with other versions of the game."); + ImGui::TextUnformatted("This version of the application was tested on M.A.S.S. Builder early access version " SAVETOOL_SUPPORTED_GAME_VERSION ". It may or may not work with other versions of the game."); if(conf().isRunningInWine()) { ImGui::Bullet(); diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/SaveTool/SaveTool_MainManager.cpp index c94ac50..b95df8d 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/SaveTool/SaveTool_MainManager.cpp @@ -387,7 +387,7 @@ SaveTool::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t t ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted(name.begin(), name.end()); ImGui::TableSetColumnIndex(2); - ImGui::TextDisabled("Unavailable as of game version " SUPPORTED_GAME_VERSION); + ImGui::TextDisabled("Unavailable as of game version " SAVETOOL_SUPPORTED_GAME_VERSION); } void diff --git a/src/main.cpp b/src/main.cpp index 93c6353..dc6dc87 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ int main(int argc, char** argv) { logger().initialise(); - LOG_INFO("Initialising M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION "."); + LOG_INFO("Initialising M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION_STRING "."); auto str = setlocale(LC_ALL, ".utf-8"); if(str) { -- 2.39.5 From f9aa4bc8175a0a306362ea0665a7cf24430837e5 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 10:48:31 +0100 Subject: [PATCH 031/126] SaveTool: Update the M.A.S.S. viewer weapon screen. --- src/SaveTool/SaveTool_MassViewer_Weapons.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp index 014eb11..a407e32 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp @@ -28,7 +28,7 @@ SaveTool::drawWeapons() { return; } - const float footer_height_to_reserve = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing(); + const float footer_height_to_reserve = ImGui::GetFrameHeightWithSpacing(); ImGui::BeginGroup(); @@ -51,13 +51,11 @@ SaveTool::drawWeapons() { ImGui::EndTable(); - ImGui::Separator(); - bool dirty = _meleeDirty || _shieldsDirty || _bShootersDirty || _eShootersDirty || _bLaunchersDirty || _eLaunchersDirty; ImGui::BeginDisabled(!dirty); - if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) { + if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save order"); })) { if(_meleeDirty) { _modifiedBySaveTool = true; if(!_currentMass->writeMeleeWeapons()) { @@ -158,6 +156,8 @@ SaveTool::drawWeapons() { ImGui::EndGroup(); + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); ImGui::SameLine(); if(!_currentWeapon) { @@ -176,8 +176,6 @@ SaveTool::drawWeapons() { ImGui::EndChild(); - ImGui::Separator(); - if(drawUnsafeWidget([](){ return ImGui::Button(ICON_FA_SAVE " Save changes to weapon category"); })) { _modifiedBySaveTool = true; switch(_currentWeapon->type) { -- 2.39.5 From 07cbaefeacd67479e5a566d32b64d8d6838a971b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 11:31:21 +0100 Subject: [PATCH 032/126] General code maintenance. --- src/Logger/MagnumLogBuffer.h | 2 +- src/Maps/StoryProgress.h | 6 +++--- src/Mass/Mass_Armour.cpp | 2 +- src/Profile/Profile.cpp | 8 ++++---- src/ProfileManager/ProfileManager.cpp | 8 ++++---- src/SaveTool/SaveTool_MassViewer.cpp | 2 +- src/SaveTool/SaveTool_MassViewer_Armour.cpp | 2 +- src/SaveTool/SaveTool_MassViewer_Weapons.cpp | 2 +- src/UESaveFile/BinaryWriter.cpp | 2 +- src/UESaveFile/Serialisers/StructSerialiser.cpp | 2 ++ src/UESaveFile/Serialisers/TextPropertySerialiser.cpp | 2 +- src/UESaveFile/UESaveFile.cpp | 6 ++---- 12 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Logger/MagnumLogBuffer.h b/src/Logger/MagnumLogBuffer.h index e03b303..010c788 100644 --- a/src/Logger/MagnumLogBuffer.h +++ b/src/Logger/MagnumLogBuffer.h @@ -25,7 +25,7 @@ class MagnumLogBuffer : public std::stringbuf { public: explicit MagnumLogBuffer(EntryType type); - ~MagnumLogBuffer(); + ~MagnumLogBuffer() override; private: int sync() override; diff --git a/src/Maps/StoryProgress.h b/src/Maps/StoryProgress.h index b6432ea..61d857e 100644 --- a/src/Maps/StoryProgress.h +++ b/src/Maps/StoryProgress.h @@ -23,9 +23,9 @@ using namespace Corrade; using namespace Containers::Literals; struct StoryProgressPoint { - std::int32_t id; - Containers::StringView chapter; - Containers::StringView point; + std::int32_t id{}; + Containers::StringView chapter = nullptr; + Containers::StringView point = nullptr; Containers::StringView after = nullptr; }; diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 834bd07..990d637 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -185,7 +185,7 @@ Mass::writeArmourPart(ArmourSlot slot) { auto decals_array = part_prop->at(MASS_ARMOUR_DECALS); writeDecals(part.decals, decals_array); - if(part.accessories.size() != 0) { + if(!part.accessories.isEmpty()) { auto accs_array = part_prop->at(MASS_ARMOUR_ACCESSORIES); writeAccessories(part.accessories, accs_array); } diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index 8090cd1..a6a9bd2 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -269,7 +269,7 @@ Profile::setMaterial(MaterialID id, std::int32_t amount) { } auto predicate = [&id](UnrealPropertyBase::ptr& prop){ - auto res_prop = static_cast(prop.get()); + auto res_prop = dynamic_cast(prop.get()); return res_prop->id == id; }; @@ -286,7 +286,7 @@ Profile::setMaterial(MaterialID id, std::int32_t amount) { arrayAppend(mats_prop->items, std::move(prop)); } else { - res_prop = static_cast(it->get()); + res_prop = dynamic_cast(it->get()); } res_prop->quantity = amount; @@ -308,10 +308,10 @@ Profile::getResource(Containers::StringView container, MaterialID id) { } auto predicate = [&id](UnrealPropertyBase::ptr& prop){ - auto res_prop = static_cast(prop.get()); + auto res_prop = dynamic_cast(prop.get()); return res_prop->id == id; }; auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate); - return it != mats_prop->items.end() ? static_cast(it->get())->quantity : 0; + return it != mats_prop->items.end() ? dynamic_cast(it->get())->quantity : 0; } diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index 318c332..7919fd8 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -235,7 +235,7 @@ ProfileManager::refreshBackups() { auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate)); int error_code = 0; - zip_t* zip = nullptr; + zip_t* zip; for(Containers::StringView file : files_view) { Backup backup; backup.filename = file; @@ -324,7 +324,7 @@ ProfileManager::restoreBackup(std::size_t index) { auto error_format = "Extraction of file {} failed: {}"_s; int error_code = 0; - zip_t* zip = nullptr; + zip_t* zip; zip = zip_open(Utility::Path::join(_backupsDirectory, backup.filename).data(), ZIP_RDONLY, &error_code); if(zip == nullptr) { @@ -358,8 +358,8 @@ ProfileManager::restoreBackup(std::size_t index) { Containers::StaticArray<8192, char> buf{ValueInit}; - auto bytes_read = 0l; - while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0) { + std::int64_t bytes_read; + while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0ll) { if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast(bytes_read)) { _lastError = Utility::format(error_format.data(), file, "not enough bytes written."); LOG_ERROR(_lastError); diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/SaveTool/SaveTool_MassViewer.cpp index 62762ca..4bb3da2 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/SaveTool/SaveTool_MassViewer.cpp @@ -134,7 +134,7 @@ SaveTool::drawMassViewer() { ImGui::EndTabItem(); } - if(_currentMass->globalStyles().size() != 0 && ImGui::BeginTabItem("Global styles")) { + if(!_currentMass->globalStyles().isEmpty() && ImGui::BeginTabItem("Global styles")) { drawGlobalStyles(); ImGui::EndTabItem(); } diff --git a/src/SaveTool/SaveTool_MassViewer_Armour.cpp b/src/SaveTool/SaveTool_MassViewer_Armour.cpp index 7b9e560..2733a78 100644 --- a/src/SaveTool/SaveTool_MassViewer_Armour.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Armour.cpp @@ -134,7 +134,7 @@ SaveTool::drawArmour() { ImGui::PopID(); - if(part.accessories.size() != 0) { + if(!part.accessories.isEmpty()) { ImGui::Separator(); ImGui::PushID("Accessory"); diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp index a407e32..c60cdc9 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/SaveTool/SaveTool_MassViewer_Weapons.cpp @@ -542,7 +542,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::PopID(); - if(part.accessories.size() != 0) { + if(!part.accessories.isEmpty()) { ImGui::Separator(); ImGui::PushID("Accessory"); diff --git a/src/UESaveFile/BinaryWriter.cpp b/src/UESaveFile/BinaryWriter.cpp index 658d1a1..ab0ebba 100644 --- a/src/UESaveFile/BinaryWriter.cpp +++ b/src/UESaveFile/BinaryWriter.cpp @@ -126,7 +126,7 @@ BinaryWriter::writeDouble(double value) { bool BinaryWriter::writeArray(Containers::ArrayView array) { - if(array.size() == 0) { + if(array.isEmpty()) { return false; } diff --git a/src/UESaveFile/Serialisers/StructSerialiser.cpp b/src/UESaveFile/Serialisers/StructSerialiser.cpp index 770a079..1e8affc 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.cpp +++ b/src/UESaveFile/Serialisers/StructSerialiser.cpp @@ -198,6 +198,8 @@ StructProperty::ptr StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { + static_cast(value_length); + auto st_prop = Containers::pointer(); st_prop->structType = type; diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp index ce519b3..cba065f 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp +++ b/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp @@ -50,7 +50,7 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain return nullptr; } - auto interval = reader.position() - start_position; + std::int64_t interval; do { Containers::String str; diff --git a/src/UESaveFile/UESaveFile.cpp b/src/UESaveFile/UESaveFile.cpp index 15c892e..af44e10 100644 --- a/src/UESaveFile/UESaveFile.cpp +++ b/src/UESaveFile/UESaveFile.cpp @@ -114,10 +114,8 @@ UESaveFile::saveToFile() { return false; } - for(std::size_t i = 0; i < _customFormatData.size(); i++) { - if(!writer.writeStaticArray(Containers::StaticArrayView<16, const char>{_customFormatData[i].id}) || - !writer.writeUint32(_customFormatData[i].value)) - { + for(auto& i : _customFormatData) { + if(!writer.writeStaticArray<16>(staticArrayView(i.id)) || !writer.writeUint32(i.value)) { _lastError = "Couldn't write the custom format data."_s; LOG_ERROR(_lastError); return false; -- 2.39.5 From 389dabfc775c02a05a3c35ea3c44d963d9af91db Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 11:32:17 +0100 Subject: [PATCH 033/126] SaveTool: separate update checking mechanism. THIS IS BROKEN, ONLY BUILD THIS COMMIT FOR DEBUGGING PURPOSES! --- src/CMakeLists.txt | 3 + src/SaveTool/SaveTool.cpp | 8 +- src/SaveTool/SaveTool.h | 13 +- src/SaveTool/SaveTool_UpdateChecker.cpp | 179 ++++++------------------ src/SaveTool/SaveTool_drawMainMenu.cpp | 9 +- src/UpdateChecker/UpdateChecker.cpp | 112 +++++++++++++++ src/UpdateChecker/UpdateChecker.h | 49 +++++++ src/Version/Version.h | 89 ++++++++++++ 8 files changed, 309 insertions(+), 153 deletions(-) create mode 100644 src/UpdateChecker/UpdateChecker.cpp create mode 100644 src/UpdateChecker/UpdateChecker.h create mode 100644 src/Version/Version.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fbef083..110a5b7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,7 +97,10 @@ add_executable(MassBuilderSaveTool WIN32 Maps/WeaponTypes.hpp ToastQueue/ToastQueue.h ToastQueue/ToastQueue.cpp + UpdateChecker/UpdateChecker.h + UpdateChecker/UpdateChecker.cpp Utilities/Crc32.h + Version/Version.h FontAwesome/IconsFontAwesome5.h FontAwesome/IconsFontAwesome5Brands.h ${SAVETOOL_RC_FILE} diff --git a/src/SaveTool/SaveTool.cpp b/src/SaveTool/SaveTool.cpp index 6402768..2859392 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/SaveTool/SaveTool.cpp @@ -29,8 +29,7 @@ #include -#include - +#include #include #include @@ -131,8 +130,6 @@ SaveTool::SaveTool(const Arguments& arguments): initialiseConfiguration(); - LOG_INFO("Initialising update checker."); - curl_global_init(CURL_GLOBAL_DEFAULT); if(conf().checkUpdatesOnStartup()) { _queue.addToast(Toast::Type::Default, "Checking for updates..."_s); _updateThread = std::thread{[this]{ checkForUpdates(); }}; @@ -155,9 +152,6 @@ SaveTool::SaveTool(const Arguments& arguments): SaveTool::~SaveTool() { LOG_INFO("Cleaning up."); - LOG_INFO("Shutting libcurl down."); - curl_global_cleanup(); - SDL_RemoveTimer(_gameCheckTimerId); LOG_INFO("Saving the configuration."); diff --git a/src/SaveTool/SaveTool.h b/src/SaveTool/SaveTool.h index 9e0a8c6..e1a3077 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/SaveTool/SaveTool.h @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include #include #include @@ -40,6 +41,7 @@ #include "../ProfileManager/ProfileManager.h" #include "../MassManager/MassManager.h" #include "../ToastQueue/ToastQueue.h" +#include "../UpdateChecker/UpdateChecker.h" #ifdef SAVETOOL_DEBUG_BUILD #define tw CORRADE_TWEAKABLE @@ -83,11 +85,6 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener }; void initEvent(SDL_Event& event); - enum UpdateCheckStatus : std::int32_t { - CurlInitFailed = 0, - CurlError = 1, - CurlTimeout = 2, - }; void updateCheckEvent(SDL_Event& event); enum FileEventType: std::int32_t { @@ -260,10 +257,8 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener }; Containers::StaticArray<2, efsw::WatchID> _watchIDs; - bool _updateAvailable{false}; - Containers::String _latestVersion; - Containers::String _releaseLink; - Containers::String _downloadLink; + Containers::Optional _checker{Containers::NullOpt}; + std::mutex _checkerMutex; bool _modifiedBySaveTool{false}; bool _jointsDirty{false}; diff --git a/src/SaveTool/SaveTool_UpdateChecker.cpp b/src/SaveTool/SaveTool_UpdateChecker.cpp index a89a482..e5350b4 100644 --- a/src/SaveTool/SaveTool_UpdateChecker.cpp +++ b/src/SaveTool/SaveTool_UpdateChecker.cpp @@ -18,8 +18,6 @@ #include -#include - #include "../Logger/Logger.h" #include "SaveTool.h" @@ -28,108 +26,51 @@ void SaveTool::updateCheckEvent(SDL_Event& event) { _updateThread.join(); - if(event.user.code == CurlInitFailed) { - _queue.addToast(Toast::Type::Error, "Couldn't initialise libcurl. Update check aborted."_s); - LOG_ERROR("Couldn't initialise libcurl. Update check aborted."); - return; - } - else if(event.user.code == CurlError) { - Containers::String error{static_cast(event.user.data2), CURL_ERROR_SIZE, nullptr}; - _queue.addToast(Toast::Type::Error, error, std::chrono::milliseconds{5000}); - _queue.addToast(Toast::Type::Error, static_cast(event.user.data1), - std::chrono::milliseconds{5000}); - LOG_ERROR_FORMAT("{}: {}", static_cast(event.user.data1), static_cast(event.user.data2)); - return; - } - else if(event.user.code == CurlTimeout) { - _queue.addToast(Toast::Type::Error, "The request timed out."_s); - LOG_ERROR("The request timed out."); - return; - } - else if(event.user.code != 200) { - _queue.addToast(Toast::Type::Error, - Utility::format("The request failed with error code {}.", event.user.code)); - LOG_ERROR_FORMAT("The request failed with error code {}.", event.user.code); - return; - } + LOG_INFO("in updateCheckEvent()."); - struct Version { - explicit Version(Containers::StringView str) { - std::size_t start_point = 0; - - if(str[0] == 'v') { - start_point++; - } - - auto components = Containers::StringView{str.data() + start_point}.split('.'); - - major = std::strtol(components[0].data(), nullptr, 10); - minor = std::strtol(components[1].data(), nullptr, 10); - patch = std::strtol(components[2].data(), nullptr, 10); - - fullVersion = major * 10000 + minor * 100 + patch; - - if(str.hasSuffix("-pre")) { - prerelease = true; - } - } - std::int32_t fullVersion; - std::int32_t major = 0; - std::int32_t minor = 0; - std::int32_t patch = 0; - bool prerelease = false; - - bool operator==(const Version& other) const { - return fullVersion == other.fullVersion && prerelease == other.prerelease; - } - bool operator>(const Version& other) const { - if((fullVersion > other.fullVersion) || - (fullVersion == other.fullVersion && !prerelease && other.prerelease)) - { - return true; + switch(static_cast(event.user.code)) { + case UpdateChecker::Success: + _checkerMutex.lock(); + if(_checker->updateAvailable()) { + using namespace std::chrono_literals; + _queue.addToast(Toast::Type::Warning, + "Your version is out of date and thus unsupported.\nCheck the settings for more information."_s, 5s); } else { - return false; + if(_checker->version() == current_version || (current_version > _checker->version() && current_version.prerelease)) { + _queue.addToast(Toast::Type::Success, "The application is already up to date."_s); + } + else if(_checker->version() > current_version && !current_version.prerelease) { + _queue.addToast(Toast::Type::Warning, + "Your version is more recent than the latest one in the repo. How???"_s); + } } - } - explicit operator Containers::String() const { - return Utility::format("{}.{}.{}{}", major, minor, patch, prerelease ? "-pre" : ""); - } - }; - - static const Version current_ver{SAVETOOL_VERSION}; - - auto str = static_cast(event.user.data1); - Containers::String response{str, strlen(str), nullptr}; - auto components = response.splitOnAnyWithoutEmptyParts("\r\n"); - - Version latest_ver{components.front()}; - - if(latest_ver > current_ver) { - _queue.addToast(Toast::Type::Warning, - "Your version is out of date.\nCheck the settings for more information."_s, - std::chrono::milliseconds{5000}); - _updateAvailable = true; - _latestVersion = Containers::String{latest_ver}; - _releaseLink = Utility::format("https://williamjcm.ovh/git/williamjcm/MassBuilderSaveTool/releases/tag/v{}", - components.front()); - _downloadLink = components.back(); + _checkerMutex.unlock(); + break; + case UpdateChecker::HttpError: + _checkerMutex.lock(); + _queue.addToast(Toast::Type::Error, _checker->error()); + LOG_ERROR(_checker->error()); + _checkerMutex.unlock(); + break; + case UpdateChecker::CurlInitFailed: + _queue.addToast(Toast::Type::Error, "Couldn't initialise libcurl. Update check aborted."_s); + LOG_ERROR("Couldn't initialise libcurl. Update check aborted."); + break; + case UpdateChecker::CurlError: + { + using namespace std::chrono_literals; + _checkerMutex.lock(); + _queue.addToast(Toast::Type::Error, _checker->error(), 10s); + LOG_ERROR(_checker->error()); + _checkerMutex.unlock(); + } + break; + case UpdateChecker::CurlTimeout: + _queue.addToast(Toast::Type::Error, "The request timed out."_s); + LOG_ERROR("The request timed out."); + break; } - else if(latest_ver == current_ver || (current_ver > latest_ver && current_ver.prerelease)) { - _queue.addToast(Toast::Type::Success, "The application is already up to date."_s); - } - else if(current_ver > latest_ver && !current_ver.prerelease) { - _queue.addToast(Toast::Type::Warning, - "Your version is more recent than the latest one in the repo. How???"_s); - } -} - -inline -std::size_t -writeData(char* ptr, std::size_t size, std::size_t nmemb, Containers::String* buf) { - if(!ptr || !buf) return 0; - (*buf) = Utility::format("{}{}", *buf, Containers::StringView{ptr, size * nmemb}); - return size * nmemb; } void @@ -138,43 +79,15 @@ SaveTool::checkForUpdates() { SDL_zero(event); event.type = _updateEventId; - auto curl = curl_easy_init(); - if(!curl) { - event.user.code = CurlInitFailed; + _checkerMutex.lock(); + + if(!_checker) { + _checker.emplace(); } - if(curl) { - Containers::String response_body{Containers::AllocatedInit, ""}; - Containers::String error_buffer{ValueInit, CURL_ERROR_SIZE * 2}; + event.user.code = _checker->check(); - curl_easy_setopt(curl, CURLOPT_URL, "https://williamjcm.ovh/mbst/version"); - curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); - curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeData); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_body); - curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer.data()); - curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 0L); - curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, 10000L); - - auto code = curl_easy_perform(curl); - - if(code == CURLE_OK) { - long status = 0; - curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); - event.user.code = std::int32_t(status); - event.user.data1 = response_body.release(); - } - else if(code == CURLE_OPERATION_TIMEDOUT) { - event.user.code = CurlTimeout; - } - else { - event.user.code = CurlError; - event.user.data1 = const_cast(curl_easy_strerror(code)); - event.user.data2 = Containers::String{error_buffer}.release(); - } - - curl_easy_cleanup(curl); - } + _checkerMutex.unlock(); SDL_PushEvent(&event); } diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/SaveTool/SaveTool_drawMainMenu.cpp index fdc4d35..65185ca 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/SaveTool/SaveTool_drawMainMenu.cpp @@ -132,15 +132,16 @@ SaveTool::drawMainMenu() { _updateThread = std::thread{[this]{ checkForUpdates(); }}; } - if(_updateAvailable) { - drawAlignedText("Version %s is available.", _latestVersion.data()); + if(_checker && (_checkerMutex.try_lock() && _checker->updateAvailable())) { + drawAlignedText("Version %s is available.", Containers::String{_checker->version()}.data()); if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) { - openUri(_releaseLink); + openUri("https://williamjcm.ovh/mbst"); } ImGui::SameLine(); if(ImGui::Button(ICON_FA_DOWNLOAD " Download now")) { - openUri(_downloadLink); + openUri(_checker->downloadLink()); } + _checkerMutex.unlock(); } if(drawCheckbox("Skip disclaimer", conf().skipDisclaimer())) { diff --git a/src/UpdateChecker/UpdateChecker.cpp b/src/UpdateChecker/UpdateChecker.cpp new file mode 100644 index 0000000..abd3cc4 --- /dev/null +++ b/src/UpdateChecker/UpdateChecker.cpp @@ -0,0 +1,112 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include +#include + +#include + +#include "../Logger/Logger.h" + +#include "UpdateChecker.h" + +using namespace Corrade; + +UpdateChecker::UpdateChecker() { + LOG_INFO("Initialising update checker."); + curl_global_init(CURL_GLOBAL_DEFAULT); +} + +UpdateChecker::~UpdateChecker() { + LOG_INFO("Shutting libcurl down."); + curl_global_cleanup(); +} + +UpdateChecker::Result +UpdateChecker::check() { + auto curl = curl_easy_init(); + if(!curl) { + return Result::CurlInitFailed; + } + + Containers::ScopeGuard guard(curl, curl_easy_cleanup); + + Containers::String response_body{Containers::AllocatedInit, ""}; + Containers::String error_buffer{ValueInit, CURL_ERROR_SIZE}; + static auto write_data = [](char* ptr, std::size_t size, std::size_t nmemb, Containers::String* buf){ + if(!ptr || !buf) return std::size_t{}; + (*buf) = Utility::format("{}{}", *buf, Containers::StringView{ptr, size * nmemb}); + return size * nmemb; + }; + + curl_easy_setopt(curl, CURLOPT_URL, "https://williamjcm.ovh/mbst/version"); + curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); + curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_body); + curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer.data()); + curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 0L); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10L); + + auto code = curl_easy_perform(curl); + + if(code == CURLE_OK) { + long status = 0; + curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); + + if(status != 200) { + _error = Utility::format("The request failed with error code {}.", status); + return Result::HttpError; + } + + auto parts = response_body.splitOnAnyWithoutEmptyParts("\r\n"); + + _foundVersion = Version{parts.front()}; + _downloadLink = parts.back(); + LOG_INFO_FORMAT("Found version: {}", Containers::String{_foundVersion}); + + return Result::Success; + } + else if(code == CURLE_OPERATION_TIMEDOUT) { + return Result::CurlTimeout; + } + else { + _error = Utility::format("{}: {}", curl_easy_strerror(code), error_buffer); + return Result::CurlError; + } +} + +Containers::StringView +UpdateChecker::error() const { + return _error; +} + +bool +UpdateChecker::updateAvailable() const { + return _foundVersion > current_version; +} + +const Version& +UpdateChecker::version() const { + return _foundVersion; +} + +Containers::StringView +UpdateChecker::downloadLink() const { + return _downloadLink; +} diff --git a/src/UpdateChecker/UpdateChecker.h b/src/UpdateChecker/UpdateChecker.h new file mode 100644 index 0000000..f460010 --- /dev/null +++ b/src/UpdateChecker/UpdateChecker.h @@ -0,0 +1,49 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once + +#include "../Version/Version.h" + +class UpdateChecker { + public: + explicit UpdateChecker(); + ~UpdateChecker(); + + enum Result: std::int32_t { + Success, + HttpError, + CurlInitFailed, + CurlError, + CurlTimeout + }; + + auto check() -> Result; + + auto error() const -> Containers::StringView; + + bool updateAvailable() const; + + auto version() const -> const Version&; + + auto downloadLink() const -> Containers::StringView; + + private: + Containers::String _error; + + Version _foundVersion{}; + Containers::String _downloadLink; +}; diff --git a/src/Version/Version.h b/src/Version/Version.h new file mode 100644 index 0000000..fb1ad23 --- /dev/null +++ b/src/Version/Version.h @@ -0,0 +1,89 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#pragma once + +#include + +#include +#include +#include +#include + +using namespace Corrade; + +struct Version { + explicit Version() = default; + + explicit Version(Containers::StringView str) { + std::size_t start_point = 0; + + if(str[0] == 'v') { + start_point++; + } + + auto components = Containers::StringView{str.data() + start_point}.split('.'); + + major = std::strtol(components[0].data(), nullptr, 10); + minor = std::strtol(components[1].data(), nullptr, 10); + patch = std::strtol(components[2].data(), nullptr, 10); + + fullVersion = major * 10000 + minor * 100 + patch; + + if(str.hasSuffix("-pre")) { + prerelease = true; + } + } + + constexpr explicit Version(long major_, long minor_, long patch_, bool prerelease_): + major{major_}, minor{minor_}, patch{patch_}, prerelease{prerelease_}, + fullVersion{major_ * 10000 + minor_ * 100 + patch_} + { + //ctor + } + + long major = 0; + long minor = 0; + long patch = 0; + bool prerelease = false; + long fullVersion = 0; + + bool operator==(const Version& other) const { + return fullVersion == other.fullVersion && prerelease == other.prerelease; + } + + bool operator>(const Version& other) const { + if((fullVersion > other.fullVersion) || + (fullVersion == other.fullVersion && !prerelease && other.prerelease)) + { + return true; + } + else { + return false; + } + } + + explicit operator Containers::String() const { + return Utility::format("{}.{}.{}{}", major, minor, patch, prerelease ? "-pre" : ""); + } +}; + +constexpr Version current_version{ + SAVETOOL_VERSION_MAJOR, + SAVETOOL_VERSION_MINOR, + SAVETOOL_VERSION_PATCH, + SAVETOOL_VERSION_PRERELEASE +}; -- 2.39.5 From 938bf7b8b579c04ae09373f8ff330b9646a374f7 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:24:27 +0100 Subject: [PATCH 034/126] Logger: go back to outputting to the console. Considering I went back to Windows, this is gonna be better than outputting to a file. --- src/Logger/Logger.cpp | 14 +++++++++++--- src/Logger/Logger.h | 4 ++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index 37209c9..b550f99 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -16,10 +16,12 @@ #include +#ifndef SAVETOOL_DEBUG_BUILD #include #include -#include #include +#endif +#include #include "Logger.h" @@ -36,9 +38,9 @@ Logger::instance() { void Logger::initialise() { + #ifndef SAVETOOL_DEBUG_BUILD auto exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first(); _logFile.open(Utility::Path::join(exe_path, "SaveToolLog.txt").cbegin(), std::ios::trunc); - #ifndef SAVETOOL_DEBUG_BUILD _logFile << "In case you encounter a bug:\n" << "1. Do not run the Save Tool again, as this log will be cleared.\n" << "2. Go to either the official Sekai Project Discord guild, or the community M.A.S.S. Builder one.\n" << @@ -63,7 +65,13 @@ Logger::unindent() { void Logger::log(EntryType type, StringView location, StringView message) { - Debug d{&_logFile}; + Debug d{ + #ifdef SAVETOOL_DEBUG_BUILD + &std::cout + #else + &_logFile + #endif + }; switch(type) { case EntryType::Info: diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index 86721db..409f94f 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -18,7 +18,9 @@ #include +#ifndef SAVETOOL_DEBUG_BUILD #include +#endif #include #include @@ -58,7 +60,9 @@ class Logger { private: Logger() = default; + #ifndef SAVETOOL_DEBUG_BUILD std::ofstream _logFile; + #endif std::uint32_t _indentLevel = 0; -- 2.39.5 From 088f357a6b54fe393d958ddd5b60a9fc51abcd07 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:25:34 +0100 Subject: [PATCH 035/126] CMakeLists: fix issues finding libzip and efsw. --- src/CMakeLists.txt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 110a5b7..b13fe3d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,8 +27,10 @@ endif() find_package(Magnum REQUIRED GL Sdl2Application) find_package(MagnumIntegration REQUIRED ImGui) find_package(CURL REQUIRED HTTPS) -find_package(libzip REQUIRED) -find_package(efsw REQUIRED) +if(SAVETOOL_USE_SYSTEM_LIBS) + find_package(libzip REQUIRED) + find_package(efsw REQUIRED) +endif() set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) @@ -140,11 +142,15 @@ target_link_libraries(MassBuilderSaveTool PRIVATE MagnumIntegration::ImGui Logger UESaveFile - efsw::efsw - libzip::zip CURL::libcurl_static ) +if(SAVETOOL_USE_SYSTEM_LIBS) + target_link_libraries(MassBuilderSaveTool PRIVATE libzip::zip efsw::efsw) +else() + target_link_libraries(MassBuilderSaveTool PRIVATE zip efsw) +endif() + if(CORRADE_TARGET_WINDOWS) target_link_libraries(MassBuilderSaveTool PRIVATE Corrade::Main -- 2.39.5 From a7b0c894d07e95b510e13962c355ad0f888fdc1f Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:26:26 +0100 Subject: [PATCH 036/126] UpdateChecker: fix segfault when checking for updates. Couldn't have known the lambda would have caused issues. --- src/UpdateChecker/UpdateChecker.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/UpdateChecker/UpdateChecker.cpp b/src/UpdateChecker/UpdateChecker.cpp index abd3cc4..dd44d5b 100644 --- a/src/UpdateChecker/UpdateChecker.cpp +++ b/src/UpdateChecker/UpdateChecker.cpp @@ -37,6 +37,17 @@ UpdateChecker::~UpdateChecker() { curl_global_cleanup(); } +inline +std::size_t +writeCallback(char* data, std::size_t size, std::size_t nmemb, void* user_data) { + if(!data || !user_data) return std::size_t{}; + + auto* s = static_cast(user_data); + (*s) = (*s) + Containers::StringView{data, size * nmemb}; + + return size * nmemb; +} + UpdateChecker::Result UpdateChecker::check() { auto curl = curl_easy_init(); @@ -48,16 +59,11 @@ UpdateChecker::check() { Containers::String response_body{Containers::AllocatedInit, ""}; Containers::String error_buffer{ValueInit, CURL_ERROR_SIZE}; - static auto write_data = [](char* ptr, std::size_t size, std::size_t nmemb, Containers::String* buf){ - if(!ptr || !buf) return std::size_t{}; - (*buf) = Utility::format("{}{}", *buf, Containers::StringView{ptr, size * nmemb}); - return size * nmemb; - }; curl_easy_setopt(curl, CURLOPT_URL, "https://williamjcm.ovh/mbst/version"); curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L); curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writeCallback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response_body); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer.data()); curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 0L); -- 2.39.5 From e4ef5d44230df2d1090e9538de5cf78634c5f1fb Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:41:46 +0100 Subject: [PATCH 037/126] SaveTool: remove a debug message. --- src/SaveTool/SaveTool_UpdateChecker.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/SaveTool/SaveTool_UpdateChecker.cpp b/src/SaveTool/SaveTool_UpdateChecker.cpp index e5350b4..4492f75 100644 --- a/src/SaveTool/SaveTool_UpdateChecker.cpp +++ b/src/SaveTool/SaveTool_UpdateChecker.cpp @@ -26,8 +26,6 @@ void SaveTool::updateCheckEvent(SDL_Event& event) { _updateThread.join(); - LOG_INFO("in updateCheckEvent()."); - switch(static_cast(event.user.code)) { case UpdateChecker::Success: _checkerMutex.lock(); -- 2.39.5 From 57b4af46376b14ad0a55cd4af2ab68362640704e Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:42:15 +0100 Subject: [PATCH 038/126] SaveTool: fix the checker mutex not unlocking properly. --- src/SaveTool/SaveTool_drawMainMenu.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/SaveTool/SaveTool_drawMainMenu.cpp index 65185ca..46d930e 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/SaveTool/SaveTool_drawMainMenu.cpp @@ -132,14 +132,16 @@ SaveTool::drawMainMenu() { _updateThread = std::thread{[this]{ checkForUpdates(); }}; } - if(_checker && (_checkerMutex.try_lock() && _checker->updateAvailable())) { - drawAlignedText("Version %s is available.", Containers::String{_checker->version()}.data()); - if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) { - openUri("https://williamjcm.ovh/mbst"); - } - ImGui::SameLine(); - if(ImGui::Button(ICON_FA_DOWNLOAD " Download now")) { - openUri(_checker->downloadLink()); + if(_checker && _checkerMutex.try_lock()) { + if(_checker->updateAvailable()) { + drawAlignedText("Version %s is available.", Containers::String{_checker->version()}.data()); + if(ImGui::Button(ICON_FA_FILE_SIGNATURE " Release notes")) { + openUri("https://williamjcm.ovh/mbst"); + } + ImGui::SameLine(); + if(ImGui::Button(ICON_FA_DOWNLOAD " Download now")) { + openUri(_checker->downloadLink()); + } } _checkerMutex.unlock(); } -- 2.39.5 From 066ce6ac7034958dc5dd33c14af0ade99a5bc8b6 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 15:45:22 +0100 Subject: [PATCH 039/126] CMakeLists: only set the WIN32 property in release mode. I can't find the setting that allows CLion to capture stdout when running normally anymore, so this is the next best thing. --- src/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b13fe3d..eebfbe4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -43,7 +43,7 @@ if(CORRADE_TARGET_WINDOWS) set(SAVETOOL_RC_FILE resource.rc) endif() -add_executable(MassBuilderSaveTool WIN32 +add_executable(MassBuilderSaveTool main.cpp SaveTool/SaveTool.h SaveTool/SaveTool.cpp @@ -109,6 +109,10 @@ add_executable(MassBuilderSaveTool WIN32 ${Assets} ) +if(CORRADE_TARGET_WINDOWS) + set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE $) +endif() + if(CMAKE_BUILD_TYPE STREQUAL Debug) target_compile_definitions(Logger PRIVATE SAVETOOL_DEBUG_BUILD) target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_DEBUG_BUILD) -- 2.39.5 From 9e7547a1cdc81778da46dbbed6e255c3941894fa Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 29 Oct 2023 16:46:08 +0100 Subject: [PATCH 040/126] SaveTool: fix an issue with the file watcher. Closes #32. --- src/SaveTool/SaveTool_FileWatcher.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SaveTool/SaveTool_FileWatcher.cpp b/src/SaveTool/SaveTool_FileWatcher.cpp index 59b1f61..c35b233 100644 --- a/src/SaveTool/SaveTool_FileWatcher.cpp +++ b/src/SaveTool/SaveTool_FileWatcher.cpp @@ -49,7 +49,9 @@ SaveTool::handleFileAction(efsw::WatchID watch_id, return; } // TODO: actually do something when config files will finally be handled - if(!Utility::String::endsWith(filename, Utility::format("Profile{}.sav", _currentProfile->account()).data())) { + if(!Utility::String::endsWith(filename, Utility::format("Profile{}.sav", _currentProfile->account()).data()) && + filename.find("Unit") == std::string::npos) + { return; } @@ -83,7 +85,8 @@ SaveTool::fileUpdateEvent(SDL_Event& event) { } if(event.user.code == FileMoved) { - old_filename = Containers::String{static_cast(event.user.data2), std::strlen(static_cast(event.user.data2)), nullptr}; + old_filename = Containers::String{static_cast(event.user.data2), + std::strlen(static_cast(event.user.data2)), nullptr}; old_index = ((old_filename[_currentProfile->isDemo() ? 8 : 4] - 0x30) * 10) + (old_filename[_currentProfile->isDemo() ? 9 : 5] - 0x30); } @@ -125,8 +128,8 @@ SaveTool::fileUpdateEvent(SDL_Event& event) { } else { if(_modifiedBySaveTool && _currentMass->filename() == filename) { - auto handle = CreateFileW(Utility::Unicode::widen(Containers::StringView{filename}), GENERIC_READ, 0, - nullptr, OPEN_EXISTING, 0, nullptr); + auto handle = CreateFileW(Utility::Unicode::widen(Containers::StringView{filename}), + GENERIC_READ, 0, nullptr, OPEN_EXISTING, 0, nullptr); if(handle && handle != INVALID_HANDLE_VALUE) { CloseHandle(handle); _modifiedBySaveTool = false; -- 2.39.5 From 819e144410baf5bacf7409259d622aee0c810e59 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Wed, 29 Nov 2023 12:33:26 +0100 Subject: [PATCH 041/126] Reorganise code. This is a big one. Namespacing, general formatting updates, and renaming, among others. --- .../Application.cpp} | 56 +- .../SaveTool.h => Application/Application.h} | 86 +- .../Application_FileWatcher.cpp} | 10 +- .../Application_Initialisation.cpp} | 23 +- .../Application_MainManager.cpp} | 108 +- .../Application_MassViewer.cpp} | 60 +- .../Application_MassViewer_Armour.cpp} | 44 +- .../Application_MassViewer_Frame.cpp} | 28 +- .../Application_MassViewer_Weapons.cpp} | 120 +- .../Application_ProfileManager.cpp} | 18 +- .../Application_UpdateChecker.cpp} | 10 +- .../Application_drawAbout.cpp} | 12 +- .../Application_drawMainMenu.cpp} | 8 +- src/CMakeLists.txt | 32 +- src/Configuration/Configuration.cpp | 4 + src/Configuration/Configuration.h | 20 +- src/{UESaveFile => Gvas}/BinaryReader.cpp | 4 + src/{UESaveFile => Gvas}/BinaryReader.h | 8 +- src/{UESaveFile => Gvas}/BinaryWriter.cpp | 4 + src/{UESaveFile => Gvas}/BinaryWriter.h | 16 +- src/Gvas/CMakeLists.txt | 102 ++ src/{UESaveFile => Gvas}/Debug.cpp | 18 +- src/Gvas/Debug.h | 29 + .../UESaveFile.cpp => Gvas/File.cpp} | 35 +- src/{UESaveFile/UESaveFile.h => Gvas/File.h} | 20 +- src/Gvas/Gvas.h | 26 + .../PropertySerialiser.cpp | 114 +- src/Gvas/PropertySerialiser.h | 64 + .../AbstractUnrealCollectionProperty.h} | 28 +- .../Serialisers/AbstractUnrealProperty.h} | 24 +- .../Serialisers/AbstractUnrealStruct.h} | 17 +- .../Serialisers/ArrayProperty.cpp} | 21 +- .../Serialisers/ArrayProperty.h} | 20 +- .../Serialisers/BoolProperty.cpp} | 22 +- .../Serialisers/BoolProperty.h} | 20 +- .../Serialisers/ByteProperty.cpp} | 20 +- .../Serialisers/ByteProperty.h} | 20 +- .../Serialisers/ColourProperty.cpp} | 21 +- .../Serialisers/ColourProperty.h} | 18 +- .../Serialisers/DateTimeProperty.cpp} | 21 +- .../Serialisers/DateTimeProperty.h} | 18 +- .../Serialisers/EnumProperty.cpp} | 22 +- .../Serialisers/EnumProperty.h} | 20 +- .../Serialisers/FloatProperty.cpp} | 22 +- .../Serialisers/FloatProperty.h} | 20 +- .../Serialisers/GuidProperty.cpp} | 23 +- .../Serialisers/GuidProperty.h} | 18 +- .../Serialisers/IntProperty.cpp} | 21 +- .../Serialisers/IntProperty.h} | 18 +- .../Serialisers/MapProperty.cpp} | 27 +- .../Serialisers/MapProperty.h} | 18 +- .../Serialisers/ResourceProperty.cpp} | 31 +- .../Serialisers/ResourceProperty.h} | 18 +- .../Serialisers/RotatorProperty.cpp} | 21 +- .../Serialisers/RotatorProperty.h} | 18 +- src/Gvas/Serialisers/Serialisers.h | 44 + .../Serialisers/SetProperty.cpp} | 21 +- .../Serialisers/SetProperty.h} | 18 +- .../Serialisers/StringProperty.cpp} | 22 +- .../Serialisers/StringProperty.h} | 20 +- .../Serialisers/Struct.cpp} | 66 +- src/Gvas/Serialisers/Struct.h | 55 + .../Serialisers/TextProperty.cpp} | 25 +- .../Serialisers/TextProperty.h} | 18 +- .../Serialisers/UnrealProperty.h} | 36 +- .../Serialisers/Vector2DProperty.cpp} | 21 +- .../Serialisers/Vector2DProperty.h} | 18 +- .../Serialisers/VectorProperty.cpp} | 26 +- .../Serialisers/VectorProperty.h} | 18 +- .../Types/ArrayProperty.h | 4 + src/{UESaveFile => Gvas}/Types/BoolProperty.h | 4 + src/{UESaveFile => Gvas}/Types/ByteProperty.h | 7 +- .../Types/ColourStructProperty.h | 4 + .../Types/DateTimeStructProperty.h | 4 + src/{UESaveFile => Gvas}/Types/EnumProperty.h | 4 + .../Types/FloatProperty.h | 4 + .../Types/GenericStructProperty.h | 4 + .../Types/GuidStructProperty.h | 4 + src/{UESaveFile => Gvas}/Types/IntProperty.h | 4 + src/{UESaveFile => Gvas}/Types/MapProperty.h | 5 + src/{UESaveFile => Gvas}/Types/NoneProperty.h | 4 + .../Types/ResourceItemValue.h | 4 + .../Types/RotatorStructProperty.h | 4 + src/{UESaveFile => Gvas}/Types/SetProperty.h | 4 + .../Types/StringProperty.h | 4 + .../Types/StructProperty.h | 4 + src/{UESaveFile => Gvas}/Types/TextProperty.h | 4 + .../Debug.h => Gvas/Types/Types.h} | 36 +- .../Types/UnrealProperty.h | 4 + .../Types/UnrealPropertyBase.h | 4 + .../Types/Vector2DStructProperty.h | 4 + .../Types/VectorStructProperty.h | 4 + src/Logger/Logger.h | 4 +- src/Logger/MagnumLogBuffer.h | 2 +- src/Maps/Accessories.h | 1191 +++++++++-------- src/Maps/ArmourSets.h | 4 + src/Maps/LastMissionId.h | 56 +- src/Maps/StoryProgress.h | 4 + src/Maps/StyleNames.h | 4 + src/Maps/WeaponParts.h | 4 + src/Mass/Accessory.h | 4 + src/Mass/ArmourPart.h | 15 +- src/Mass/BulletLauncherAttachment.h | 17 +- src/Mass/CustomStyle.h | 4 + src/Mass/Decal.h | 4 + src/Mass/Joints.h | 4 + src/Mass/Mass.cpp | 40 +- src/Mass/Mass.h | 77 +- src/Mass/Mass_Armour.cpp | 118 +- src/Mass/Mass_DecalsAccessories.cpp | 114 +- src/Mass/Mass_Frame.cpp | 92 +- src/Mass/Mass_Styles.cpp | 72 +- src/Mass/Mass_Weapons.cpp | 98 +- src/Mass/Weapon.cpp | 7 +- src/Mass/Weapon.h | 30 +- src/Mass/WeaponPart.h | 4 + src/MassManager/MassManager.cpp | 28 +- src/MassManager/MassManager.h | 12 +- src/Profile/Profile.cpp | 128 +- src/Profile/Profile.h | 36 +- src/Profile/ResourceIDs.h | 4 + src/ProfileManager/ProfileManager.cpp | 21 +- src/ProfileManager/ProfileManager.h | 16 +- src/ToastQueue/ToastQueue.cpp | 4 + src/ToastQueue/ToastQueue.h | 26 +- src/UESaveFile/CMakeLists.txt | 98 -- src/UESaveFile/PropertySerialiser.h | 61 - src/UESaveFile/Serialisers/StructSerialiser.h | 51 - src/UpdateChecker/UpdateChecker.cpp | 4 + src/UpdateChecker/UpdateChecker.h | 4 + src/Utilities/Crc32.cpp | 56 + src/Utilities/Crc32.h | 38 +- src/Version/Version.cpp | 41 + src/Version/Version.h | 36 +- src/main.cpp | 6 +- 135 files changed, 2727 insertions(+), 2094 deletions(-) rename src/{SaveTool/SaveTool.cpp => Application/Application.cpp} (91%) rename src/{SaveTool/SaveTool.h => Application/Application.h} (77%) rename src/{SaveTool/SaveTool_FileWatcher.cpp => Application/Application_FileWatcher.cpp} (97%) rename src/{SaveTool/SaveTool_Initialisation.cpp => Application/Application_Initialisation.cpp} (95%) rename src/{SaveTool/SaveTool_MainManager.cpp => Application/Application_MainManager.cpp} (85%) rename src/{SaveTool/SaveTool_MassViewer.cpp => Application/Application_MassViewer.cpp} (92%) rename src/{SaveTool/SaveTool_MassViewer_Armour.cpp => Application/Application_MassViewer_Armour.cpp} (88%) rename src/{SaveTool/SaveTool_MassViewer_Frame.cpp => Application/Application_MassViewer_Frame.cpp} (93%) rename src/{SaveTool/SaveTool_MassViewer_Weapons.cpp => Application/Application_MassViewer_Weapons.cpp} (79%) rename src/{SaveTool/SaveTool_ProfileManager.cpp => Application/Application_ProfileManager.cpp} (97%) rename src/{SaveTool/SaveTool_UpdateChecker.cpp => Application/Application_UpdateChecker.cpp} (96%) rename src/{SaveTool/SaveTool_drawAbout.cpp => Application/Application_drawAbout.cpp} (98%) rename src/{SaveTool/SaveTool_drawMainMenu.cpp => Application/Application_drawMainMenu.cpp} (99%) rename src/{UESaveFile => Gvas}/BinaryReader.cpp (99%) rename src/{UESaveFile => Gvas}/BinaryReader.h (95%) rename src/{UESaveFile => Gvas}/BinaryWriter.cpp (99%) rename src/{UESaveFile => Gvas}/BinaryWriter.h (89%) create mode 100644 src/Gvas/CMakeLists.txt rename src/{UESaveFile => Gvas}/Debug.cpp (77%) create mode 100644 src/Gvas/Debug.h rename src/{UESaveFile/UESaveFile.cpp => Gvas/File.cpp} (93%) rename src/{UESaveFile/UESaveFile.h => Gvas/File.h} (83%) create mode 100644 src/Gvas/Gvas.h rename src/{UESaveFile => Gvas}/PropertySerialiser.cpp (64%) create mode 100644 src/Gvas/PropertySerialiser.h rename src/{UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h => Gvas/Serialisers/AbstractUnrealCollectionProperty.h} (58%) rename src/{UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h => Gvas/Serialisers/AbstractUnrealProperty.h} (60%) rename src/{UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h => Gvas/Serialisers/AbstractUnrealStruct.h} (69%) rename src/{UESaveFile/Serialisers/ArrayPropertySerialiser.cpp => Gvas/Serialisers/ArrayProperty.cpp} (77%) rename src/{UESaveFile/Serialisers/ArrayPropertySerialiser.h => Gvas/Serialisers/ArrayProperty.h} (60%) rename src/{UESaveFile/Serialisers/BoolPropertySerialiser.cpp => Gvas/Serialisers/BoolProperty.cpp} (74%) rename src/{UESaveFile/Serialisers/BoolPropertySerialiser.h => Gvas/Serialisers/BoolProperty.h} (61%) rename src/{UESaveFile/Serialisers/BytePropertySerialiser.cpp => Gvas/Serialisers/ByteProperty.cpp} (82%) rename src/{UESaveFile/Serialisers/BytePropertySerialiser.h => Gvas/Serialisers/ByteProperty.h} (60%) rename src/{UESaveFile/Serialisers/ColourPropertySerialiser.cpp => Gvas/Serialisers/ColourProperty.cpp} (69%) rename src/{UESaveFile/Serialisers/ColourPropertySerialiser.h => Gvas/Serialisers/ColourProperty.h} (60%) rename src/{UESaveFile/Serialisers/DateTimePropertySerialiser.cpp => Gvas/Serialisers/DateTimeProperty.cpp} (64%) rename src/{UESaveFile/Serialisers/DateTimePropertySerialiser.h => Gvas/Serialisers/DateTimeProperty.h} (60%) rename src/{UESaveFile/Serialisers/EnumPropertySerialiser.cpp => Gvas/Serialisers/EnumProperty.cpp} (74%) rename src/{UESaveFile/Serialisers/EnumPropertySerialiser.h => Gvas/Serialisers/EnumProperty.h} (60%) rename src/{UESaveFile/Serialisers/FloatPropertySerialiser.cpp => Gvas/Serialisers/FloatProperty.cpp} (72%) rename src/{UESaveFile/Serialisers/FloatPropertySerialiser.h => Gvas/Serialisers/FloatProperty.h} (60%) rename src/{UESaveFile/Serialisers/GuidPropertySerialiser.cpp => Gvas/Serialisers/GuidProperty.cpp} (62%) rename src/{UESaveFile/Serialisers/GuidPropertySerialiser.h => Gvas/Serialisers/GuidProperty.h} (60%) rename src/{UESaveFile/Serialisers/IntPropertySerialiser.cpp => Gvas/Serialisers/IntProperty.cpp} (73%) rename src/{UESaveFile/Serialisers/IntPropertySerialiser.h => Gvas/Serialisers/IntProperty.h} (60%) rename src/{UESaveFile/Serialisers/MapPropertySerialiser.cpp => Gvas/Serialisers/MapProperty.cpp} (85%) rename src/{UESaveFile/Serialisers/MapPropertySerialiser.h => Gvas/Serialisers/MapProperty.h} (60%) rename src/{UESaveFile/Serialisers/ResourcePropertySerialiser.cpp => Gvas/Serialisers/ResourceProperty.cpp} (75%) rename src/{UESaveFile/Serialisers/ResourcePropertySerialiser.h => Gvas/Serialisers/ResourceProperty.h} (60%) rename src/{UESaveFile/Serialisers/RotatorPropertySerialiser.cpp => Gvas/Serialisers/RotatorProperty.cpp} (66%) rename src/{UESaveFile/Serialisers/RotatorPropertySerialiser.h => Gvas/Serialisers/RotatorProperty.h} (60%) create mode 100644 src/Gvas/Serialisers/Serialisers.h rename src/{UESaveFile/Serialisers/SetPropertySerialiser.cpp => Gvas/Serialisers/SetProperty.cpp} (79%) rename src/{UESaveFile/Serialisers/SetPropertySerialiser.h => Gvas/Serialisers/SetProperty.h} (60%) rename src/{UESaveFile/Serialisers/StringPropertySerialiser.cpp => Gvas/Serialisers/StringProperty.cpp} (74%) rename src/{UESaveFile/Serialisers/StringPropertySerialiser.h => Gvas/Serialisers/StringProperty.h} (60%) rename src/{UESaveFile/Serialisers/StructSerialiser.cpp => Gvas/Serialisers/Struct.cpp} (72%) create mode 100644 src/Gvas/Serialisers/Struct.h rename src/{UESaveFile/Serialisers/TextPropertySerialiser.cpp => Gvas/Serialisers/TextProperty.cpp} (72%) rename src/{UESaveFile/Serialisers/TextPropertySerialiser.h => Gvas/Serialisers/TextProperty.h} (60%) rename src/{UESaveFile/Serialisers/UnrealPropertySerialiser.h => Gvas/Serialisers/UnrealProperty.h} (56%) rename src/{UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp => Gvas/Serialisers/Vector2DProperty.cpp} (65%) rename src/{UESaveFile/Serialisers/Vector2DPropertySerialiser.h => Gvas/Serialisers/Vector2DProperty.h} (60%) rename src/{UESaveFile/Serialisers/VectorPropertySerialiser.cpp => Gvas/Serialisers/VectorProperty.cpp} (67%) rename src/{UESaveFile/Serialisers/VectorPropertySerialiser.h => Gvas/Serialisers/VectorProperty.h} (60%) rename src/{UESaveFile => Gvas}/Types/ArrayProperty.h (97%) rename src/{UESaveFile => Gvas}/Types/BoolProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/ByteProperty.h (87%) rename src/{UESaveFile => Gvas}/Types/ColourStructProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/DateTimeStructProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/EnumProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/FloatProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/GenericStructProperty.h (97%) rename src/{UESaveFile => Gvas}/Types/GuidStructProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/IntProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/MapProperty.h (94%) rename src/{UESaveFile => Gvas}/Types/NoneProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/ResourceItemValue.h (97%) rename src/{UESaveFile => Gvas}/Types/RotatorStructProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/SetProperty.h (97%) rename src/{UESaveFile => Gvas}/Types/StringProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/StructProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/TextProperty.h (96%) rename src/{UESaveFile/Debug.h => Gvas/Types/Types.h} (64%) rename src/{UESaveFile => Gvas}/Types/UnrealProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/UnrealPropertyBase.h (96%) rename src/{UESaveFile => Gvas}/Types/Vector2DStructProperty.h (96%) rename src/{UESaveFile => Gvas}/Types/VectorStructProperty.h (96%) delete mode 100644 src/UESaveFile/CMakeLists.txt delete mode 100644 src/UESaveFile/PropertySerialiser.h delete mode 100644 src/UESaveFile/Serialisers/StructSerialiser.h create mode 100644 src/Utilities/Crc32.cpp create mode 100644 src/Version/Version.cpp diff --git a/src/SaveTool/SaveTool.cpp b/src/Application/Application.cpp similarity index 91% rename from src/SaveTool/SaveTool.cpp rename to src/Application/Application.cpp index 2859392..ff5efea 100644 --- a/src/SaveTool/SaveTool.cpp +++ b/src/Application/Application.cpp @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SaveTool.h" - #include #include @@ -37,6 +35,8 @@ #include "../Configuration/Configuration.h" #include "../Logger/Logger.h" +#include "Application.h" + using namespace Containers::Literals; extern const ImVec2 center_pivot = {0.5f, 0.5f}; @@ -45,7 +45,9 @@ extern const ImVec2 center_pivot = {0.5f, 0.5f}; Utility::Tweakable tweak; #endif -SaveTool::SaveTool(const Arguments& arguments): +namespace mbst { + +Application::Application(const Arguments& arguments): Platform::Sdl2Application{arguments, Configuration{}.setTitle("M.A.S.S. Builder Save Tool " SAVETOOL_VERSION_STRING " (\"" SAVETOOL_CODENAME "\")") .setSize({960, 720})} @@ -82,7 +84,7 @@ SaveTool::SaveTool(const Arguments& arguments): LOG_INFO("Registering custom events."); if((_initEventId = SDL_RegisterEvents(3)) == std::uint32_t(-1)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", - "SDL_RegisterEvents() failed in SaveTool::SaveTool(). Exiting...", window()); + "SDL_RegisterEvents() failed in Application::SaveTool(). Exiting...", window()); exit(EXIT_FAILURE); return; } @@ -118,7 +120,7 @@ SaveTool::SaveTool(const Arguments& arguments): checkGameState(); _gameCheckTimerId = SDL_AddTimer(2000, [](std::uint32_t interval, void* param)->std::uint32_t{ - static_cast(param)->checkGameState(); + static_cast(param)->checkGameState(); return interval; }, this); if(_gameCheckTimerId == 0) { @@ -149,7 +151,7 @@ SaveTool::SaveTool(const Arguments& arguments): _timeline.start(); } -SaveTool::~SaveTool() { +Application::~Application() { LOG_INFO("Cleaning up."); SDL_RemoveTimer(_gameCheckTimerId); @@ -162,7 +164,7 @@ SaveTool::~SaveTool() { } void -SaveTool::drawEvent() { +Application::drawEvent() { #ifdef SAVETOOL_DEBUG_BUILD tweak.update(); #endif @@ -183,7 +185,7 @@ SaveTool::drawEvent() { } void -SaveTool::viewportEvent(ViewportEvent& event) { +Application::viewportEvent(ViewportEvent& event) { GL::defaultFramebuffer.setViewport({{}, event.framebufferSize()}); const Vector2 size = Vector2{windowSize()}/dpiScaling(); @@ -191,32 +193,32 @@ SaveTool::viewportEvent(ViewportEvent& event) { } void -SaveTool::keyPressEvent(KeyEvent& event) { +Application::keyPressEvent(KeyEvent& event) { if(_imgui.handleKeyPressEvent(event)) return; } void -SaveTool::keyReleaseEvent(KeyEvent& event) { +Application::keyReleaseEvent(KeyEvent& event) { if(_imgui.handleKeyReleaseEvent(event)) return; } void -SaveTool::mousePressEvent(MouseEvent& event) { +Application::mousePressEvent(MouseEvent& event) { if(_imgui.handleMousePressEvent(event)) return; } void -SaveTool::mouseReleaseEvent(MouseEvent& event) { +Application::mouseReleaseEvent(MouseEvent& event) { if(_imgui.handleMouseReleaseEvent(event)) return; } void -SaveTool::mouseMoveEvent(MouseMoveEvent& event) { +Application::mouseMoveEvent(MouseMoveEvent& event) { if(_imgui.handleMouseMoveEvent(event)) return; } void -SaveTool::mouseScrollEvent(MouseScrollEvent& event) { +Application::mouseScrollEvent(MouseScrollEvent& event) { if(_imgui.handleMouseScrollEvent(event)) { event.setAccepted(); return; @@ -224,12 +226,12 @@ SaveTool::mouseScrollEvent(MouseScrollEvent& event) { } void -SaveTool::textInputEvent(TextInputEvent& event) { +Application::textInputEvent(TextInputEvent& event) { if(_imgui.handleTextInputEvent(event)) return; } void -SaveTool::anyEvent(SDL_Event& event) { +Application::anyEvent(SDL_Event& event) { if(event.type == _initEventId) { initEvent(event); } @@ -242,7 +244,7 @@ SaveTool::anyEvent(SDL_Event& event) { } void -SaveTool::drawImGui() { +Application::drawImGui() { _imgui.newFrame(); if(ImGui::GetIO().WantTextInput && !isTextInputActive()) { @@ -260,7 +262,7 @@ SaveTool::drawImGui() { } void -SaveTool::drawGui() { +Application::drawGui() { drawMainMenu(); switch(_uiState) { @@ -303,7 +305,7 @@ SaveTool::drawGui() { } void -SaveTool::drawDisclaimer() { +Application::drawDisclaimer() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(ImGui::Begin("Disclaimer##DisclaimerWindow", nullptr, @@ -371,7 +373,7 @@ SaveTool::drawDisclaimer() { } void -SaveTool::drawInitialisation() { +Application::drawInitialisation() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(ImGui::BeginPopupModal("##InitPopup", nullptr, @@ -385,7 +387,7 @@ SaveTool::drawInitialisation() { } void -SaveTool::drawGameState() { +Application::drawGameState() { ImGui::TextUnformatted("Game state:"); ImGui::SameLine(); { @@ -407,13 +409,13 @@ SaveTool::drawGameState() { } void -SaveTool::drawHelpMarker(Containers::StringView text, float wrap_pos) { +Application::drawHelpMarker(Containers::StringView text, float wrap_pos) { ImGui::TextUnformatted(ICON_FA_QUESTION_CIRCLE); drawTooltip(text, wrap_pos); } void -SaveTool::drawTooltip(Containers::StringView text, float wrap_pos) { +Application::drawTooltip(Containers::StringView text, float wrap_pos) { if(ImGui::IsItemHovered()){ ImGui::BeginTooltip(); if(wrap_pos > 0.0f) { @@ -428,12 +430,12 @@ SaveTool::drawTooltip(Containers::StringView text, float wrap_pos) { } bool -SaveTool::drawCheckbox(Containers::StringView label, bool value) { +Application::drawCheckbox(Containers::StringView label, bool value) { return ImGui::Checkbox(label.data(), &value); } void -SaveTool::openUri(Containers::StringView uri) { +Application::openUri(Containers::StringView uri) { if(!conf().isRunningInWine()) { ShellExecuteA(nullptr, nullptr, uri.data(), nullptr, nullptr, SW_SHOWDEFAULT); } @@ -443,7 +445,7 @@ SaveTool::openUri(Containers::StringView uri) { } void -SaveTool::checkGameState() { +Application::checkGameState() { WTS_PROCESS_INFOW* process_infos = nullptr; unsigned long process_count = 0; @@ -464,3 +466,5 @@ SaveTool::checkGameState() { _gameState = GameState::Unknown; } } + +} diff --git a/src/SaveTool/SaveTool.h b/src/Application/Application.h similarity index 77% rename from src/SaveTool/SaveTool.h rename to src/Application/Application.h index e1a3077..2f30b0e 100644 --- a/src/SaveTool/SaveTool.h +++ b/src/Application/Application.h @@ -51,11 +51,13 @@ using namespace Corrade; using namespace Containers::Literals; using namespace Magnum; -class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener { - public: - explicit SaveTool(const Arguments& arguments); +namespace mbst { - ~SaveTool() override; +class Application: public Platform::Sdl2Application, public efsw::FileWatchListener { + public: + explicit Application(const Arguments& arguments); + + ~Application() override; void handleFileAction(efsw::WatchID watch_id, const std::string& dir, @@ -113,20 +115,20 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawInitialisation(); void drawProfileManager(); - ImGuiID drawBackupListPopup(); - ImGuiID drawBackupProfilePopup(std::size_t profile_index); - ImGuiID drawDeleteProfilePopup(std::size_t profile_index); + auto drawBackupListPopup() -> ImGuiID; + auto drawBackupProfilePopup(std::size_t profile_index) -> ImGuiID; + auto drawDeleteProfilePopup(std::size_t profile_index) -> ImGuiID; void drawManager(); bool drawIntEditPopup(int* value_to_edit, int max); bool drawRenamePopup(Containers::ArrayView name_view); void drawGeneralInfo(); void drawResearchInventory(); - void drawMaterialRow(Containers::StringView name, std::int32_t tier, MaterialID id); + void drawMaterialRow(Containers::StringView name, std::int32_t tier, GameData::MaterialID id); void drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier); void drawMassManager(); - ImGuiID drawDeleteMassPopup(int mass_index); - ImGuiID drawDeleteStagedMassPopup(Containers::StringView filename); + auto drawDeleteMassPopup(int mass_index) -> ImGuiID; + auto drawDeleteStagedMassPopup(Containers::StringView filename) -> ImGuiID; void drawMassViewer(); void drawFrameInfo(); @@ -137,21 +139,24 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener void drawArmour(); void drawCustomArmourStyles(); void drawWeapons(); - void drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, bool& dirty, - Containers::StringView payload_type, Containers::StringView payload_tooltip); - void drawWeaponEditor(Weapon& weapon); + void drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, + bool& dirty, Containers::StringView payload_type, + Containers::StringView payload_tooltip); + void drawWeaponEditor(GameObjects::Weapon& weapon); void drawGlobalStyles(); void drawTuning(); - void drawDecalEditor(Decal& decal); - void drawAccessoryEditor(Accessory& accessory, Containers::ArrayView style_view); - Containers::StringView getStyleName(std::int32_t id, Containers::ArrayView view); + void drawDecalEditor(GameObjects::Decal& decal); + void drawAccessoryEditor(GameObjects::Accessory& accessory, + Containers::ArrayView style_view); + auto getStyleName(std::int32_t id, Containers::ArrayView view) + -> Containers::StringView; enum DCSResult { DCS_Fail, DCS_ResetStyle, DCS_Save }; - DCSResult drawCustomStyle(CustomStyle& style); + auto drawCustomStyle(GameObjects::CustomStyle& style) -> DCSResult; void drawAbout(); void drawGameState(); @@ -206,11 +211,11 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener MassViewer } _uiState{UiState::Disclaimer}; - bool _aboutPopup{false}; + bool _aboutPopup = false; #ifdef SAVETOOL_DEBUG_BUILD - bool _demoWindow{false}; - bool _styleEditor{false}; - bool _metricsWindow{false}; + bool _demoWindow = false; + bool _styleEditor = false; + bool _metricsWindow = false; #endif ToastQueue _queue; @@ -243,12 +248,12 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener SDL_TimerID _gameCheckTimerId = 0; Containers::Pointer _profileManager; - Profile* _currentProfile{nullptr}; + GameObjects::Profile* _currentProfile = nullptr; Containers::Pointer _massManager; - Mass* _currentMass{nullptr}; + GameObjects::Mass* _currentMass = nullptr; - Weapon* _currentWeapon = nullptr; + GameObjects::Weapon* _currentWeapon = nullptr; Containers::Pointer _fileWatcher; enum watchID { @@ -258,24 +263,27 @@ class SaveTool: public Platform::Sdl2Application, public efsw::FileWatchListener Containers::StaticArray<2, efsw::WatchID> _watchIDs; Containers::Optional _checker{Containers::NullOpt}; - std::mutex _checkerMutex; + std::mutex _checkerMutex; + + bool _modifiedBySaveTool = false; + bool _jointsDirty = false; + bool _stylesDirty = false; + bool _eyeFlareDirty = false; + bool _meleeDirty = false; + bool _shieldsDirty = false; + bool _bShootersDirty = false; + bool _eShootersDirty = false; + bool _bLaunchersDirty = false; + bool _eLaunchersDirty = false; - bool _modifiedBySaveTool{false}; - bool _jointsDirty{false}; - bool _stylesDirty{false}; - bool _eyeFlareDirty{false}; Containers::StaticArray<38, std::int32_t> _selectedArmourDecals{ValueInit}; Containers::StaticArray<38, std::int32_t> _selectedArmourAccessories{ValueInit}; - std::int32_t _selectedBLPlacement{0}; - std::int32_t _selectedWeaponPart{0}; - std::int32_t _selectedWeaponDecal{0}; - std::int32_t _selectedWeaponAccessory{0}; - bool _meleeDirty{false}; - bool _shieldsDirty{false}; - bool _bShootersDirty{false}; - bool _eShootersDirty{false}; - bool _bLaunchersDirty{false}; - bool _eLaunchersDirty{false}; + std::int32_t _selectedBLPlacement = 0; + std::int32_t _selectedWeaponPart = 0; + std::int32_t _selectedWeaponDecal = 0; + std::int32_t _selectedWeaponAccessory = 0; Timeline _timeline; }; + +} diff --git a/src/SaveTool/SaveTool_FileWatcher.cpp b/src/Application/Application_FileWatcher.cpp similarity index 97% rename from src/SaveTool/SaveTool_FileWatcher.cpp rename to src/Application/Application_FileWatcher.cpp index c35b233..f99f40b 100644 --- a/src/SaveTool/SaveTool_FileWatcher.cpp +++ b/src/Application/Application_FileWatcher.cpp @@ -24,10 +24,12 @@ #include #include -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::handleFileAction(efsw::WatchID watch_id, +Application::handleFileAction(efsw::WatchID watch_id, const std::string&, const std::string& filename, efsw::Action action, @@ -64,7 +66,7 @@ SaveTool::handleFileAction(efsw::WatchID watch_id, } void -SaveTool::fileUpdateEvent(SDL_Event& event) { +Application::fileUpdateEvent(SDL_Event& event) { Containers::String filename{static_cast(event.user.data1), std::strlen(static_cast(event.user.data1)), nullptr}; @@ -153,3 +155,5 @@ SaveTool::fileUpdateEvent(SDL_Event& event) { _queue.addToast(Toast::Type::Warning, "Unknown file action type"_s); } } + +} diff --git a/src/SaveTool/SaveTool_Initialisation.cpp b/src/Application/Application_Initialisation.cpp similarity index 95% rename from src/SaveTool/SaveTool_Initialisation.cpp rename to src/Application/Application_Initialisation.cpp index b6f6449..606f7cc 100644 --- a/src/SaveTool/SaveTool_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -14,7 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include #include #include #include @@ -29,10 +28,12 @@ #include "../FontAwesome/IconsFontAwesome5Brands.h" #include "../Logger/Logger.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::initEvent(SDL_Event& event) { +Application::initEvent(SDL_Event& event) { _initThread.join(); switch(event.user.code) { @@ -51,7 +52,7 @@ SaveTool::initEvent(SDL_Event& event) { } void -SaveTool::initialiseConfiguration() { +Application::initialiseConfiguration() { LOG_INFO("Reading configuration file."); setSwapInterval(conf().swapInterval()); @@ -59,7 +60,7 @@ SaveTool::initialiseConfiguration() { } void -SaveTool::initialiseGui() { +Application::initialiseGui() { LOG_INFO("Initialising Dear ImGui."); auto ctx = ImGui::CreateContext(); @@ -107,7 +108,7 @@ SaveTool::initialiseGui() { } void -SaveTool::initialiseManager() { +Application::initialiseManager() { LOG_INFO("Initialising the profile manager."); SDL_Event event; @@ -126,7 +127,7 @@ SaveTool::initialiseManager() { } auto -SaveTool::initialiseToolDirectories() -> bool { +Application::initialiseToolDirectories() -> bool { LOG_INFO("Initialising Save Tool directories."); _backupsDir = Utility::Path::join(Utility::Path::split(*Utility::Path::executableLocation()).first(), "backups"); @@ -188,7 +189,7 @@ SaveTool::initialiseToolDirectories() -> bool { } auto -SaveTool::findGameDataDirectory() -> bool { +Application::findGameDataDirectory() -> bool { LOG_INFO("Searching for the game's save directory."); wchar_t* localappdata_path = nullptr; @@ -223,16 +224,18 @@ SaveTool::findGameDataDirectory() -> bool { } void -SaveTool::initialiseMassManager() { +Application::initialiseMassManager() { LOG_INFO("Initialising the M.A.S.S. manager."); _massManager.emplace(_saveDir, _currentProfile->account(), _currentProfile->isDemo(), _stagingDir); } void -SaveTool::initialiseFileWatcher() { +Application::initialiseFileWatcher() { LOG_INFO("Initialising the file watcher."); _fileWatcher.emplace(); _watchIDs[SaveDir] = _fileWatcher->addWatch(_saveDir, this, false); _watchIDs[StagingDir] = _fileWatcher->addWatch(_stagingDir, this, false); _fileWatcher->watch(); } + +} diff --git a/src/SaveTool/SaveTool_MainManager.cpp b/src/Application/Application_MainManager.cpp similarity index 85% rename from src/SaveTool/SaveTool_MainManager.cpp rename to src/Application/Application_MainManager.cpp index b95df8d..e9861c6 100644 --- a/src/SaveTool/SaveTool_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -28,10 +28,12 @@ #include "../Maps/LastMissionId.h" #include "../Maps/StoryProgress.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::drawManager() { +Application::drawManager() { ImGui::SetNextWindowPos({0.0f, ImGui::GetItemRectSize().y}, ImGuiCond_Always); ImGui::SetNextWindowSize(ImVec2{Vector2{float(windowSize().x()), float(windowSize().y()) - ImGui::GetItemRectSize().y} / dpiScaling()}, ImGuiCond_Always); @@ -99,7 +101,7 @@ SaveTool::drawManager() { } bool -SaveTool::drawIntEditPopup(int* value_to_edit, int max) { +Application::drawIntEditPopup(int* value_to_edit, int max) { bool apply = false; if(ImGui::BeginPopup("int_edit")) { ImGui::Text("Please enter a value between 0 and %i:", max); @@ -123,7 +125,7 @@ SaveTool::drawIntEditPopup(int* value_to_edit, int max) { } bool -SaveTool::drawRenamePopup(Containers::ArrayView name_view) { +Application::drawRenamePopup(Containers::ArrayView name_view) { bool apply = false; if(ImGui::BeginPopup("name_edit")) { ImGui::TextUnformatted("Please enter a new name. Conditions:"); @@ -178,16 +180,16 @@ SaveTool::drawRenamePopup(Containers::ArrayView name_view) { } void -SaveTool::drawGeneralInfo() { +Application::drawGeneralInfo() { if(!_currentProfile) { return; } ImGui::Text("Credits: %i", _currentProfile->credits()); - auto it = std::find_if(story_progress.begin(), story_progress.end(), - [this](const StoryProgressPoint& p){ return p.id == _currentProfile->storyProgress(); }); - if(it != story_progress.end()) + auto it = std::find_if(GameData::story_progress.begin(), GameData::story_progress.end(), + [this](const GameData::StoryProgressPoint& p){ return p.id == _currentProfile->storyProgress(); }); + if(it != GameData::story_progress.end()) { ImGui::TextUnformatted("Story progress:"); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemSpacing.x / 4.0f); @@ -202,8 +204,8 @@ SaveTool::drawGeneralInfo() { ImGui::Text("Story progress: 0x%x", _currentProfile->storyProgress()); } - if(mission_id_map.find(_currentProfile->lastMissionId()) != mission_id_map.cend()) { - ImGui::Text("Last mission: %s", mission_id_map.at(_currentProfile->lastMissionId()).data()); + if(GameData::mission_id_map.find(_currentProfile->lastMissionId()) != GameData::mission_id_map.cend()) { + ImGui::Text("Last mission: %s", GameData::mission_id_map.at(_currentProfile->lastMissionId()).data()); } else if(_currentProfile->lastMissionId() == -1) { ImGui::TextUnformatted("Last mission: none"); @@ -260,7 +262,7 @@ SaveTool::drawGeneralInfo() { if(_gameState != GameState::NotRunning) { ImGui::CloseCurrentPopup(); } - for(const auto& sp : story_progress) { + for(const auto& sp : GameData::story_progress) { if(ImGui::BeginMenu(sp.chapter.data())) { if(!sp.after) { if(ImGui::MenuItem(sp.point.data())) { @@ -287,7 +289,7 @@ SaveTool::drawGeneralInfo() { } void -SaveTool::drawResearchInventory() { +Application::drawResearchInventory() { if(!_currentProfile) { return; } @@ -304,48 +306,48 @@ SaveTool::drawResearchInventory() { ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted("Engine materials"); - drawMaterialRow("Verse steel", 1, VerseSteel); - drawMaterialRow("Undinium", 2, Undinium); - drawMaterialRow("Necrium alloy", 3, NecriumAlloy); - drawMaterialRow("Lunarite", 4, Lunarite); - drawMaterialRow("Asterite", 5, Asterite); - drawMaterialRow("Hallite fragma", 6, HalliteFragma); + drawMaterialRow("Verse steel", 1, GameData::MaterialID::VerseSteel); + drawMaterialRow("Undinium", 2, GameData::MaterialID::Undinium); + drawMaterialRow("Necrium alloy", 3, GameData::MaterialID::NecriumAlloy); + drawMaterialRow("Lunarite", 4, GameData::MaterialID::Lunarite); + drawMaterialRow("Asterite", 5, GameData::MaterialID::Asterite); + drawMaterialRow("Hallite fragma", 6, GameData::MaterialID::HalliteFragma); drawUnavailableMaterialRow("Unnoctinium", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted("OS materials"); - drawMaterialRow("Ednil", 1, Ednil); - drawMaterialRow("Nuflalt", 2, Nuflalt); - drawMaterialRow("Aurelene", 3, Aurelene); - drawMaterialRow("Soldus", 4, Soldus); - drawMaterialRow("Synthesized N", 5, SynthesisedN); - drawMaterialRow("Nanoc", 6, Nanoc); + drawMaterialRow("Ednil", 1, GameData::MaterialID::Ednil); + drawMaterialRow("Nuflalt", 2, GameData::MaterialID::Nuflalt); + drawMaterialRow("Aurelene", 3, GameData::MaterialID::Aurelene); + drawMaterialRow("Soldus", 4, GameData::MaterialID::Soldus); + drawMaterialRow("Synthesized N", 5, GameData::MaterialID::SynthesisedN); + drawMaterialRow("Nanoc", 6, GameData::MaterialID::Nanoc); drawUnavailableMaterialRow("Abyssillite", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted("Architect materials"); - drawMaterialRow("Alcarbonite", 1, Alcarbonite); - drawMaterialRow("Keriphene", 2, Keriphene); - drawMaterialRow("Nitinol-CM", 3, NitinolCM); - drawMaterialRow("Quarkium", 4, Quarkium); - drawMaterialRow("Alterene", 5, Alterene); - drawMaterialRow("Cosmium", 6, Cosmium); + drawMaterialRow("Alcarbonite", 1, GameData::MaterialID::Alcarbonite); + drawMaterialRow("Keriphene", 2, GameData::MaterialID::Keriphene); + drawMaterialRow("Nitinol-CM", 3, GameData::MaterialID::NitinolCM); + drawMaterialRow("Quarkium", 4, GameData::MaterialID::Quarkium); + drawMaterialRow("Alterene", 5, GameData::MaterialID::Alterene); + drawMaterialRow("Cosmium", 6, GameData::MaterialID::Cosmium); drawUnavailableMaterialRow("Purified quarkium", 7); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted("Quark data"); - drawMaterialRow("Mixed composition", 1, MixedComposition); - drawMaterialRow("Void residue", 2, VoidResidue); - drawMaterialRow("Muscular construction", 3, MuscularConstruction); - drawMaterialRow("Mineral exoskeletology", 4, MineralExoskeletology); - drawMaterialRow("Carbonized skin", 5, CarbonisedSkin); - drawMaterialRow("Isolated void particle", 6, IsolatedVoidParticle); + drawMaterialRow("Mixed composition", 1, GameData::MaterialID::MixedComposition); + drawMaterialRow("Void residue", 2, GameData::MaterialID::VoidResidue); + drawMaterialRow("Muscular construction", 3, GameData::MaterialID::MuscularConstruction); + drawMaterialRow("Mineral exoskeletology", 4, GameData::MaterialID::MineralExoskeletology); + drawMaterialRow("Carbonized skin", 5, GameData::MaterialID::CarbonisedSkin); + drawMaterialRow("Isolated void particle", 6, GameData::MaterialID::IsolatedVoidParticle); drawUnavailableMaterialRow("Weaponised physiology", 7); ImGui::EndTable(); @@ -353,7 +355,7 @@ SaveTool::drawResearchInventory() { } void -SaveTool::drawMaterialRow(Containers::StringView name, std::int32_t tier, MaterialID id) { +Application::drawMaterialRow(Containers::StringView name, std::int32_t tier, GameData::MaterialID id) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); @@ -380,7 +382,7 @@ SaveTool::drawMaterialRow(Containers::StringView name, std::int32_t tier, Materi } void -SaveTool::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier) { +Application::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); @@ -391,7 +393,7 @@ SaveTool::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t t } void -SaveTool::drawMassManager() { +Application::drawMassManager() { if(!_massManager) { return; } @@ -426,7 +428,7 @@ SaveTool::drawMassManager() { ImGui::TableSetColumnIndex(0); ImGui::Selectable(Utility::format("{:.2d}", i + 1).data(), false, ImGuiSelectableFlags_SpanAllColumns|ImGuiSelectableFlags_AllowItemOverlap); - if(_massManager->hangar(i).state() == Mass::State::Valid && + if(_massManager->hangar(i).state() == GameObjects::Mass::State::Valid && ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) { drag_drop_index = i; @@ -440,7 +442,7 @@ SaveTool::drawMassManager() { if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("StagedMass")) { if(payload->DataSize != sizeof(Containers::String)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error", - "payload->DataSize != sizeof(Containers::String) in SaveTool::drawMassManager()", + "payload->DataSize != sizeof(Containers::String) in Application::drawMassManager()", window()); exit(EXIT_FAILURE); } @@ -454,7 +456,7 @@ SaveTool::drawMassManager() { else if((payload = ImGui::AcceptDragDropPayload("Mass"))) { if(payload->DataSize != sizeof(int)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error", - "payload->DataSize != sizeof(int) in SaveTool::drawMassManager()", + "payload->DataSize != sizeof(int) in Application::drawMassManager()", window()); exit(EXIT_FAILURE); } @@ -471,13 +473,13 @@ SaveTool::drawMassManager() { ImGui::TableSetColumnIndex(1); switch(_massManager->hangar(i).state()) { - case Mass::State::Empty: + case GameObjects::Mass::State::Empty: ImGui::TextDisabled(""); break; - case Mass::State::Invalid: + case GameObjects::Mass::State::Invalid: ImGui::TextDisabled(""); break; - case Mass::State::Valid: + case GameObjects::Mass::State::Valid: ImGui::TextUnformatted(_massManager->hangar(i).name().data()); break; } @@ -488,10 +490,10 @@ SaveTool::drawMassManager() { drawTooltip("This is the currently active frame slot."); } - if(_massManager->hangar(i).state() != Mass::State::Empty) { + if(_massManager->hangar(i).state() != GameObjects::Mass::State::Empty) { ImGui::TableSetColumnIndex(3); ImGui::PushID(i); - if(_massManager->hangar(i).state() == Mass::State::Valid) { + if(_massManager->hangar(i).state() == GameObjects::Mass::State::Valid) { if(ImGui::SmallButton(ICON_FA_SEARCH)) { _currentMass = &_massManager->hangar(i); _uiState = UiState::MassViewer; @@ -570,7 +572,7 @@ SaveTool::drawMassManager() { if(const ImGuiPayload* payload = ImGui::AcceptDragDropPayload("Mass")) { if(payload->DataSize != sizeof(int)) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Fatal error", - "payload->DataSize != sizeof(int) in SaveTool::drawMassManager()", + "payload->DataSize != sizeof(int) in Application::drawMassManager()", window()); exit(EXIT_FAILURE); } @@ -589,14 +591,14 @@ SaveTool::drawMassManager() { } ImGuiID -SaveTool::drawDeleteMassPopup(int mass_index) { +Application::drawDeleteMassPopup(int mass_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteMassConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { return ImGui::GetID("Confirmation##DeleteMassConfirmation"); } - if(_massManager->hangar(mass_index).state() == Mass::State::Empty) { + if(_massManager->hangar(mass_index).state() == GameObjects::Mass::State::Empty) { ImGui::CloseCurrentPopup(); ImGui::EndPopup(); return 0; @@ -609,7 +611,7 @@ SaveTool::drawDeleteMassPopup(int mass_index) { } ImGui::PushTextWrapPos(float(windowSize().x()) * 0.40f); - if(_massManager->hangar(mass_index).state() == Mass::State::Invalid) { + if(_massManager->hangar(mass_index).state() == GameObjects::Mass::State::Invalid) { ImGui::Text("Are you sure you want to delete the invalid M.A.S.S. data in hangar %.2i ? This operation is irreversible.", mass_index + 1); } @@ -646,7 +648,7 @@ SaveTool::drawDeleteMassPopup(int mass_index) { } ImGuiID -SaveTool::drawDeleteStagedMassPopup(Containers::StringView filename) { +Application::drawDeleteStagedMassPopup(Containers::StringView filename) { if(!ImGui::BeginPopupModal("Confirmation##DeleteStagedMassConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { @@ -683,3 +685,5 @@ SaveTool::drawDeleteStagedMassPopup(Containers::StringView filename) { return 0; } + +} diff --git a/src/SaveTool/SaveTool_MassViewer.cpp b/src/Application/Application_MassViewer.cpp similarity index 92% rename from src/SaveTool/SaveTool_MassViewer.cpp rename to src/Application/Application_MassViewer.cpp index 4bb3da2..6af7887 100644 --- a/src/SaveTool/SaveTool_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -25,11 +25,13 @@ #define STYLENAMES_DEFINITION #include "../Maps/StyleNames.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::drawMassViewer() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawMassViewer() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { _currentMass = nullptr; _currentWeapon = nullptr; _uiState = UiState::MainManager; @@ -156,8 +158,8 @@ SaveTool::drawMassViewer() { } void -SaveTool::drawGlobalStyles() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawGlobalStyles() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -193,8 +195,8 @@ SaveTool::drawGlobalStyles() { } void -SaveTool::drawTuning() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawTuning() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -289,9 +291,9 @@ SaveTool::drawTuning() { ImGui::EndTable(); } -SaveTool::DCSResult -SaveTool::drawCustomStyle(CustomStyle& style) { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::DCSResult +Application::drawCustomStyle(GameObjects::CustomStyle& style) { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return DCS_Fail; } @@ -396,7 +398,7 @@ SaveTool::drawCustomStyle(CustomStyle& style) { } void -SaveTool::drawDecalEditor(Decal& decal) { +Application::drawDecalEditor(GameObjects::Decal& decal) { ImGui::Text("ID: %i", decal.id); if(ImGui::BeginTable("##DecalTable", conf().advancedMode() ? 2 : 1, ImGuiTableFlags_BordersInnerV)) { @@ -501,12 +503,12 @@ SaveTool::drawDecalEditor(Decal& decal) { } void -SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView style_view) { +Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers::ArrayView style_view) { if(accessory.id < 1) { ImGui::TextUnformatted("Accessory: "); } - else if(accessories.find(accessory.id) != accessories.cend()) { - ImGui::Text("Accessory #%.4i - %s", accessory.id, accessories.at(accessory.id).name.data()); + else if(GameData::accessories.find(accessory.id) != GameData::accessories.cend()) { + ImGui::Text("Accessory #%.4i - %s", accessory.id, GameData::accessories.at(accessory.id).name.data()); } else { ImGui::Text("Accessory #%i", accessory.id); @@ -516,7 +518,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView size = Containers::NullOpt; + static Containers::Optional size = Containers::NullOpt; if(ImGui::SmallButton("Change")) { ImGui::OpenPopup("##AccessoryPopup"); if(accessory.id >= 3000) { @@ -574,45 +576,45 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView= tab * 1000 && acc.first < ((tab + 1) * 1000) && (!size || *size == acc.second.size)) { if(ImGui::Selectable(Utility::format("#{:.4d} - {} ({})", acc.first, acc.second.name, size_labels[acc.second.size]).data(), acc.first == accessory.id)) @@ -658,7 +660,7 @@ SaveTool::drawAccessoryEditor(Accessory& accessory, Containers::ArrayView view) { +Application::getStyleName(std::int32_t id, Containers::ArrayView view) { if(id >= 0 && id <= 15) { return view[id].name; } @@ -748,6 +750,8 @@ SaveTool::getStyleName(std::int32_t id, Containers::ArrayView view) return _currentMass->globalStyles()[id - 50].name; } else { - return style_names.at(id); + return GameData::style_names.at(id); } } + +} diff --git a/src/SaveTool/SaveTool_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp similarity index 88% rename from src/SaveTool/SaveTool_MassViewer_Armour.cpp rename to src/Application/Application_MassViewer_Armour.cpp index 2733a78..769dcc3 100644 --- a/src/SaveTool/SaveTool_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -19,11 +19,13 @@ #include "../Maps/ArmourSets.h" #include "../Maps/StyleNames.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::drawArmour() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawArmour() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -52,11 +54,17 @@ SaveTool::drawArmour() { std::memset(header, '\0', 129); - if(armour_sets.find(part.id) != armour_sets.cend()) { - std::snprintf(header, 128, "%s: %s###%u", slot_labels[std::uint32_t(part.slot)].data(), armour_sets.at(part.id).name.data(), std::uint32_t(part.slot)); + if(GameData::armour_sets.find(part.id) != GameData::armour_sets.cend()) { + std::snprintf(header, 128, "%s: %s###%u", + slot_labels[std::uint32_t(part.slot)].data(), + GameData::armour_sets.at(part.id).name.data(), + std::uint32_t(part.slot)); } else { - std::snprintf(header, 128, "%s: %i###%u", slot_labels[std::uint32_t(part.slot)].data(), part.id, std::uint32_t(part.slot)); + std::snprintf(header, 128, "%s: %i###%u", + slot_labels[std::uint32_t(part.slot)].data(), + part.id, + std::uint32_t(part.slot)); } if(ImGui::CollapsingHeader(header)) { @@ -65,14 +73,14 @@ SaveTool::drawArmour() { ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.491f); if(ImGui::BeginListBox("##ChangePart")) { if(std::strncmp("Neck", slot_labels[std::uint32_t(part.slot)].data(), 4) != 0) { - for(auto& set : armour_sets) { + for(auto& set : GameData::armour_sets) { if(ImGui::Selectable(set.second.name.data(), set.first == part.id, ImGuiSelectableFlags_SpanAvailWidth)) { part.id = set.first; } } } else { - for(auto& set : armour_sets) { + for(auto& set : GameData::armour_sets) { if(!set.second.neck_compatible) { continue; } @@ -106,7 +114,7 @@ SaveTool::drawArmour() { ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 2.0f); if(ImGui::BeginCombo("##Style", getStyleName(part.styles[j], _currentMass->armourCustomStyles()).data())) { - for(const auto& style : style_names) { + for(const auto& style : GameData::style_names) { if(ImGui::Selectable(getStyleName(style.first, _currentMass->armourCustomStyles()).data(), part.styles[j] == style.first)) { part.styles[j] = style.first; } @@ -164,19 +172,19 @@ SaveTool::drawArmour() { ImGui::PopID(); } - if(_currentMass->bulletLauncherAttachmentStyle() != BulletLauncherAttachmentStyle::NotFound && + if(_currentMass->bulletLauncherAttachmentStyle() != GameObjects::BulletLauncherAttachmentStyle::NotFound && ImGui::CollapsingHeader("Bullet launcher placement")) { drawAlignedText("Attachment style:"_s); ImGui::SameLine(); ImGui::RadioButton("Active one", - _currentMass->bulletLauncherAttachmentStyle() == BulletLauncherAttachmentStyle::ActiveOne); + _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOne); ImGui::SameLine(); ImGui::RadioButton("Active one per slot", - _currentMass->bulletLauncherAttachmentStyle() == BulletLauncherAttachmentStyle::ActiveOnePerSlot); + _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot); ImGui::SameLine(); ImGui::RadioButton("All equipped", - _currentMass->bulletLauncherAttachmentStyle() == BulletLauncherAttachmentStyle::AllEquipped); + _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::AllEquipped); ImGui::Separator(); @@ -203,13 +211,13 @@ SaveTool::drawArmour() { if(ImGui::BeginCombo("##Socket", socket_labels[std::uint32_t(placement.socket)].data())) { for(std::uint32_t i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) { if(ImGui::Selectable(socket_labels[i].data(), i == std::uint32_t(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) { - placement.socket = static_cast(i); + placement.socket = static_cast(i); } } ImGui::EndCombo(); } - if(placement.socket != BulletLauncherSocket::Auto) { + if(placement.socket != GameObjects::BulletLauncherAttachment::Socket::Auto) { ImGui::BeginGroup(); drawAlignedText("Relative position:"); drawAlignedText("Offset position:"); @@ -290,8 +298,8 @@ SaveTool::drawArmour() { } void -SaveTool::drawCustomArmourStyles() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawCustomArmourStyles() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -325,3 +333,5 @@ SaveTool::drawCustomArmourStyles() { ImGui::EndChild(); } + +} diff --git a/src/SaveTool/SaveTool_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp similarity index 93% rename from src/SaveTool/SaveTool_MassViewer_Frame.cpp rename to src/Application/Application_MassViewer_Frame.cpp index 7b93155..445b561 100644 --- a/src/SaveTool/SaveTool_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -17,11 +17,13 @@ #include "../FontAwesome/IconsFontAwesome5.h" #include "../Maps/StyleNames.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::drawFrameInfo() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawFrameInfo() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -81,8 +83,8 @@ SaveTool::drawFrameInfo() { } void -SaveTool::drawJointSliders() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawJointSliders() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -204,8 +206,8 @@ SaveTool::drawJointSliders() { } void -SaveTool::drawFrameStyles() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawFrameStyles() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -217,7 +219,7 @@ SaveTool::drawFrameStyles() { ImGui::PushID(i); if(ImGui::BeginCombo("##Style", getStyleName(_currentMass->frameStyles()[i], _currentMass->frameCustomStyles()).data())) { - for(const auto& style : style_names) { + for(const auto& style : GameData::style_names) { if(ImGui::Selectable(getStyleName(style.first, _currentMass->frameCustomStyles()).data(), _currentMass->frameStyles()[i] == style.first)) { _currentMass->frameStyles()[i] = style.first; _stylesDirty = true; @@ -255,8 +257,8 @@ SaveTool::drawFrameStyles() { } void -SaveTool::drawEyeColourPicker() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawEyeColourPicker() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -289,8 +291,8 @@ SaveTool::drawEyeColourPicker() { } void -SaveTool::drawCustomFrameStyles() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawCustomFrameStyles() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { return; } @@ -324,3 +326,5 @@ SaveTool::drawCustomFrameStyles() { ImGui::EndChild(); } + +} diff --git a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp similarity index 79% rename from src/SaveTool/SaveTool_MassViewer_Weapons.cpp rename to src/Application/Application_MassViewer_Weapons.cpp index c60cdc9..6f56390 100644 --- a/src/SaveTool/SaveTool_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -19,11 +19,13 @@ #include "../Maps/StyleNames.h" #include "../Maps/WeaponParts.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::drawWeapons() { - if(!_currentMass || _currentMass->state() != Mass::State::Valid) { +Application::drawWeapons() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { _currentWeapon = nullptr; return; } @@ -179,37 +181,37 @@ SaveTool::drawWeapons() { if(drawUnsafeWidget([](){ return ImGui::Button(ICON_FA_SAVE " Save changes to weapon category"); })) { _modifiedBySaveTool = true; switch(_currentWeapon->type) { - case WeaponType::Melee: + case GameObjects::Weapon::Type::Melee: if(!_currentMass->writeMeleeWeapons()) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); } break; - case WeaponType::Shield: + case GameObjects::Weapon::Type::Shield: if(!_currentMass->writeShields()) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); } break; - case WeaponType::BulletShooter: + case GameObjects::Weapon::Type::BulletShooter: if(!_currentMass->writeBulletShooters()) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); } break; - case WeaponType::EnergyShooter: + case GameObjects::Weapon::Type::EnergyShooter: if(!_currentMass->writeEnergyShooters()) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); } break; - case WeaponType::BulletLauncher: + case GameObjects::Weapon::Type::BulletLauncher: if(!_currentMass->writeBulletLaunchers()) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); } break; - case WeaponType::EnergyLauncher: + case GameObjects::Weapon::Type::EnergyLauncher: if(!_currentMass->writeEnergyLaunchers()) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); @@ -225,22 +227,22 @@ SaveTool::drawWeapons() { if(ImGui::Button(ICON_FA_UNDO_ALT " Reset weapon category")) { switch(_currentWeapon->type) { - case WeaponType::Melee: + case GameObjects::Weapon::Type::Melee: _currentMass->getMeleeWeapons(); break; - case WeaponType::Shield: + case GameObjects::Weapon::Type::Shield: _currentMass->getShields(); break; - case WeaponType::BulletShooter: + case GameObjects::Weapon::Type::BulletShooter: _currentMass->getBulletShooters(); break; - case WeaponType::EnergyShooter: + case GameObjects::Weapon::Type::EnergyShooter: _currentMass->getEnergyShooters(); break; - case WeaponType::BulletLauncher: + case GameObjects::Weapon::Type::BulletLauncher: _currentMass->getBulletLaunchers(); break; - case WeaponType::EnergyLauncher: + case GameObjects::Weapon::Type::EnergyLauncher: _currentMass->getEnergyLaunchers(); break; default: @@ -252,7 +254,7 @@ SaveTool::drawWeapons() { } void -SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, bool& dirty, +Application::drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, bool& dirty, Containers::StringView payload_type, Containers::StringView payload_tooltip) { ImGui::TableNextRow(ImGuiTableRowFlags_Headers); @@ -316,8 +318,8 @@ SaveTool::drawWeaponCategory(Containers::StringView name, Containers::ArrayView< } void -SaveTool::drawWeaponEditor(Weapon& weapon) { - if(!_currentMass || _currentMass->state() != Mass::State::Valid || !_currentWeapon) { +Application::drawWeaponEditor(GameObjects::Weapon& weapon) { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid || !_currentWeapon) { return; } @@ -346,11 +348,11 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::BeginGroup(); drawAlignedText("Equipped:"); - if(weapon.type != WeaponType::Shield) { + if(weapon.type != GameObjects::Weapon::Type::Shield) { drawAlignedText("Damage type:"); } - if(weapon.type == WeaponType::Melee) { + if(weapon.type == GameObjects::Weapon::Type::Melee) { drawAlignedText("Dual-wield:"); drawAlignedText("Custom effect mode:"); @@ -364,48 +366,48 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::BeginGroup(); ImGui::Checkbox("##EquippedCheckbox", &weapon.attached); - if(weapon.type != WeaponType::Shield) { - if(weapon.type == WeaponType::Melee && - ImGui::RadioButton("Physical##NoElement", weapon.damageType == DamageType::Physical)) + if(weapon.type != GameObjects::Weapon::Type::Shield) { + if(weapon.type == GameObjects::Weapon::Type::Melee && + ImGui::RadioButton("Physical##NoElement", weapon.damageType == GameObjects::Weapon::DamageType::Physical)) { - weapon.damageType = DamageType::Physical; + weapon.damageType = GameObjects::Weapon::DamageType::Physical; } - else if((weapon.type == WeaponType::BulletShooter || weapon.type == WeaponType::BulletLauncher) && - ImGui::RadioButton("Piercing##NoElement", weapon.damageType == DamageType::Piercing)) + else if((weapon.type == GameObjects::Weapon::Type::BulletShooter || weapon.type == GameObjects::Weapon::Type::BulletLauncher) && + ImGui::RadioButton("Piercing##NoElement", weapon.damageType == GameObjects::Weapon::DamageType::Piercing)) { - weapon.damageType = DamageType::Piercing; + weapon.damageType = GameObjects::Weapon::DamageType::Piercing; } - else if((weapon.type == WeaponType::EnergyShooter || weapon.type == WeaponType::EnergyLauncher) && - ImGui::RadioButton("Plasma##NoElement", weapon.damageType == DamageType::Plasma)) + else if((weapon.type == GameObjects::Weapon::Type::EnergyShooter || weapon.type == GameObjects::Weapon::Type::EnergyLauncher) && + ImGui::RadioButton("Plasma##NoElement", weapon.damageType == GameObjects::Weapon::DamageType::Plasma)) { - weapon.damageType = DamageType::Plasma; + weapon.damageType = GameObjects::Weapon::DamageType::Plasma; } ImGui::SameLine(); - if(ImGui::RadioButton("Heat##Heat", weapon.damageType == DamageType::Heat)) { - weapon.damageType = DamageType::Heat; + if(ImGui::RadioButton("Heat##Heat", weapon.damageType == GameObjects::Weapon::DamageType::Heat)) { + weapon.damageType = GameObjects::Weapon::DamageType::Heat; } ImGui::SameLine(); - if(ImGui::RadioButton("Freeze##Freeze", weapon.damageType == DamageType::Freeze)) { - weapon.damageType = DamageType::Freeze; + if(ImGui::RadioButton("Freeze##Freeze", weapon.damageType == GameObjects::Weapon::DamageType::Freeze)) { + weapon.damageType = GameObjects::Weapon::DamageType::Freeze; } ImGui::SameLine(); - if(ImGui::RadioButton("Shock##Shock", weapon.damageType == DamageType::Shock)) { - weapon.damageType = DamageType::Shock; + if(ImGui::RadioButton("Shock##Shock", weapon.damageType == GameObjects::Weapon::DamageType::Shock)) { + weapon.damageType = GameObjects::Weapon::DamageType::Shock; } } - if(weapon.type == WeaponType::Melee) { + if(weapon.type == GameObjects::Weapon::Type::Melee) { ImGui::Checkbox("##DualWield", &weapon.dualWield); - if(ImGui::RadioButton("Default##Default", weapon.effectColourMode == EffectColourMode::Default)) { - weapon.effectColourMode = EffectColourMode::Default; + if(ImGui::RadioButton("Default##Default", weapon.effectColourMode == GameObjects::Weapon::EffectColourMode::Default)) { + weapon.effectColourMode = GameObjects::Weapon::EffectColourMode::Default; } ImGui::SameLine(); - if(ImGui::RadioButton("Custom##Custom", weapon.effectColourMode == EffectColourMode::Custom)) { - weapon.effectColourMode = EffectColourMode::Custom; + if(ImGui::RadioButton("Custom##Custom", weapon.effectColourMode == GameObjects::Weapon::EffectColourMode::Custom)) { + weapon.effectColourMode = GameObjects::Weapon::EffectColourMode::Custom; } - bool custom_effect = (weapon.effectColourMode == EffectColourMode::Custom); + bool custom_effect = (weapon.effectColourMode == GameObjects::Weapon::EffectColourMode::Custom); if(!custom_effect) { ImGui::BeginDisabled(); } @@ -436,18 +438,18 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { const auto* map = [this, &weapon]()-> const std::map* { switch(weapon.type) { - case WeaponType::Melee: - return _selectedWeaponPart == 0 ? &melee_grips : &melee_assaulters; - case WeaponType::Shield: - return _selectedWeaponPart == 0 ? &shield_handles : &shield_shells; - case WeaponType::BulletShooter: - return _selectedWeaponPart == 0 ? &bshooter_triggers : &bshooter_barrels; - case WeaponType::EnergyShooter: - return _selectedWeaponPart == 0 ? &eshooter_triggers : &eshooter_busters; - case WeaponType::BulletLauncher: - return _selectedWeaponPart == 0 ? &blauncher_pods : &blauncher_projectiles; - case WeaponType::EnergyLauncher: - return _selectedWeaponPart == 0 ? &elauncher_generators : &elauncher_pods; + case GameObjects::Weapon::Type::Melee: + return _selectedWeaponPart == 0 ? &GameData::melee_grips : &GameData::melee_assaulters; + case GameObjects::Weapon::Type::Shield: + return _selectedWeaponPart == 0 ? &GameData::shield_handles : &GameData::shield_shells; + case GameObjects::Weapon::Type::BulletShooter: + return _selectedWeaponPart == 0 ? &GameData::bshooter_triggers : &GameData::bshooter_barrels; + case GameObjects::Weapon::Type::EnergyShooter: + return _selectedWeaponPart == 0 ? &GameData::eshooter_triggers : &GameData::eshooter_busters; + case GameObjects::Weapon::Type::BulletLauncher: + return _selectedWeaponPart == 0 ? &GameData::blauncher_pods : &GameData::blauncher_projectiles; + case GameObjects::Weapon::Type::EnergyLauncher: + return _selectedWeaponPart == 0 ? &GameData::elauncher_generators : &GameData::elauncher_pods; } return nullptr; @@ -489,14 +491,14 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { } } - if(weapon.type == WeaponType::Shield || - (weapon.type == WeaponType::BulletLauncher && _selectedWeaponPart != 0)) + if(weapon.type == GameObjects::Weapon::Type::Shield || + (weapon.type == GameObjects::Weapon::Type::BulletLauncher && _selectedWeaponPart != 0)) { ImGui::SameLine(); if(ImGui::SmallButton("Unequip")) { part.id = -1; } - if(weapon.type == WeaponType::Shield && _selectedWeaponPart == 0) { + if(weapon.type == GameObjects::Weapon::Type::Shield && _selectedWeaponPart == 0) { drawTooltip("This will make the whole shield and its accessories invisible."); } else { @@ -515,7 +517,7 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::PushID(i); if(ImGui::BeginCombo("##Style", getStyleName(part.styles[i], weapon.customStyles).data())) { - for(const auto& style: style_names) { + for(const auto& style: GameData::style_names) { if(ImGui::Selectable(getStyleName(style.first, weapon.customStyles).data(), part.styles[i] == style.first)) { part.styles[i] = style.first; @@ -562,3 +564,5 @@ SaveTool::drawWeaponEditor(Weapon& weapon) { ImGui::EndChild(); } } + +} diff --git a/src/SaveTool/SaveTool_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp similarity index 97% rename from src/SaveTool/SaveTool_ProfileManager.cpp rename to src/Application/Application_ProfileManager.cpp index cdeb37e..548a096 100644 --- a/src/SaveTool/SaveTool_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -20,12 +20,14 @@ #include "../FontAwesome/IconsFontAwesome5.h" -#include "SaveTool.h" +#include "Application.h" extern const ImVec2 center_pivot; +namespace mbst { + void -SaveTool::drawProfileManager() { +Application::drawProfileManager() { static std::size_t profile_index = 0; ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); @@ -81,7 +83,7 @@ SaveTool::drawProfileManager() { ImGui::TextUnformatted("Actions"); for(std::size_t i = 0; i < _profileManager->profiles().size(); ++i) { - Profile& profile = _profileManager->profiles()[i]; + GameObjects::Profile& profile = _profileManager->profiles()[i]; ImGui::TableNextRow(); @@ -127,7 +129,7 @@ SaveTool::drawProfileManager() { } ImGuiID -SaveTool::drawBackupListPopup() { +Application::drawBackupListPopup() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(!ImGui::BeginPopupModal("Backups##BackupsModal", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) @@ -283,7 +285,7 @@ SaveTool::drawBackupListPopup() { backup.timestamp.second); ImGui::TableSetColumnIndex(2); - ImGui::TextUnformatted(backup.type == ProfileType::Demo ? "Demo" : "Full"); + ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); ImGui::TableSetColumnIndex(3); ImGui::PushID(int(i)); @@ -327,7 +329,7 @@ SaveTool::drawBackupListPopup() { } ImGuiID -SaveTool::drawBackupProfilePopup(std::size_t profile_index) { +Application::drawBackupProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Include builds ?##IncludeBuildsDialog", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { @@ -372,7 +374,7 @@ SaveTool::drawBackupProfilePopup(std::size_t profile_index) { } ImGuiID -SaveTool::drawDeleteProfilePopup(std::size_t profile_index) { +Application::drawDeleteProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteProfileConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { @@ -417,3 +419,5 @@ SaveTool::drawDeleteProfilePopup(std::size_t profile_index) { return 0; } + +} diff --git a/src/SaveTool/SaveTool_UpdateChecker.cpp b/src/Application/Application_UpdateChecker.cpp similarity index 96% rename from src/SaveTool/SaveTool_UpdateChecker.cpp rename to src/Application/Application_UpdateChecker.cpp index 4492f75..6fe63c1 100644 --- a/src/SaveTool/SaveTool_UpdateChecker.cpp +++ b/src/Application/Application_UpdateChecker.cpp @@ -20,10 +20,12 @@ #include "../Logger/Logger.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::updateCheckEvent(SDL_Event& event) { +Application::updateCheckEvent(SDL_Event& event) { _updateThread.join(); switch(static_cast(event.user.code)) { @@ -72,7 +74,7 @@ SaveTool::updateCheckEvent(SDL_Event& event) { } void -SaveTool::checkForUpdates() { +Application::checkForUpdates() { SDL_Event event; SDL_zero(event); event.type = _updateEventId; @@ -89,3 +91,5 @@ SaveTool::checkForUpdates() { SDL_PushEvent(&event); } + +} diff --git a/src/SaveTool/SaveTool_drawAbout.cpp b/src/Application/Application_drawAbout.cpp similarity index 98% rename from src/SaveTool/SaveTool_drawAbout.cpp rename to src/Application/Application_drawAbout.cpp index 1598e35..c68472d 100644 --- a/src/SaveTool/SaveTool_drawAbout.cpp +++ b/src/Application/Application_drawAbout.cpp @@ -14,8 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "SaveTool.h" - #include #include @@ -29,10 +27,14 @@ #include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5Brands.h" +#include "Application.h" + extern const ImVec2 center_pivot; +namespace mbst { + void -SaveTool::drawAbout() { +Application::drawAbout() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f}}, ImGuiCond_Always, center_pivot); ImGui::SetNextWindowSize({float(windowSize().x()) * 0.8f, float(windowSize().y()) * 0.75f}, ImGuiCond_Always); @@ -60,7 +62,7 @@ SaveTool::drawAbout() { ImGui::TextWrapped("This application, made for the M.A.S.S. Builder community by Guillaume Jacquemin (aka William JCM), " "is a rewrite of the wxWidgets-powered M.A.S.S. Builder Save Tool (formerly known as wxMASSManager)."); - auto website = "https://williamjcm.ovh/coding/mbst"; + auto website = "https://williamjcm.ovh/mbst"; drawAlignedText(ICON_FA_GLOBE " %s", website); ImGui::SameLine(); if(ImGui::Button("Copy to clipboard")) { @@ -267,3 +269,5 @@ SaveTool::drawAbout() { ImGui::EndPopup(); } + +} diff --git a/src/SaveTool/SaveTool_drawMainMenu.cpp b/src/Application/Application_drawMainMenu.cpp similarity index 99% rename from src/SaveTool/SaveTool_drawMainMenu.cpp rename to src/Application/Application_drawMainMenu.cpp index 46d930e..290e8cd 100644 --- a/src/SaveTool/SaveTool_drawMainMenu.cpp +++ b/src/Application/Application_drawMainMenu.cpp @@ -20,10 +20,12 @@ #include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5Brands.h" -#include "SaveTool.h" +#include "Application.h" + +namespace mbst { void -SaveTool::drawMainMenu() { +Application::drawMainMenu() { if(!ImGui::BeginMainMenuBar()) { return; } @@ -239,3 +241,5 @@ SaveTool::drawMainMenu() { ImGui::EndMainMenuBar(); } + +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eebfbe4..f72df89 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,7 +37,7 @@ set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) corrade_add_resource(Assets assets.conf) add_subdirectory(Logger EXCLUDE_FROM_ALL) -add_subdirectory(UESaveFile EXCLUDE_FROM_ALL) +add_subdirectory(Gvas EXCLUDE_FROM_ALL) if(CORRADE_TARGET_WINDOWS) set(SAVETOOL_RC_FILE resource.rc) @@ -45,19 +45,19 @@ endif() add_executable(MassBuilderSaveTool main.cpp - SaveTool/SaveTool.h - SaveTool/SaveTool.cpp - SaveTool/SaveTool_drawAbout.cpp - SaveTool/SaveTool_drawMainMenu.cpp - SaveTool/SaveTool_FileWatcher.cpp - SaveTool/SaveTool_Initialisation.cpp - SaveTool/SaveTool_MainManager.cpp - SaveTool/SaveTool_MassViewer.cpp - SaveTool/SaveTool_MassViewer_Frame.cpp - SaveTool/SaveTool_MassViewer_Armour.cpp - SaveTool/SaveTool_MassViewer_Weapons.cpp - SaveTool/SaveTool_ProfileManager.cpp - SaveTool/SaveTool_UpdateChecker.cpp + Application/Application.h + Application/Application.cpp + Application/Application_drawAbout.cpp + Application/Application_drawMainMenu.cpp + Application/Application_FileWatcher.cpp + Application/Application_Initialisation.cpp + Application/Application_MainManager.cpp + Application/Application_MassViewer.cpp + Application/Application_MassViewer_Frame.cpp + Application/Application_MassViewer_Armour.cpp + Application/Application_MassViewer_Weapons.cpp + Application/Application_ProfileManager.cpp + Application/Application_UpdateChecker.cpp Configuration/Configuration.h Configuration/Configuration.cpp ProfileManager/ProfileManager.h @@ -102,7 +102,9 @@ add_executable(MassBuilderSaveTool UpdateChecker/UpdateChecker.h UpdateChecker/UpdateChecker.cpp Utilities/Crc32.h + Utilities/Crc32.cpp Version/Version.h + Version/Version.cpp FontAwesome/IconsFontAwesome5.h FontAwesome/IconsFontAwesome5Brands.h ${SAVETOOL_RC_FILE} @@ -145,7 +147,7 @@ target_link_libraries(MassBuilderSaveTool PRIVATE Magnum::Sdl2Application MagnumIntegration::ImGui Logger - UESaveFile + Gvas CURL::libcurl_static ) diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index 12c5555..038b5c8 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -20,6 +20,8 @@ #include "Configuration.h" +namespace mbst { + Configuration::Configuration() { Containers::String exe_path = Utility::Path::split(*Utility::Path::executableLocation()).first(); _conf = Utility::Configuration{Utility::Path::join(exe_path, "MassBuilderSaveTool.ini")}; @@ -174,3 +176,5 @@ Configuration& conf() { return Configuration::instance(); } + +} diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index a685e30..c3be643 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -20,18 +20,20 @@ using namespace Corrade; +namespace mbst { + class Configuration { public: - static Configuration& instance(); + static auto instance() -> Configuration&; ~Configuration(); void save(); - int swapInterval() const; + auto swapInterval() const -> int; void setSwapInterval(int interval); - float fpsCap() const; + auto fpsCap() const -> float; void setFpsCap(float cap); bool cheatMode() const; @@ -54,14 +56,16 @@ class Configuration { Utility::Configuration _conf; - int _swapInterval = 1; + int _swapInterval = 1; float _fpsCap = 60.0f; - bool _cheatMode = false; - bool _advancedMode = false; - bool _checkUpdatesOnStartup = true; - bool _skipDisclaimer = false; + bool _cheatMode = false; + bool _advancedMode = false; + bool _checkUpdatesOnStartup = true; + bool _skipDisclaimer = false; bool _isRunningInWine = false; }; Configuration& conf(); + +} diff --git a/src/UESaveFile/BinaryReader.cpp b/src/Gvas/BinaryReader.cpp similarity index 99% rename from src/UESaveFile/BinaryReader.cpp rename to src/Gvas/BinaryReader.cpp index 131607d..91e69c8 100644 --- a/src/UESaveFile/BinaryReader.cpp +++ b/src/Gvas/BinaryReader.cpp @@ -23,6 +23,8 @@ #include "BinaryReader.h" +namespace Gvas { + BinaryReader::BinaryReader(Containers::StringView filename) { _file = std::fopen(filename.data(), "rb"); @@ -144,3 +146,5 @@ BinaryReader::peekChar() { std::ungetc(c, _file); return c; } + +} diff --git a/src/UESaveFile/BinaryReader.h b/src/Gvas/BinaryReader.h similarity index 95% rename from src/UESaveFile/BinaryReader.h rename to src/Gvas/BinaryReader.h index e04d711..d6c9d36 100644 --- a/src/UESaveFile/BinaryReader.h +++ b/src/Gvas/BinaryReader.h @@ -25,6 +25,8 @@ using namespace Corrade; +namespace Gvas { + class BinaryReader { public: explicit BinaryReader(Containers::StringView filename); @@ -32,7 +34,7 @@ class BinaryReader { bool open(); bool eof(); - std::int64_t position(); + auto position() -> std::int64_t; bool seek(std::int64_t position); @@ -63,8 +65,10 @@ class BinaryReader { bool readUEString(Containers::String& str); - std::int32_t peekChar(); + auto peekChar() -> std::int32_t; private: std::FILE* _file = nullptr; }; + +} diff --git a/src/UESaveFile/BinaryWriter.cpp b/src/Gvas/BinaryWriter.cpp similarity index 99% rename from src/UESaveFile/BinaryWriter.cpp rename to src/Gvas/BinaryWriter.cpp index ab0ebba..05a04e0 100644 --- a/src/UESaveFile/BinaryWriter.cpp +++ b/src/Gvas/BinaryWriter.cpp @@ -22,6 +22,8 @@ using namespace Containers::Literals; +namespace Gvas { + BinaryWriter::BinaryWriter(Containers::StringView filename) { _file = std::fopen(filename.data(), "wb"); if(!_file) { @@ -157,3 +159,5 @@ BinaryWriter::writeUEStringToArray(Containers::StringView value) { writeDataToArray(Containers::ArrayView{value}) + writeValueToArray('\0'); } + +} diff --git a/src/UESaveFile/BinaryWriter.h b/src/Gvas/BinaryWriter.h similarity index 89% rename from src/UESaveFile/BinaryWriter.h rename to src/Gvas/BinaryWriter.h index 3c11eed..7dfceba 100644 --- a/src/UESaveFile/BinaryWriter.h +++ b/src/Gvas/BinaryWriter.h @@ -26,6 +26,8 @@ using namespace Corrade; +namespace Gvas { + class BinaryWriter { public: explicit BinaryWriter(Containers::StringView filename); @@ -41,10 +43,10 @@ class BinaryWriter { void closeFile(); - std::int64_t position(); + auto position() -> std::int64_t; - Containers::ArrayView array() const; - std::size_t arrayPosition() const; + auto array() const -> Containers::ArrayView; + auto arrayPosition() const -> std::size_t; bool flushToFile(); bool writeChar(char value); @@ -72,12 +74,12 @@ class BinaryWriter { bool writeUEString(Containers::StringView str); template::value, T, T&>> - std::size_t writeValueToArray(U value) { + auto writeValueToArray(U value) -> std::size_t { Containers::ArrayView view{&value, 1}; return writeDataToArray(view); } - std::size_t writeUEStringToArray(Containers::StringView value); + auto writeUEStringToArray(Containers::StringView value) -> std::size_t; template void writeValueToArrayAt(T& value, std::size_t position) { @@ -86,7 +88,7 @@ class BinaryWriter { } template - std::size_t writeDataToArray(Containers::ArrayView view) { + auto writeDataToArray(Containers::ArrayView view) -> std::size_t { arrayAppend(_data, Containers::arrayCast(view)); _index += sizeof(T) * view.size(); return sizeof(T) * view.size(); @@ -106,3 +108,5 @@ class BinaryWriter { Containers::Array _data; std::size_t _index = 0; }; + +} diff --git a/src/Gvas/CMakeLists.txt b/src/Gvas/CMakeLists.txt new file mode 100644 index 0000000..c635c3c --- /dev/null +++ b/src/Gvas/CMakeLists.txt @@ -0,0 +1,102 @@ +# MassBuilderSaveTool +# Copyright (C) 2021-2023 Guillaume Jacquemin +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +add_library(Gvas STATIC EXCLUDE_FROM_ALL + Serialisers/Serialisers.h + Serialisers/AbstractUnrealCollectionProperty.h + Serialisers/AbstractUnrealProperty.h + Serialisers/AbstractUnrealStruct.h + Serialisers/ArrayProperty.h + Serialisers/ArrayProperty.cpp + Serialisers/BoolProperty.h + Serialisers/BoolProperty.cpp + Serialisers/ByteProperty.h + Serialisers/ByteProperty.cpp + Serialisers/ColourProperty.h + Serialisers/ColourProperty.cpp + Serialisers/DateTimeProperty.h + Serialisers/DateTimeProperty.cpp + Serialisers/EnumProperty.h + Serialisers/EnumProperty.cpp + Serialisers/FloatProperty.h + Serialisers/FloatProperty.cpp + Serialisers/GuidProperty.h + Serialisers/GuidProperty.cpp + Serialisers/IntProperty.h + Serialisers/IntProperty.cpp + Serialisers/MapProperty.h + Serialisers/MapProperty.cpp + Serialisers/ResourceProperty.h + Serialisers/ResourceProperty.cpp + Serialisers/RotatorProperty.h + Serialisers/RotatorProperty.cpp + Serialisers/StringProperty.h + Serialisers/StringProperty.cpp + Serialisers/SetProperty.h + Serialisers/SetProperty.cpp + Serialisers/Struct.h + Serialisers/Struct.cpp + Serialisers/TextProperty.h + Serialisers/TextProperty.cpp + Serialisers/UnrealProperty.h + Serialisers/VectorProperty.h + Serialisers/VectorProperty.cpp + Serialisers/Vector2DProperty.h + Serialisers/Vector2DProperty.cpp + + Types/Types.h + Types/ArrayProperty.h + Types/BoolProperty.h + Types/ByteProperty.h + Types/ColourStructProperty.h + Types/DateTimeStructProperty.h + Types/EnumProperty.h + Types/FloatProperty.h + Types/GenericStructProperty.h + Types/GuidStructProperty.h + Types/IntProperty.h + Types/MapProperty.h + Types/NoneProperty.h + Types/RotatorStructProperty.h + Types/SetProperty.h + Types/StringProperty.h + Types/StructProperty.h + Types/ResourceItemValue.h + Types/TextProperty.h + Types/UnrealProperty.h + Types/UnrealPropertyBase.h + Types/Vector2DStructProperty.h + Types/VectorStructProperty.h + + Gvas.h + Debug.h + Debug.cpp + File.h + File.cpp + BinaryReader.h + BinaryReader.cpp + BinaryWriter.h + BinaryWriter.cpp + PropertySerialiser.h + PropertySerialiser.cpp +) + +target_link_libraries(Gvas PRIVATE + Corrade::Containers + Corrade::Utility + Magnum::Magnum + Logger +) diff --git a/src/UESaveFile/Debug.cpp b/src/Gvas/Debug.cpp similarity index 77% rename from src/UESaveFile/Debug.cpp rename to src/Gvas/Debug.cpp index 050fa4c..56f2141 100644 --- a/src/UESaveFile/Debug.cpp +++ b/src/Gvas/Debug.cpp @@ -23,19 +23,19 @@ #include "Debug.h" Utility::Debug& -operator<<(Utility::Debug& debug, const ArrayProperty* prop) { +operator<<(Utility::Debug& debug, const Gvas::Types::ArrayProperty* prop) { return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType << "of" << prop->items.size() << prop->itemType; } Utility::Debug& -operator<<(Utility::Debug& debug, const SetProperty* prop) { +operator<<(Utility::Debug& debug, const Gvas::Types::SetProperty* prop) { return debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->propertyType << "of" << prop->items.size() << prop->itemType; } Utility::Debug& -operator<<(Utility::Debug& debug, const GenericStructProperty* prop) { +operator<<(Utility::Debug& debug, const Gvas::Types::GenericStructProperty* prop) { debug << (*prop->name) << Utility::Debug::nospace << ":" << prop->structType << "(" << Utility::Debug::nospace << prop->propertyType << Utility::Debug::nospace << ") Contents:"; @@ -46,8 +46,8 @@ operator<<(Utility::Debug& debug, const GenericStructProperty* prop) { } Utility::Debug& -operator<<(Utility::Debug& debug, const StructProperty* prop) { - auto cast = dynamic_cast(prop); +operator<<(Utility::Debug& debug, const Gvas::Types::StructProperty* prop) { + auto cast = dynamic_cast(prop); if(cast) { return debug << cast; } @@ -57,21 +57,21 @@ operator<<(Utility::Debug& debug, const StructProperty* prop) { } Utility::Debug& -operator<<(Utility::Debug& debug, const UnrealPropertyBase* prop) { +operator<<(Utility::Debug& debug, const Gvas::Types::UnrealPropertyBase* prop) { if(prop->propertyType == "ArrayProperty") { - auto array_prop = dynamic_cast(prop); + auto array_prop = dynamic_cast(prop); if(array_prop) { return debug << array_prop; } } else if(prop->propertyType == "SetProperty") { - auto set_prop = dynamic_cast(prop); + auto set_prop = dynamic_cast(prop); if(set_prop) { return debug << set_prop; } } else if(prop->propertyType == "StructProperty") { - auto struct_prop = dynamic_cast(prop); + auto struct_prop = dynamic_cast(prop); if(struct_prop) { return debug << struct_prop; } diff --git a/src/Gvas/Debug.h b/src/Gvas/Debug.h new file mode 100644 index 0000000..55dacd2 --- /dev/null +++ b/src/Gvas/Debug.h @@ -0,0 +1,29 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "Types/Types.h" + +using namespace Corrade; + +Utility::Debug& operator<<(Utility::Debug& debug, const Gvas::Types::ArrayProperty* prop); +Utility::Debug& operator<<(Utility::Debug& debug, const Gvas::Types::SetProperty* prop); +Utility::Debug& operator<<(Utility::Debug& debug, const Gvas::Types::GenericStructProperty* prop); +Utility::Debug& operator<<(Utility::Debug& debug, const Gvas::Types::StructProperty* prop); +Utility::Debug& operator<<(Utility::Debug& debug, const Gvas::Types::UnrealPropertyBase* prop); diff --git a/src/UESaveFile/UESaveFile.cpp b/src/Gvas/File.cpp similarity index 93% rename from src/UESaveFile/UESaveFile.cpp rename to src/Gvas/File.cpp index af44e10..c9b9d24 100644 --- a/src/UESaveFile/UESaveFile.cpp +++ b/src/Gvas/File.cpp @@ -17,15 +17,18 @@ #include #include -#include "BinaryReader.h" -#include "BinaryWriter.h" #include "../Logger/Logger.h" -#include "UESaveFile.h" +#include "BinaryReader.h" +#include "BinaryWriter.h" + +#include "File.h" using namespace Containers::Literals; -UESaveFile::UESaveFile(Containers::String filepath): +namespace Gvas { + +File::File(Containers::String filepath): _propSerialiser{PropertySerialiser::instance()} { _filepath = std::move(filepath); @@ -34,46 +37,46 @@ UESaveFile::UESaveFile(Containers::String filepath): } bool -UESaveFile::valid() const { +File::valid() const { return _valid; } Containers::StringView -UESaveFile::lastError() const { +File::lastError() const { return _lastError; } bool -UESaveFile::reloadData() { +File::reloadData() { if(_noReloadAfterSave) { _noReloadAfterSave = false; return valid(); } - _properties = Containers::Array{}; + _properties = Containers::Array{}; loadData(); return valid(); } Containers::StringView -UESaveFile::saveType() { +File::saveType() { return _saveType; } void -UESaveFile::appendProperty(UnrealPropertyBase::ptr prop) { +File::appendProperty(Types::UnrealPropertyBase::ptr prop) { auto none_prop = std::move(_properties.back()); _properties.back() = std::move(prop); arrayAppend(_properties, std::move(none_prop)); } -Containers::ArrayView -UESaveFile::props() { +Containers::ArrayView +File::props() { return _properties; } bool -UESaveFile::saveToFile() { +File::saveToFile() { LOG_INFO_FORMAT("Writing to {}.", _filepath); bool temp_file = _filepath.hasSuffix(".tmp"); @@ -161,7 +164,7 @@ UESaveFile::saveToFile() { } void -UESaveFile::loadData() { +File::loadData() { LOG_INFO_FORMAT("Reading data from {}.", _filepath); _valid = false; @@ -244,7 +247,7 @@ UESaveFile::loadData() { return; } - UnrealPropertyBase::ptr prop; + Types::UnrealPropertyBase::ptr prop; while((prop = _propSerialiser->read(reader)) != nullptr) { arrayAppend(_properties, std::move(prop)); } @@ -265,3 +268,5 @@ UESaveFile::loadData() { _valid = true; } + +} diff --git a/src/UESaveFile/UESaveFile.h b/src/Gvas/File.h similarity index 83% rename from src/UESaveFile/UESaveFile.h rename to src/Gvas/File.h index 7aa72f2..0af071c 100644 --- a/src/UESaveFile/UESaveFile.h +++ b/src/Gvas/File.h @@ -29,19 +29,21 @@ using namespace Corrade; -class UESaveFile { +namespace Gvas { + +class File { public: - explicit UESaveFile(Containers::String filepath); + explicit File(Containers::String filepath); bool valid() const; - Containers::StringView lastError() const; + auto lastError() const -> Containers::StringView; bool reloadData(); - Containers::StringView saveType(); + auto saveType() -> Containers::StringView; template - std::enable_if_t::value, T*> + std::enable_if_t::value, T*> at(Containers::StringView name) { for(auto& prop : _properties) { if(prop->name == name) { @@ -51,9 +53,9 @@ class UESaveFile { return nullptr; } - void appendProperty(UnrealPropertyBase::ptr prop); + void appendProperty(Types::UnrealPropertyBase::ptr prop); - Containers::ArrayView props(); + auto props() -> Containers::ArrayView; bool saveToFile(); @@ -88,7 +90,9 @@ class UESaveFile { Containers::String _saveType; - Containers::Array _properties; + Containers::Array _properties; Containers::Reference _propSerialiser; }; + +} diff --git a/src/Gvas/Gvas.h b/src/Gvas/Gvas.h new file mode 100644 index 0000000..fad929c --- /dev/null +++ b/src/Gvas/Gvas.h @@ -0,0 +1,26 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +namespace Gvas { + +class BinaryReader; +class BinaryWriter; +class File; +class PropertySerialiser; + +} diff --git a/src/UESaveFile/PropertySerialiser.cpp b/src/Gvas/PropertySerialiser.cpp similarity index 64% rename from src/UESaveFile/PropertySerialiser.cpp rename to src/Gvas/PropertySerialiser.cpp index 1e89498..2aa5c10 100644 --- a/src/UESaveFile/PropertySerialiser.cpp +++ b/src/Gvas/PropertySerialiser.cpp @@ -16,55 +16,57 @@ #include -#include "Serialisers/ArrayPropertySerialiser.h" -#include "Serialisers/BoolPropertySerialiser.h" -#include "Serialisers/BytePropertySerialiser.h" -#include "Serialisers/ColourPropertySerialiser.h" -#include "Serialisers/DateTimePropertySerialiser.h" -#include "Serialisers/EnumPropertySerialiser.h" -#include "Serialisers/FloatPropertySerialiser.h" -#include "Serialisers/GuidPropertySerialiser.h" -#include "Serialisers/IntPropertySerialiser.h" -#include "Serialisers/MapPropertySerialiser.h" -#include "Serialisers/ResourcePropertySerialiser.h" -#include "Serialisers/RotatorPropertySerialiser.h" -#include "Serialisers/StringPropertySerialiser.h" -#include "Serialisers/SetPropertySerialiser.h" -#include "Serialisers/StructSerialiser.h" -#include "Serialisers/TextPropertySerialiser.h" -#include "Serialisers/VectorPropertySerialiser.h" -#include "Serialisers/Vector2DPropertySerialiser.h" +#include "../Logger/Logger.h" + +#include "Serialisers/ArrayProperty.h" +#include "Serialisers/BoolProperty.h" +#include "Serialisers/ByteProperty.h" +#include "Serialisers/ColourProperty.h" +#include "Serialisers/DateTimeProperty.h" +#include "Serialisers/EnumProperty.h" +#include "Serialisers/FloatProperty.h" +#include "Serialisers/GuidProperty.h" +#include "Serialisers/IntProperty.h" +#include "Serialisers/MapProperty.h" +#include "Serialisers/ResourceProperty.h" +#include "Serialisers/RotatorProperty.h" +#include "Serialisers/StringProperty.h" +#include "Serialisers/SetProperty.h" +#include "Serialisers/Struct.h" +#include "Serialisers/TextProperty.h" +#include "Serialisers/VectorProperty.h" +#include "Serialisers/Vector2DProperty.h" #include "Types/NoneProperty.h" #include "BinaryReader.h" #include "BinaryWriter.h" -#include "../Logger/Logger.h" - #include "PropertySerialiser.h" -PropertySerialiser::PropertySerialiser() { - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); - arrayAppend(_serialisers, Containers::pointer()); +namespace Gvas { - arrayAppend(_collectionSerialisers, Containers::pointer()); +PropertySerialiser::PropertySerialiser() { + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + arrayAppend(_serialisers, Containers::pointer()); + + arrayAppend(_collectionSerialisers, Containers::pointer()); } PropertySerialiser& @@ -73,7 +75,7 @@ PropertySerialiser::instance() { return serialiser; } -UnrealPropertyBase::ptr +Types::UnrealPropertyBase::ptr PropertySerialiser::read(BinaryReader& reader) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; @@ -85,7 +87,7 @@ PropertySerialiser::read(BinaryReader& reader) { } if(name == "None") { - return Containers::pointer(); + return Containers::pointer(); } Containers::String type; @@ -101,7 +103,7 @@ PropertySerialiser::read(BinaryReader& reader) { return deserialise(std::move(name), std::move(type), value_length, reader); } -UnrealPropertyBase::ptr +Types::UnrealPropertyBase::ptr PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, Containers::String name) { @@ -112,7 +114,7 @@ PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std: return deserialise(std::move(name), std::move(type), value_length, reader); } -Containers::Array +Containers::Array PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; @@ -120,7 +122,7 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty auto serialiser = getCollectionSerialiser(item_type); - Containers::Array array; + Containers::Array array; if(serialiser) { Containers::String name; @@ -156,11 +158,11 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty return array; } -UnrealPropertyBase::ptr +Types::UnrealPropertyBase::ptr PropertySerialiser::deserialise(Containers::String name, Containers::String type, std::size_t value_length, BinaryReader& reader) { - UnrealPropertyBase::ptr prop; + Types::UnrealPropertyBase::ptr prop; auto serialiser = getSerialiser(type); if(serialiser == nullptr) { @@ -180,7 +182,7 @@ PropertySerialiser::deserialise(Containers::String name, Containers::String type return prop; } -bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, +bool PropertySerialiser::serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer) { auto serialiser = getSerialiser(item_type); @@ -191,8 +193,8 @@ bool PropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, Containers::St } bool -PropertySerialiser::write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer) { - if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { +PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer) { + if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); return true; } @@ -215,10 +217,10 @@ PropertySerialiser::write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_writ } bool -PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, +PropertySerialiser::writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer) { - if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { + if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); return true; } @@ -226,7 +228,7 @@ PropertySerialiser::writeItem(UnrealPropertyBase::ptr& prop, Containers::StringV return serialise(prop, item_type, bytes_written, writer); } -bool PropertySerialiser::writeSet(Containers::ArrayView props, +bool PropertySerialiser::writeSet(Containers::ArrayView props, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer) { auto serialiser = getCollectionSerialiser(item_type); @@ -244,7 +246,7 @@ bool PropertySerialiser::writeSet(Containers::ArrayView } } -AbstractUnrealPropertySerialiser* +Serialisers::AbstractUnrealProperty* PropertySerialiser::getSerialiser(Containers::StringView item_type) { for(auto& item : _serialisers) { for(auto serialiser_type : item->types()) { @@ -257,7 +259,7 @@ PropertySerialiser::getSerialiser(Containers::StringView item_type) { return nullptr; } -AbstractUnrealCollectionPropertySerialiser* +Serialisers::AbstractUnrealCollectionProperty* PropertySerialiser::getCollectionSerialiser(Containers::StringView item_type) { for(auto& item : _collectionSerialisers) { for(Containers::StringView serialiser_type : item->types()) { @@ -269,3 +271,5 @@ PropertySerialiser::getCollectionSerialiser(Containers::StringView item_type) { return nullptr; } + +} diff --git a/src/Gvas/PropertySerialiser.h b/src/Gvas/PropertySerialiser.h new file mode 100644 index 0000000..79889d9 --- /dev/null +++ b/src/Gvas/PropertySerialiser.h @@ -0,0 +1,64 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include + +#include "Serialisers/AbstractUnrealProperty.h" +#include "Serialisers/AbstractUnrealCollectionProperty.h" + +#include "Types/UnrealPropertyBase.h" + +#include "Gvas.h" + +using namespace Corrade; + +namespace Gvas { + +class PropertySerialiser { + public: + static auto instance() -> PropertySerialiser&; + + auto read(BinaryReader& reader) -> Types::UnrealPropertyBase::ptr; + auto readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, Containers::String name) + -> Types::UnrealPropertyBase::ptr; + auto readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) + -> Containers::Array; + auto deserialise(Containers::String name, Containers::String type, std::size_t value_length, + BinaryReader& reader) -> Types::UnrealPropertyBase::ptr; + + bool serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, + std::size_t& bytes_written, BinaryWriter& writer); + bool write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer); + bool writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, + std::size_t& bytes_written, BinaryWriter& writer); + bool writeSet(Containers::ArrayView props, Containers::StringView item_type, + std::size_t& bytes_written, BinaryWriter& writer); + + private: + PropertySerialiser(); + + auto getSerialiser(Containers::StringView item_type) -> Serialisers::AbstractUnrealProperty*; + auto getCollectionSerialiser(Containers::StringView item_type) -> Serialisers::AbstractUnrealCollectionProperty*; + + Containers::Array _serialisers; + Containers::Array _collectionSerialisers; +}; + +} diff --git a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h similarity index 58% rename from src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h rename to src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h index 4a974ab..8d7a390 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealCollectionPropertySerialiser.h +++ b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h @@ -21,29 +21,31 @@ #include #include +#include "../Gvas.h" #include "../Types/UnrealPropertyBase.h" using namespace Corrade; -class BinaryReader; -class BinaryWriter; -class PropertySerialiser; +namespace Gvas { namespace Serialisers { -using PropertyArray = Containers::Array; -using PropertyArrayView = Containers::ArrayView; +using PropertyArray = Containers::Array; +using PropertyArrayView = Containers::ArrayView; +using StringArrayView = Containers::ArrayView; -class AbstractUnrealCollectionPropertySerialiser { +class AbstractUnrealCollectionProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - virtual ~AbstractUnrealCollectionPropertySerialiser() = default; + virtual ~AbstractUnrealCollectionProperty() = default; - virtual StringArrayView types() = 0; + virtual auto types() -> StringArrayView = 0; - virtual PropertyArray deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, std::uint32_t count, BinaryReader& reader, - PropertySerialiser& serialiser) = 0; + virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) + -> PropertyArray = 0; - virtual bool serialise(Containers::ArrayView props, Containers::StringView item_type, + virtual bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; }; + +}} diff --git a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h b/src/Gvas/Serialisers/AbstractUnrealProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h rename to src/Gvas/Serialisers/AbstractUnrealProperty.h index 6b2e615..11c8359 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealPropertySerialiser.h +++ b/src/Gvas/Serialisers/AbstractUnrealProperty.h @@ -20,28 +20,30 @@ #include #include +#include "../Gvas.h" #include "../Types/UnrealPropertyBase.h" using namespace Corrade; -class BinaryReader; -class BinaryWriter; -class PropertySerialiser; + +namespace Gvas { namespace Serialisers { using StringArrayView = Containers::ArrayView; -class AbstractUnrealPropertySerialiser { +class AbstractUnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - virtual ~AbstractUnrealPropertySerialiser() = default; + virtual ~AbstractUnrealProperty() = default; - virtual StringArrayView types() = 0; + virtual auto types() -> StringArrayView = 0; - virtual UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) = 0; + virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr = 0; - virtual bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + virtual bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; }; + +}} diff --git a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h b/src/Gvas/Serialisers/AbstractUnrealStruct.h similarity index 69% rename from src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h rename to src/Gvas/Serialisers/AbstractUnrealStruct.h index 57e79d7..e08dfc9 100644 --- a/src/UESaveFile/Serialisers/AbstractUnrealStructSerialiser.h +++ b/src/Gvas/Serialisers/AbstractUnrealStruct.h @@ -21,22 +21,25 @@ #include #include +#include "../Gvas.h" #include "../Types/UnrealPropertyBase.h" using namespace Corrade; -class BinaryReader; -class BinaryWriter; +namespace Gvas { namespace Serialisers { -class AbstractUnrealStructSerialiser { +class AbstractUnrealStruct { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - virtual ~AbstractUnrealStructSerialiser() = default; + virtual ~AbstractUnrealStruct() = default; virtual bool supportsType(Containers::StringView type) = 0; - virtual UnrealPropertyBase::ptr deserialise(BinaryReader& reader) = 0; + virtual auto deserialise(BinaryReader& reader) -> Types::UnrealPropertyBase::ptr = 0; - virtual bool serialise(UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, std::size_t& bytes_written) = 0; + virtual bool serialise(Types::UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, + std::size_t& bytes_written) = 0; }; + +}} diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp b/src/Gvas/Serialisers/ArrayProperty.cpp similarity index 77% rename from src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp rename to src/Gvas/Serialisers/ArrayProperty.cpp index ed412af..83829ae 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/ArrayProperty.cpp @@ -21,12 +21,13 @@ #include "../PropertySerialiser.h" #include "../../Logger/Logger.h" -#include "ArrayPropertySerialiser.h" +#include "ArrayProperty.h" -UnrealPropertyBase::ptr -ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -46,7 +47,7 @@ ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Contai return nullptr; } - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); prop->itemType = std::move(item_type); prop->items = serialiser.readSet(reader, prop->itemType, item_count); @@ -54,10 +55,10 @@ ArrayPropertySerialiser::deserialiseProperty(Containers::StringView name, Contai } bool -ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto array_prop = dynamic_cast(prop.get()); + auto array_prop = dynamic_cast(prop.get()); if(!array_prop) { LOG_ERROR("The property is not a valid array property."); return false; @@ -74,3 +75,5 @@ ArrayPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::s return ret; } + +}} diff --git a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h b/src/Gvas/Serialisers/ArrayProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/ArrayPropertySerialiser.h rename to src/Gvas/Serialisers/ArrayProperty.h index 6f6b741..6f50b95 100644 --- a/src/UESaveFile/Serialisers/ArrayPropertySerialiser.h +++ b/src/Gvas/Serialisers/ArrayProperty.h @@ -18,20 +18,24 @@ #include -#include "UnrealPropertySerialiser.h" - +#include "../Gvas.h" +#include "UnrealProperty.h" #include "../Types/ArrayProperty.h" using namespace Corrade; -class ArrayPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class ArrayProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp b/src/Gvas/Serialisers/BoolProperty.cpp similarity index 74% rename from src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp rename to src/Gvas/Serialisers/BoolProperty.cpp index 8e2c1ea..c67e6ec 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/BoolProperty.cpp @@ -18,18 +18,20 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "BoolPropertySerialiser.h" +#include "BoolProperty.h" + +namespace Gvas { namespace Serialisers { StringArrayView -BoolPropertySerialiser::types() { +BoolProperty::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"BoolProperty"_s}}; return types; } -UnrealPropertyBase::ptr -BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) +Types::UnrealPropertyBase::ptr +BoolProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { if(value_length != 0) { LOG_ERROR_FORMAT("Invalid value length for bool property {}. Expected 0, got {} instead.", name, value_length); @@ -47,17 +49,17 @@ BoolPropertySerialiser::deserialise(Containers::StringView name, Containers::Str return nullptr; } - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); prop->value = value; return prop; } bool -BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto bool_prop = dynamic_cast(prop.get()); + auto bool_prop = dynamic_cast(prop.get()); if(!bool_prop) { LOG_ERROR("The property is not a valid bool property."); return false; @@ -67,3 +69,5 @@ BoolPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& by return true; } + +}} diff --git a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h b/src/Gvas/Serialisers/BoolProperty.h similarity index 61% rename from src/UESaveFile/Serialisers/BoolPropertySerialiser.h rename to src/Gvas/Serialisers/BoolProperty.h index 6e41afc..58171e4 100644 --- a/src/UESaveFile/Serialisers/BoolPropertySerialiser.h +++ b/src/Gvas/Serialisers/BoolProperty.h @@ -19,22 +19,26 @@ #include #include -#include "AbstractUnrealPropertySerialiser.h" +#include "AbstractUnrealProperty.h" #include "../Types/BoolProperty.h" using namespace Corrade; -class BoolPropertySerialiser : public AbstractUnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class BoolProperty : public AbstractUnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - StringArrayView types() override; + auto types() -> StringArrayView override; - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp b/src/Gvas/Serialisers/ByteProperty.cpp similarity index 82% rename from src/UESaveFile/Serialisers/BytePropertySerialiser.cpp rename to src/Gvas/Serialisers/ByteProperty.cpp index 45b7934..1463798 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.cpp +++ b/src/Gvas/Serialisers/ByteProperty.cpp @@ -18,20 +18,22 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "BytePropertySerialiser.h" +#include "ByteProperty.h" + +namespace Gvas { namespace Serialisers { StringArrayView -BytePropertySerialiser::types() { +ByteProperty::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"ByteProperty"_s}}; return types; } -UnrealPropertyBase::ptr -BytePropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, +Types::UnrealPropertyBase::ptr +ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(value_length != std::size_t(-1)) { if(!reader.readUEString(prop->enumType)) { @@ -66,10 +68,10 @@ BytePropertySerialiser::deserialise(Containers::StringView name, Containers::Str } bool -BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto byte_prop = dynamic_cast(prop.get()); + auto byte_prop = dynamic_cast(prop.get()); if(!byte_prop) { LOG_ERROR("The property is not a valid byte property."); return false; @@ -88,3 +90,5 @@ BytePropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& by return true; } + +}} diff --git a/src/UESaveFile/Serialisers/BytePropertySerialiser.h b/src/Gvas/Serialisers/ByteProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/BytePropertySerialiser.h rename to src/Gvas/Serialisers/ByteProperty.h index fb2b2d4..adb4201 100644 --- a/src/UESaveFile/Serialisers/BytePropertySerialiser.h +++ b/src/Gvas/Serialisers/ByteProperty.h @@ -19,20 +19,24 @@ #include #include -#include "AbstractUnrealPropertySerialiser.h" +#include "AbstractUnrealProperty.h" #include "../Types/ByteProperty.h" -class BytePropertySerialiser : public AbstractUnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class ByteProperty : public AbstractUnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - StringArrayView types() override; + auto types() -> StringArrayView override; - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp b/src/Gvas/Serialisers/ColourProperty.cpp similarity index 69% rename from src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp rename to src/Gvas/Serialisers/ColourProperty.cpp index 9e5cd9a..1af0ea1 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/ColourProperty.cpp @@ -18,14 +18,15 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "ColourPropertySerialiser.h" +#include "ColourProperty.h" -UnrealPropertyBase::ptr -ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readFloat(prop->r) || !reader.readFloat(prop->g) || !reader.readFloat(prop->b) || !reader.readFloat(prop->a)) @@ -38,10 +39,10 @@ ColourPropertySerialiser::deserialiseProperty(Containers::StringView name, Conta } bool -ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +ColourProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { - auto colour_prop = dynamic_cast(prop.get()); + auto colour_prop = dynamic_cast(prop.get()); if(!colour_prop) { LOG_ERROR("The property is not a valid colour property."); return false; @@ -54,3 +55,5 @@ ColourPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std:: return true; } + +}} diff --git a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h b/src/Gvas/Serialisers/ColourProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/ColourPropertySerialiser.h rename to src/Gvas/Serialisers/ColourProperty.h index 812f7a9..173c6f2 100644 --- a/src/UESaveFile/Serialisers/ColourPropertySerialiser.h +++ b/src/Gvas/Serialisers/ColourProperty.h @@ -18,20 +18,24 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/ColourStructProperty.h" using namespace Corrade; -class ColourPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class ColourProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp b/src/Gvas/Serialisers/DateTimeProperty.cpp similarity index 64% rename from src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp rename to src/Gvas/Serialisers/DateTimeProperty.cpp index 9724dfb..1be9685 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.cpp +++ b/src/Gvas/Serialisers/DateTimeProperty.cpp @@ -18,14 +18,15 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "DateTimePropertySerialiser.h" +#include "DateTimeProperty.h" -UnrealPropertyBase::ptr -DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readInt64(prop->timestamp)) { LOG_ERROR_FORMAT("Couldn't read date/time property {}'s value.", name); @@ -36,10 +37,10 @@ DateTimePropertySerialiser::deserialiseProperty(Containers::StringView name, Con } bool -DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +DateTimeProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { - auto dt_prop = dynamic_cast(prop.get()); + auto dt_prop = dynamic_cast(prop.get()); if(!dt_prop) { LOG_ERROR("The property is not a valid date/time property."); return false; @@ -49,3 +50,5 @@ DateTimePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std return true; } + +}} diff --git a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h b/src/Gvas/Serialisers/DateTimeProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/DateTimePropertySerialiser.h rename to src/Gvas/Serialisers/DateTimeProperty.h index 68f2476..ca604a2 100644 --- a/src/UESaveFile/Serialisers/DateTimePropertySerialiser.h +++ b/src/Gvas/Serialisers/DateTimeProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/DateTimeStructProperty.h" -class DateTimePropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class DateTimeProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp b/src/Gvas/Serialisers/EnumProperty.cpp similarity index 74% rename from src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp rename to src/Gvas/Serialisers/EnumProperty.cpp index f7e1246..4e8125a 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/EnumProperty.cpp @@ -18,20 +18,22 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "EnumPropertySerialiser.h" +#include "EnumProperty.h" + +namespace Gvas { namespace Serialisers { StringArrayView -EnumPropertySerialiser::types() { +EnumProperty::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"EnumProperty"_s}}; return types; } -UnrealPropertyBase::ptr -EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) +Types::UnrealPropertyBase::ptr +EnumProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readUEString(prop->enumType)) { LOG_ERROR_FORMAT("Couldn't read enum property {}'s enum type.", name); @@ -53,10 +55,10 @@ EnumPropertySerialiser::deserialise(Containers::StringView name, Containers::Str } bool -EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto enum_prop = dynamic_cast(prop.get()); + auto enum_prop = dynamic_cast(prop.get()); if(!enum_prop) { LOG_ERROR("The property is not a valid enum property."); return false; @@ -68,3 +70,5 @@ EnumPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& by return true; } + +}} diff --git a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h b/src/Gvas/Serialisers/EnumProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/EnumPropertySerialiser.h rename to src/Gvas/Serialisers/EnumProperty.h index 077eeae..be1ade7 100644 --- a/src/UESaveFile/Serialisers/EnumPropertySerialiser.h +++ b/src/Gvas/Serialisers/EnumProperty.h @@ -19,20 +19,24 @@ #include #include -#include "AbstractUnrealPropertySerialiser.h" +#include "AbstractUnrealProperty.h" #include "../Types/EnumProperty.h" -class EnumPropertySerialiser : public AbstractUnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class EnumProperty : public AbstractUnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - StringArrayView types() override; + auto types() -> StringArrayView override; - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp b/src/Gvas/Serialisers/FloatProperty.cpp similarity index 72% rename from src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp rename to src/Gvas/Serialisers/FloatProperty.cpp index d643ca0..e3cf14c 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/FloatProperty.cpp @@ -18,20 +18,22 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "FloatPropertySerialiser.h" +#include "FloatProperty.h" + +namespace Gvas { namespace Serialisers { StringArrayView -FloatPropertySerialiser::types() { +FloatProperty::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"FloatProperty"_s}}; return types; } -UnrealPropertyBase::ptr -FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) +Types::UnrealPropertyBase::ptr +FloatProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); char terminator; if(!reader.readChar(terminator) || terminator != '\0') { @@ -48,10 +50,10 @@ FloatPropertySerialiser::deserialise(Containers::StringView name, Containers::St } bool -FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto float_prop = dynamic_cast(prop.get()); + auto float_prop = dynamic_cast(prop.get()); if(!float_prop) { LOG_ERROR("The property is not a valid float property."); return false; @@ -62,3 +64,5 @@ FloatPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& b return true; } + +}} diff --git a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h b/src/Gvas/Serialisers/FloatProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/FloatPropertySerialiser.h rename to src/Gvas/Serialisers/FloatProperty.h index 9aa8ee9..bde9188 100644 --- a/src/UESaveFile/Serialisers/FloatPropertySerialiser.h +++ b/src/Gvas/Serialisers/FloatProperty.h @@ -19,20 +19,24 @@ #include #include -#include "AbstractUnrealPropertySerialiser.h" +#include "AbstractUnrealProperty.h" #include "../Types/FloatProperty.h" -class FloatPropertySerialiser : public AbstractUnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class FloatProperty : public AbstractUnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - StringArrayView types() override; + auto types() -> StringArrayView override; - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp b/src/Gvas/Serialisers/GuidProperty.cpp similarity index 62% rename from src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp rename to src/Gvas/Serialisers/GuidProperty.cpp index 46715b6..ff173b8 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/GuidProperty.cpp @@ -18,16 +18,17 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "GuidPropertySerialiser.h" +#include "GuidProperty.h" using namespace Containers::Literals; -UnrealPropertyBase::ptr -GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readStaticArray(prop->guid)) { LOG_ERROR_FORMAT("Couldn't read GUID property {}'s value.", name); @@ -38,12 +39,12 @@ GuidPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain } bool -GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto guid_prop = dynamic_cast(prop.get()); + auto guid_prop = dynamic_cast(prop.get()); if(!guid_prop) { - LOG_ERROR("The property is not a valid byte property."); + LOG_ERROR("The property is not a valid GUID property."); return false; } @@ -51,3 +52,5 @@ GuidPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::si return true; } + +}} diff --git a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h b/src/Gvas/Serialisers/GuidProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/GuidPropertySerialiser.h rename to src/Gvas/Serialisers/GuidProperty.h index 1a2a7c4..8de587c 100644 --- a/src/UESaveFile/Serialisers/GuidPropertySerialiser.h +++ b/src/Gvas/Serialisers/GuidProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/GuidStructProperty.h" -class GuidPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class GuidProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp b/src/Gvas/Serialisers/IntProperty.cpp similarity index 73% rename from src/UESaveFile/Serialisers/IntPropertySerialiser.cpp rename to src/Gvas/Serialisers/IntProperty.cpp index 76a8443..94f51d7 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/IntProperty.cpp @@ -18,14 +18,15 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "IntPropertySerialiser.h" +#include "IntProperty.h" -UnrealPropertyBase::ptr -IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(value_length == std::size_t(-1)) { if(!reader.readInt32(prop->value)) { @@ -54,10 +55,10 @@ IntPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe } bool -IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto int_prop = dynamic_cast(prop.get()); + auto int_prop = dynamic_cast(prop.get()); if(!int_prop) { LOG_ERROR("The property is not a valid int property."); return false; @@ -71,3 +72,5 @@ IntPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::siz return true; } + +}} diff --git a/src/UESaveFile/Serialisers/IntPropertySerialiser.h b/src/Gvas/Serialisers/IntProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/IntPropertySerialiser.h rename to src/Gvas/Serialisers/IntProperty.h index 4cf7c93..777d625 100644 --- a/src/UESaveFile/Serialisers/IntPropertySerialiser.h +++ b/src/Gvas/Serialisers/IntProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/IntProperty.h" -class IntPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class IntProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp b/src/Gvas/Serialisers/MapProperty.cpp similarity index 85% rename from src/UESaveFile/Serialisers/MapPropertySerialiser.cpp rename to src/Gvas/Serialisers/MapProperty.cpp index b2f9057..7893447 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/MapProperty.cpp @@ -20,16 +20,17 @@ #include "../Types/NoneProperty.h" #include "../../Logger/Logger.h" -#include "MapPropertySerialiser.h" +#include "MapProperty.h" using namespace Containers::Literals; -UnrealPropertyBase::ptr -MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readUEString(prop->keyType)) { LOG_ERROR_FORMAT("Couldn't read map property {}'s key type.", name); @@ -65,7 +66,7 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe arrayReserve(prop->map, count); for(std::uint32_t i = 0; i < count; i++) { - MapProperty::KeyValuePair pair; + Types::MapProperty::KeyValuePair pair; if(prop->keyType == "IntProperty"_s || prop->keyType == "StrProperty"_s) { pair.key = serialiser.readItem(reader, prop->keyType, -1, name); @@ -79,14 +80,14 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe return nullptr; } - UnrealPropertyBase::ptr value_item; + Types::UnrealPropertyBase::ptr value_item; if(prop->valueType == "StructProperty"_s) { while((value_item = serialiser.read(reader)) != nullptr) { arrayAppend(pair.values, std::move(value_item)); if(pair.values.back()->name == "None"_s && pair.values.back()->propertyType == "NoneProperty"_s && - dynamic_cast(pair.values.back().get()) != nullptr) + dynamic_cast(pair.values.back().get()) != nullptr) { break; } @@ -109,10 +110,10 @@ MapPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe } bool -MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto map_prop = dynamic_cast(prop.get()); + auto map_prop = dynamic_cast(prop.get()); if(!map_prop) { LOG_ERROR("The property is not a valid map property."); return false; @@ -154,3 +155,5 @@ MapPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::siz return true; } + +}} diff --git a/src/UESaveFile/Serialisers/MapPropertySerialiser.h b/src/Gvas/Serialisers/MapProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/MapPropertySerialiser.h rename to src/Gvas/Serialisers/MapProperty.h index 0b59b4d..f992653 100644 --- a/src/UESaveFile/Serialisers/MapPropertySerialiser.h +++ b/src/Gvas/Serialisers/MapProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/MapProperty.h" -class MapPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class MapProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp b/src/Gvas/Serialisers/ResourceProperty.cpp similarity index 75% rename from src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp rename to src/Gvas/Serialisers/ResourceProperty.cpp index 9182591..da63c1e 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.cpp +++ b/src/Gvas/Serialisers/ResourceProperty.cpp @@ -21,16 +21,17 @@ #include "../Types/NoneProperty.h" #include "../../Logger/Logger.h" -#include "ResourcePropertySerialiser.h" +#include "ResourceProperty.h" using namespace Containers::Literals; -UnrealPropertyBase::ptr -ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); auto id_prop = serialiser.read(reader); if(!id_prop) { @@ -40,13 +41,13 @@ ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Con if((*id_prop->name) != "ID_4_AAE08F17428E229EC7A2209F51081A21"_s || id_prop->propertyType != "IntProperty"_s || - dynamic_cast(id_prop.get()) == nullptr) + dynamic_cast(id_prop.get()) == nullptr) { LOG_ERROR("The ID property is invalid."_s); return nullptr; } - prop->id = dynamic_cast(id_prop.get())->value; + prop->id = dynamic_cast(id_prop.get())->value; auto value_prop = serialiser.read(reader); if(!value_prop) { @@ -56,20 +57,20 @@ ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Con if((*value_prop->name) != "Quantity_3_560F09B5485C365D3041888910019CE3"_s || value_prop->propertyType != "IntProperty"_s || - dynamic_cast(value_prop.get()) == nullptr) + dynamic_cast(value_prop.get()) == nullptr) { LOG_ERROR("The value property is invalid."_s); return nullptr; } - prop->quantity = dynamic_cast(value_prop.get())->value; + prop->quantity = dynamic_cast(value_prop.get())->value; auto none_prop = serialiser.read(reader); if(!none_prop || (*none_prop->name) != "None"_s || none_prop->propertyType != "NoneProperty"_s || - !dynamic_cast(none_prop.get())) + !dynamic_cast(none_prop.get())) { LOG_ERROR("Couldn't find a terminating NoneProperty."_s); return nullptr; @@ -79,10 +80,10 @@ ResourcePropertySerialiser::deserialiseProperty(Containers::StringView name, Con } bool -ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +ResourceProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { - auto res_prop = dynamic_cast(prop.get()); + auto res_prop = dynamic_cast(prop.get()); if(!res_prop) { LOG_ERROR("The property is not a valid ResourceItemValue property."); return false; @@ -104,3 +105,5 @@ ResourcePropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std return true; } + +}} diff --git a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h b/src/Gvas/Serialisers/ResourceProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/ResourcePropertySerialiser.h rename to src/Gvas/Serialisers/ResourceProperty.h index 4e5e360..db97155 100644 --- a/src/UESaveFile/Serialisers/ResourcePropertySerialiser.h +++ b/src/Gvas/Serialisers/ResourceProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/ResourceItemValue.h" -class ResourcePropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class ResourceProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp b/src/Gvas/Serialisers/RotatorProperty.cpp similarity index 66% rename from src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp rename to src/Gvas/Serialisers/RotatorProperty.cpp index 5a0b9e2..66ce58e 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/RotatorProperty.cpp @@ -18,14 +18,15 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "RotatorPropertySerialiser.h" +#include "RotatorProperty.h" -UnrealPropertyBase::ptr -RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) { LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name); @@ -36,10 +37,10 @@ RotatorPropertySerialiser::deserialiseProperty(Containers::StringView name, Cont } bool -RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { - auto rotator = dynamic_cast(prop.get()); + auto rotator = dynamic_cast(prop.get()); if(!rotator) { LOG_ERROR("The property is not a valid rotator property."); return false; @@ -50,3 +51,5 @@ RotatorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std: return true; } + +}} diff --git a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h b/src/Gvas/Serialisers/RotatorProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/RotatorPropertySerialiser.h rename to src/Gvas/Serialisers/RotatorProperty.h index ec56385..a2df613 100644 --- a/src/UESaveFile/Serialisers/RotatorPropertySerialiser.h +++ b/src/Gvas/Serialisers/RotatorProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/RotatorStructProperty.h" -class RotatorPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class RotatorProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/Gvas/Serialisers/Serialisers.h b/src/Gvas/Serialisers/Serialisers.h new file mode 100644 index 0000000..182a7d7 --- /dev/null +++ b/src/Gvas/Serialisers/Serialisers.h @@ -0,0 +1,44 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +namespace Gvas { namespace Serialisers { + +class AbstractUnrealCollectionProperty; +class AbstractUnrealProperty; +class AbstractUnrealStruct; +class ArrayProperty; +class BoolProperty; +class ByteProperty; +class ColourProperty; +class DateTimeProperty; +class EnumProperty; +class FloatProperty; +class GuidProperty; +class IntProperty; +class MapProperty; +class ResourceProperty; +class RotatorProperty; +class SetProperty; +class StringProperty; +class Struct; +class TextProperty; +class UnrealProperty; +class Vector2DProperty; +class VectorProperty; + +}} diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp b/src/Gvas/Serialisers/SetProperty.cpp similarity index 79% rename from src/UESaveFile/Serialisers/SetPropertySerialiser.cpp rename to src/Gvas/Serialisers/SetProperty.cpp index 2bef358..5237483 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/SetProperty.cpp @@ -19,12 +19,13 @@ #include "../PropertySerialiser.h" #include "../../Logger/Logger.h" -#include "SetPropertySerialiser.h" +#include "SetProperty.h" -UnrealPropertyBase::ptr -SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -50,7 +51,7 @@ SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe return nullptr; } - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); prop->itemType = std::move(item_type); prop->items = serialiser.readSet(reader, prop->itemType, item_count); @@ -58,10 +59,10 @@ SetPropertySerialiser::deserialiseProperty(Containers::StringView name, Containe } bool -SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto set_prop = dynamic_cast(prop.get()); + auto set_prop = dynamic_cast(prop.get()); if(!set_prop) { LOG_ERROR("The property is not a valid set property."); return false; @@ -80,3 +81,5 @@ SetPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::siz return true; } + +}} diff --git a/src/UESaveFile/Serialisers/SetPropertySerialiser.h b/src/Gvas/Serialisers/SetProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/SetPropertySerialiser.h rename to src/Gvas/Serialisers/SetProperty.h index 083e2c8..ca2629e 100644 --- a/src/UESaveFile/Serialisers/SetPropertySerialiser.h +++ b/src/Gvas/Serialisers/SetProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/SetProperty.h" -class SetPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class SetProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp b/src/Gvas/Serialisers/StringProperty.cpp similarity index 74% rename from src/UESaveFile/Serialisers/StringPropertySerialiser.cpp rename to src/Gvas/Serialisers/StringProperty.cpp index 177dacc..e3fee8e 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/StringProperty.cpp @@ -18,10 +18,12 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "StringPropertySerialiser.h" +#include "StringProperty.h" + +namespace Gvas { namespace Serialisers { StringArrayView -StringPropertySerialiser::types() { +StringProperty::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, { "NameProperty"_s, "StrProperty"_s, "SoftObjectProperty"_s, "ObjectProperty"_s @@ -29,11 +31,11 @@ StringPropertySerialiser::types() { return types; } -UnrealPropertyBase::ptr -StringPropertySerialiser::deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) +Types::UnrealPropertyBase::ptr +StringProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(type); + auto prop = Containers::pointer(type); if(value_length != std::size_t(-1)) { char terminator; @@ -54,10 +56,10 @@ StringPropertySerialiser::deserialise(Containers::StringView name, Containers::S } bool -StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto str_prop = dynamic_cast(prop.get()); + auto str_prop = dynamic_cast(prop.get()); if(!str_prop) { LOG_ERROR("The property is not a valid string property."); return false; @@ -71,3 +73,5 @@ StringPropertySerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& return true; } + +}} diff --git a/src/UESaveFile/Serialisers/StringPropertySerialiser.h b/src/Gvas/Serialisers/StringProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/StringPropertySerialiser.h rename to src/Gvas/Serialisers/StringProperty.h index cfca6ce..f66fd98 100644 --- a/src/UESaveFile/Serialisers/StringPropertySerialiser.h +++ b/src/Gvas/Serialisers/StringProperty.h @@ -19,20 +19,24 @@ #include #include -#include "AbstractUnrealPropertySerialiser.h" +#include "AbstractUnrealProperty.h" #include "../Types/StringProperty.h" -class StringPropertySerialiser : public AbstractUnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class StringProperty : public AbstractUnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; - StringArrayView types() override; + auto types() -> StringArrayView override; - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/StructSerialiser.cpp b/src/Gvas/Serialisers/Struct.cpp similarity index 72% rename from src/UESaveFile/Serialisers/StructSerialiser.cpp rename to src/Gvas/Serialisers/Struct.cpp index 1e8affc..3602d66 100644 --- a/src/UESaveFile/Serialisers/StructSerialiser.cpp +++ b/src/Gvas/Serialisers/Struct.cpp @@ -23,18 +23,20 @@ #include "../Types/NoneProperty.h" #include "../../Logger/Logger.h" -#include "StructSerialiser.h" +#include "Struct.h" + +namespace Gvas { namespace Serialisers { StringArrayView -StructSerialiser::types() { +Struct::types() { using namespace Containers::Literals; static const Containers::Array types{InPlaceInit, {"StructProperty"_s}}; return types; } -Containers::Array -StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) +PropertyArray +Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -54,16 +56,16 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie return nullptr; } - Containers::Array array; + Containers::Array array; if(count == 0) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); prop->structType = std::move(item_type); prop->structGuid = std::move(guid); } else { for(std::uint32_t i = 0; i < count; i++) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); prop = serialiser.readItem(reader, item_type, std::size_t(-1), name); @@ -76,7 +78,7 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie return nullptr; } - dynamic_cast(prop.get())->structGuid = guid; + dynamic_cast(prop.get())->structGuid = guid; arrayAppend(array, std::move(prop)); } @@ -85,9 +87,9 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie return array; } -UnrealPropertyBase::ptr -StructSerialiser::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) +Types::UnrealPropertyBase::ptr +Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -96,7 +98,7 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie } if(item_type == "None") { - return NoneProperty::ptr{}; + return Containers::pointer(); } Containers::StaticArray<16, char> guid{ValueInit}; @@ -111,12 +113,12 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie return nullptr; } - UnrealPropertyBase::ptr prop = serialiser.readItem(reader, item_type, value_length, name); + auto prop = serialiser.readItem(reader, item_type, value_length, name); if(!prop) { prop = readStructValue(name, item_type, value_length, reader, serialiser); if(prop) { - dynamic_cast(prop.get())->structGuid = std::move(guid); + dynamic_cast(prop.get())->structGuid = std::move(guid); } } @@ -124,15 +126,15 @@ StructSerialiser::deserialise(Containers::StringView name, Containers::StringVie } bool -StructSerialiser::serialise(Containers::ArrayView props, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) +Struct::serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { bytes_written += writer.writeUEStringToArray(*(props.front()->name)); bytes_written += writer.writeUEStringToArray(item_type); std::size_t vl_pos = writer.arrayPosition(); bytes_written += writer.writeValueToArray(0ull); - auto struct_prop = dynamic_cast(props.front().get()); + auto struct_prop = dynamic_cast(props.front().get()); if(!struct_prop) { LOG_ERROR("The property is not a valid struct property."); return false; @@ -146,7 +148,7 @@ StructSerialiser::serialise(Containers::ArrayView props std::size_t bytes_written_here = 0; for(auto& prop : props) { - struct_prop = dynamic_cast(prop.get()); + struct_prop = dynamic_cast(prop.get()); if(!struct_prop) { LOG_ERROR("The property is not a valid struct property."); return false; @@ -168,10 +170,10 @@ StructSerialiser::serialise(Containers::ArrayView props } bool -StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto struct_prop = dynamic_cast(prop.get()); + auto struct_prop = dynamic_cast(prop.get()); if(!struct_prop) { LOG_ERROR("The property is not a valid struct property."); return false; @@ -194,22 +196,22 @@ StructSerialiser::serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_wr return true; } -StructProperty::ptr -StructSerialiser::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) +Types::StructProperty::ptr +Struct::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { static_cast(value_length); - auto st_prop = Containers::pointer(); + auto st_prop = Containers::pointer(); st_prop->structType = type; - UnrealPropertyBase::ptr prop; + Types::UnrealPropertyBase::ptr prop; while((prop = serialiser.read(reader)) != nullptr) { arrayAppend(st_prop->properties, std::move(prop)); if(st_prop->properties.back()->name == "None" && st_prop->properties.back()->propertyType == "NoneProperty" && - dynamic_cast(st_prop->properties.back().get()) != nullptr) + dynamic_cast(st_prop->properties.back().get()) != nullptr) { break; } @@ -221,10 +223,10 @@ StructSerialiser::readStructValue(Containers::StringView name, Containers::Strin } bool -StructSerialiser::writeStructValue(StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto struct_prop = dynamic_cast(prop); + auto struct_prop = dynamic_cast(prop); if(!struct_prop) { LOG_ERROR("The property is not a valid struct property."); return false; @@ -239,3 +241,5 @@ StructSerialiser::writeStructValue(StructProperty* prop, std::size_t& bytes_writ return true; } + +}} diff --git a/src/Gvas/Serialisers/Struct.h b/src/Gvas/Serialisers/Struct.h new file mode 100644 index 0000000..c26740c --- /dev/null +++ b/src/Gvas/Serialisers/Struct.h @@ -0,0 +1,55 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include + +#include "AbstractUnrealCollectionProperty.h" +#include "AbstractUnrealProperty.h" +#include "AbstractUnrealStruct.h" + +#include "../Types/StructProperty.h" + +namespace Gvas { namespace Serialisers { + +class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionProperty { + public: + using ptr = Containers::Pointer; + + auto types() -> StringArrayView override; + + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) + -> PropertyArray override; + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + + bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) override; + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) override; + + private: + auto readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) -> Types::StructProperty::ptr; + bool writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser); +}; + +}} diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp b/src/Gvas/Serialisers/TextProperty.cpp similarity index 72% rename from src/UESaveFile/Serialisers/TextPropertySerialiser.cpp rename to src/Gvas/Serialisers/TextProperty.cpp index cba065f..4850cd0 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/TextProperty.cpp @@ -16,17 +16,20 @@ #include +#include "../../Logger/Logger.h" + #include "../BinaryReader.h" #include "../BinaryWriter.h" -#include "TextPropertySerialiser.h" +#include "TextProperty.h" -UnrealPropertyBase::ptr -TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); auto start_position = reader.position(); @@ -70,12 +73,12 @@ TextPropertySerialiser::deserialiseProperty(Containers::StringView name, Contain } bool -TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + PropertySerialiser& serialiser) { - auto text_prop = dynamic_cast(prop.get()); - + auto text_prop = dynamic_cast(prop.get()); if(!text_prop) { + LOG_ERROR("The property is not a valid text property."); return false; } @@ -87,3 +90,5 @@ TextPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::si return true; } + +}} diff --git a/src/UESaveFile/Serialisers/TextPropertySerialiser.h b/src/Gvas/Serialisers/TextProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/TextPropertySerialiser.h rename to src/Gvas/Serialisers/TextProperty.h index 865b63e..496c955 100644 --- a/src/UESaveFile/Serialisers/TextPropertySerialiser.h +++ b/src/Gvas/Serialisers/TextProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/TextProperty.h" -class TextPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class TextProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h b/src/Gvas/Serialisers/UnrealProperty.h similarity index 56% rename from src/UESaveFile/Serialisers/UnrealPropertySerialiser.h rename to src/Gvas/Serialisers/UnrealProperty.h index d351030..4ba6b24 100644 --- a/src/UESaveFile/Serialisers/UnrealPropertySerialiser.h +++ b/src/Gvas/Serialisers/UnrealProperty.h @@ -22,23 +22,25 @@ #include #include -#include "AbstractUnrealPropertySerialiser.h" +#include "AbstractUnrealProperty.h" #include "../Types/StructProperty.h" +namespace Gvas { namespace Serialisers { + template -class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser { - static_assert(std::is_base_of::value, "T must be derived from UnrealPropertyBase."); +class UnrealProperty : public AbstractUnrealProperty { + static_assert(std::is_base_of::value, "T must be derived from UnrealPropertyBase."); public: - using ptr = Containers::Pointer>; + using ptr = Containers::Pointer>; - StringArrayView types() override { + auto types() -> StringArrayView override { static const Containers::Array types = []{ Containers::Array array; Containers::Pointer p(new T); - if(std::is_base_of::value) { + if(std::is_base_of::value) { array = Containers::Array{InPlaceInit, { - dynamic_cast(p.get())->structType + dynamic_cast(p.get())->structType }}; } else { @@ -49,24 +51,26 @@ class UnrealPropertySerialiser : public AbstractUnrealPropertySerialiser { return types; } - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override + auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override { return deserialiseProperty(name, type, value_length, reader, serialiser); } - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override { return serialiseProperty(prop, bytes_written, writer, serialiser); } private: - virtual UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) = 0; + virtual auto deserialiseProperty(Containers::StringView name, Containers::StringView type, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr = 0; - virtual bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) = 0; + virtual bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) = 0; }; + +}} diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp b/src/Gvas/Serialisers/Vector2DProperty.cpp similarity index 65% rename from src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp rename to src/Gvas/Serialisers/Vector2DProperty.cpp index 6cb611a..40f69eb 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/Vector2DProperty.cpp @@ -18,14 +18,15 @@ #include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "Vector2DPropertySerialiser.h" +#include "Vector2DProperty.h" -UnrealPropertyBase::ptr -Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, + std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y)) { LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name); @@ -36,10 +37,10 @@ Vector2DPropertySerialiser::deserialiseProperty(Containers::StringView name, Con } bool -Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { - auto vector = dynamic_cast(prop.get()); + auto vector = dynamic_cast(prop.get()); if(!vector) { LOG_ERROR("The property is not a valid 2D vector property."); return false; @@ -49,3 +50,5 @@ Vector2DPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std return true; } + +}} diff --git a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h b/src/Gvas/Serialisers/Vector2DProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h rename to src/Gvas/Serialisers/Vector2DProperty.h index cc40bb1..daee73d 100644 --- a/src/UESaveFile/Serialisers/Vector2DPropertySerialiser.h +++ b/src/Gvas/Serialisers/Vector2DProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/Vector2DStructProperty.h" -class Vector2DPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class Vector2DProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp b/src/Gvas/Serialisers/VectorProperty.cpp similarity index 67% rename from src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp rename to src/Gvas/Serialisers/VectorProperty.cpp index 7e07989..2dc84db 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.cpp +++ b/src/Gvas/Serialisers/VectorProperty.cpp @@ -14,18 +14,20 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" #include "../../Logger/Logger.h" -#include "VectorPropertySerialiser.h" +#include "../BinaryReader.h" +#include "../BinaryWriter.h" -UnrealPropertyBase::ptr -VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) +#include "VectorProperty.h" + +namespace Gvas { namespace Serialisers { + +Types::UnrealPropertyBase::ptr +VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) { - auto prop = Containers::pointer(); + auto prop = Containers::pointer(); if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) { LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name); @@ -36,10 +38,10 @@ VectorPropertySerialiser::deserialiseProperty(Containers::StringView name, Conta } bool -VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) +VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryWriter& writer, PropertySerialiser& serialiser) { - auto vector = dynamic_cast(prop.get()); + auto vector = dynamic_cast(prop.get()); if(!vector) { LOG_ERROR("The property is not a valid vector property."); return false; @@ -50,3 +52,5 @@ VectorPropertySerialiser::serialiseProperty(UnrealPropertyBase::ptr& prop, std:: return true; } + +}} diff --git a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h b/src/Gvas/Serialisers/VectorProperty.h similarity index 60% rename from src/UESaveFile/Serialisers/VectorPropertySerialiser.h rename to src/Gvas/Serialisers/VectorProperty.h index 212adef..d0af522 100644 --- a/src/UESaveFile/Serialisers/VectorPropertySerialiser.h +++ b/src/Gvas/Serialisers/VectorProperty.h @@ -18,18 +18,22 @@ #include -#include "UnrealPropertySerialiser.h" +#include "UnrealProperty.h" #include "../Types/VectorStructProperty.h" -class VectorPropertySerialiser : public UnrealPropertySerialiser { +namespace Gvas { namespace Serialisers { + +class VectorProperty : public UnrealProperty { public: - using ptr = Containers::Pointer; + using ptr = Containers::Pointer; private: - UnrealPropertyBase::ptr deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - bool serialiseProperty(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, + BinaryReader& reader, PropertySerialiser& serialiser) + -> Types::UnrealPropertyBase::ptr override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) override; }; + +}} diff --git a/src/UESaveFile/Types/ArrayProperty.h b/src/Gvas/Types/ArrayProperty.h similarity index 97% rename from src/UESaveFile/Types/ArrayProperty.h rename to src/Gvas/Types/ArrayProperty.h index 4c4f476..65d73d6 100644 --- a/src/UESaveFile/Types/ArrayProperty.h +++ b/src/Gvas/Types/ArrayProperty.h @@ -23,6 +23,8 @@ #include "UnrealPropertyBase.h" +namespace Gvas { namespace Types { + struct ArrayProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -44,3 +46,5 @@ struct ArrayProperty : public UnrealPropertyBase { Containers::String itemType; Containers::Array items; }; + +}} diff --git a/src/UESaveFile/Types/BoolProperty.h b/src/Gvas/Types/BoolProperty.h similarity index 96% rename from src/UESaveFile/Types/BoolProperty.h rename to src/Gvas/Types/BoolProperty.h index cc70178..eda8b72 100644 --- a/src/UESaveFile/Types/BoolProperty.h +++ b/src/Gvas/Types/BoolProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct BoolProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -31,3 +33,5 @@ struct BoolProperty : public UnrealProperty { propertyType = "BoolProperty"_s; } }; + +}} diff --git a/src/UESaveFile/Types/ByteProperty.h b/src/Gvas/Types/ByteProperty.h similarity index 87% rename from src/UESaveFile/Types/ByteProperty.h rename to src/Gvas/Types/ByteProperty.h index 7c55d9d..cc9065a 100644 --- a/src/UESaveFile/Types/ByteProperty.h +++ b/src/Gvas/Types/ByteProperty.h @@ -25,6 +25,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct ByteProperty : public UnrealProperty> { using ptr = Containers::Pointer; @@ -33,7 +35,10 @@ struct ByteProperty : public UnrealProperty> { propertyType = "ByteProperty"_s; } - // For some reason, M.A.S.S. Builder stores EnumProperties as ByteProperties. Ugh... + // M.A.S.S. Builder stores EnumProperties as ByteProperties. + // I wonder if it's a general UE thing and agc93/unsave was just wrong. Containers::String enumType; Containers::String enumValue; }; + +}} diff --git a/src/UESaveFile/Types/ColourStructProperty.h b/src/Gvas/Types/ColourStructProperty.h similarity index 96% rename from src/UESaveFile/Types/ColourStructProperty.h rename to src/Gvas/Types/ColourStructProperty.h index 38878f3..cc69b1d 100644 --- a/src/UESaveFile/Types/ColourStructProperty.h +++ b/src/Gvas/Types/ColourStructProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct ColourStructProperty : public StructProperty { using ptr = Containers::Pointer; ColourStructProperty() { @@ -31,3 +33,5 @@ struct ColourStructProperty : public StructProperty { } float r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f; }; + +}} diff --git a/src/UESaveFile/Types/DateTimeStructProperty.h b/src/Gvas/Types/DateTimeStructProperty.h similarity index 96% rename from src/UESaveFile/Types/DateTimeStructProperty.h rename to src/Gvas/Types/DateTimeStructProperty.h index 4f3f37c..a917055 100644 --- a/src/UESaveFile/Types/DateTimeStructProperty.h +++ b/src/Gvas/Types/DateTimeStructProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct DateTimeStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -33,3 +35,5 @@ struct DateTimeStructProperty : public StructProperty { std::int64_t timestamp = 0; }; + +}} diff --git a/src/UESaveFile/Types/EnumProperty.h b/src/Gvas/Types/EnumProperty.h similarity index 96% rename from src/UESaveFile/Types/EnumProperty.h rename to src/Gvas/Types/EnumProperty.h index c3941a5..834cf8f 100644 --- a/src/UESaveFile/Types/EnumProperty.h +++ b/src/Gvas/Types/EnumProperty.h @@ -24,6 +24,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct EnumProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -34,3 +36,5 @@ struct EnumProperty : public UnrealProperty { Containers::String enumType; }; + +}} diff --git a/src/UESaveFile/Types/FloatProperty.h b/src/Gvas/Types/FloatProperty.h similarity index 96% rename from src/UESaveFile/Types/FloatProperty.h rename to src/Gvas/Types/FloatProperty.h index c5ec882..7d9ea3f 100644 --- a/src/UESaveFile/Types/FloatProperty.h +++ b/src/Gvas/Types/FloatProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct FloatProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -31,3 +33,5 @@ struct FloatProperty : public UnrealProperty { propertyType = "FloatProperty"_s; } }; + +}} diff --git a/src/UESaveFile/Types/GenericStructProperty.h b/src/Gvas/Types/GenericStructProperty.h similarity index 97% rename from src/UESaveFile/Types/GenericStructProperty.h rename to src/Gvas/Types/GenericStructProperty.h index 5c72bb6..409d601 100644 --- a/src/UESaveFile/Types/GenericStructProperty.h +++ b/src/Gvas/Types/GenericStructProperty.h @@ -26,6 +26,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct GenericStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -53,3 +55,5 @@ struct GenericStructProperty : public StructProperty { Containers::Array properties; }; + +}} diff --git a/src/UESaveFile/Types/GuidStructProperty.h b/src/Gvas/Types/GuidStructProperty.h similarity index 96% rename from src/UESaveFile/Types/GuidStructProperty.h rename to src/Gvas/Types/GuidStructProperty.h index 8a8e490..1b53b56 100644 --- a/src/UESaveFile/Types/GuidStructProperty.h +++ b/src/Gvas/Types/GuidStructProperty.h @@ -24,6 +24,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct GuidStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -34,3 +36,5 @@ struct GuidStructProperty : public StructProperty { Containers::StaticArray<16, char> guid{ValueInit}; }; + +}} diff --git a/src/UESaveFile/Types/IntProperty.h b/src/Gvas/Types/IntProperty.h similarity index 96% rename from src/UESaveFile/Types/IntProperty.h rename to src/Gvas/Types/IntProperty.h index a92e807..c966397 100644 --- a/src/UESaveFile/Types/IntProperty.h +++ b/src/Gvas/Types/IntProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct IntProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -31,3 +33,5 @@ struct IntProperty : public UnrealProperty { propertyType = "IntProperty"_s; } }; + +}} diff --git a/src/UESaveFile/Types/MapProperty.h b/src/Gvas/Types/MapProperty.h similarity index 94% rename from src/UESaveFile/Types/MapProperty.h rename to src/Gvas/Types/MapProperty.h index 306552c..44f8ec8 100644 --- a/src/UESaveFile/Types/MapProperty.h +++ b/src/Gvas/Types/MapProperty.h @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include #include #include #include @@ -24,6 +25,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct MapProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -42,3 +45,5 @@ struct MapProperty : public UnrealPropertyBase { Containers::Array map; }; + +}} diff --git a/src/UESaveFile/Types/NoneProperty.h b/src/Gvas/Types/NoneProperty.h similarity index 96% rename from src/UESaveFile/Types/NoneProperty.h rename to src/Gvas/Types/NoneProperty.h index 68cc44a..4d8dfdd 100644 --- a/src/UESaveFile/Types/NoneProperty.h +++ b/src/Gvas/Types/NoneProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct NoneProperty : UnrealPropertyBase { using ptr = Containers::Pointer; @@ -32,3 +34,5 @@ struct NoneProperty : UnrealPropertyBase { propertyType = "NoneProperty"_s; } }; + +}} diff --git a/src/UESaveFile/Types/ResourceItemValue.h b/src/Gvas/Types/ResourceItemValue.h similarity index 97% rename from src/UESaveFile/Types/ResourceItemValue.h rename to src/Gvas/Types/ResourceItemValue.h index c5d9e7c..a6f0e63 100644 --- a/src/UESaveFile/Types/ResourceItemValue.h +++ b/src/Gvas/Types/ResourceItemValue.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct ResourceItemValue : public StructProperty { using ptr = Containers::Pointer; @@ -38,3 +40,5 @@ struct ResourceItemValue : public StructProperty { std::int32_t id = 0; std::int32_t quantity = 0; }; + +}} diff --git a/src/UESaveFile/Types/RotatorStructProperty.h b/src/Gvas/Types/RotatorStructProperty.h similarity index 96% rename from src/UESaveFile/Types/RotatorStructProperty.h rename to src/Gvas/Types/RotatorStructProperty.h index c8e5a7c..5579a33 100644 --- a/src/UESaveFile/Types/RotatorStructProperty.h +++ b/src/Gvas/Types/RotatorStructProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct RotatorStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -33,3 +35,5 @@ struct RotatorStructProperty : public StructProperty { float x = 0.0f, y = 0.0f, z = 0.0f; }; + +}} diff --git a/src/UESaveFile/Types/SetProperty.h b/src/Gvas/Types/SetProperty.h similarity index 97% rename from src/UESaveFile/Types/SetProperty.h rename to src/Gvas/Types/SetProperty.h index 6e51a18..deffd22 100644 --- a/src/UESaveFile/Types/SetProperty.h +++ b/src/Gvas/Types/SetProperty.h @@ -25,6 +25,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct SetProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -44,3 +46,5 @@ struct SetProperty : public UnrealPropertyBase { Containers::String itemType; Containers::Array items; }; + +}} diff --git a/src/UESaveFile/Types/StringProperty.h b/src/Gvas/Types/StringProperty.h similarity index 96% rename from src/UESaveFile/Types/StringProperty.h rename to src/Gvas/Types/StringProperty.h index 0a0526e..cfc4ebe 100644 --- a/src/UESaveFile/Types/StringProperty.h +++ b/src/Gvas/Types/StringProperty.h @@ -25,6 +25,8 @@ using namespace Corrade; using namespace Containers::Literals; +namespace Gvas { namespace Types { + struct StringProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -32,3 +34,5 @@ struct StringProperty : public UnrealProperty { propertyType = type; } }; + +}} diff --git a/src/UESaveFile/Types/StructProperty.h b/src/Gvas/Types/StructProperty.h similarity index 96% rename from src/UESaveFile/Types/StructProperty.h rename to src/Gvas/Types/StructProperty.h index 3bb8d14..541f0db 100644 --- a/src/UESaveFile/Types/StructProperty.h +++ b/src/Gvas/Types/StructProperty.h @@ -25,6 +25,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct StructProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -36,3 +38,5 @@ struct StructProperty : public UnrealPropertyBase { Containers::StaticArray<16, char> structGuid{ValueInit}; Containers::String structType; }; + +}} diff --git a/src/UESaveFile/Types/TextProperty.h b/src/Gvas/Types/TextProperty.h similarity index 96% rename from src/UESaveFile/Types/TextProperty.h rename to src/Gvas/Types/TextProperty.h index 8f4e8ad..7392dfe 100644 --- a/src/UESaveFile/Types/TextProperty.h +++ b/src/Gvas/Types/TextProperty.h @@ -25,6 +25,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct TextProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -37,3 +39,5 @@ struct TextProperty : public UnrealProperty { char id = 0; Containers::Array data; }; + +}} diff --git a/src/UESaveFile/Debug.h b/src/Gvas/Types/Types.h similarity index 64% rename from src/UESaveFile/Debug.h rename to src/Gvas/Types/Types.h index 1f6f879..8ebe58a 100644 --- a/src/UESaveFile/Debug.h +++ b/src/Gvas/Types/Types.h @@ -16,18 +16,30 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include +namespace Gvas { namespace Types { -struct ArrayProperty; -struct SetProperty; -struct GenericStructProperty; -struct StructProperty; struct UnrealPropertyBase; +template +struct UnrealProperty; +struct ArrayProperty; +struct BoolProperty; +struct ByteProperty; +struct ColourStructProperty; +struct DateTimeStructProperty; +struct EnumProperty; +struct FloatProperty; +struct GenericStructProperty; +struct GuidStructProperty; +struct IntProperty; +struct MapProperty; +struct NoneProperty; +struct ResourceItemValue; +struct RotatorStructProperty; +struct SetProperty; +struct StringProperty; +struct StructProperty; +struct TextProperty; +struct Vector2DStructProperty; +struct VectorStructProperty; -using namespace Corrade; - -Utility::Debug& operator<<(Utility::Debug& debug, const ArrayProperty* prop); -Utility::Debug& operator<<(Utility::Debug& debug, const SetProperty* prop); -Utility::Debug& operator<<(Utility::Debug& debug, const GenericStructProperty* prop); -Utility::Debug& operator<<(Utility::Debug& debug, const StructProperty* prop); -Utility::Debug& operator<<(Utility::Debug& debug, const UnrealPropertyBase* prop); +}} diff --git a/src/UESaveFile/Types/UnrealProperty.h b/src/Gvas/Types/UnrealProperty.h similarity index 96% rename from src/UESaveFile/Types/UnrealProperty.h rename to src/Gvas/Types/UnrealProperty.h index 33b63b7..6f9fe39 100644 --- a/src/UESaveFile/Types/UnrealProperty.h +++ b/src/Gvas/Types/UnrealProperty.h @@ -22,9 +22,13 @@ using namespace Corrade; +namespace Gvas { namespace Types { + template struct UnrealProperty : public UnrealPropertyBase { using ptr = Containers::Pointer>; T value; }; + +}} diff --git a/src/UESaveFile/Types/UnrealPropertyBase.h b/src/Gvas/Types/UnrealPropertyBase.h similarity index 96% rename from src/UESaveFile/Types/UnrealPropertyBase.h rename to src/Gvas/Types/UnrealPropertyBase.h index d27714f..01ca885 100644 --- a/src/UESaveFile/Types/UnrealPropertyBase.h +++ b/src/Gvas/Types/UnrealPropertyBase.h @@ -24,6 +24,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct UnrealPropertyBase { using ptr = Containers::Pointer; @@ -33,3 +35,5 @@ struct UnrealPropertyBase { Containers::String propertyType; std::size_t valueLength = 0; }; + +}} diff --git a/src/UESaveFile/Types/Vector2DStructProperty.h b/src/Gvas/Types/Vector2DStructProperty.h similarity index 96% rename from src/UESaveFile/Types/Vector2DStructProperty.h rename to src/Gvas/Types/Vector2DStructProperty.h index 64682d3..67f1127 100644 --- a/src/UESaveFile/Types/Vector2DStructProperty.h +++ b/src/Gvas/Types/Vector2DStructProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct Vector2DStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -33,3 +35,5 @@ struct Vector2DStructProperty : public StructProperty { float x = 0.0f, y = 0.0f; }; + +}} diff --git a/src/UESaveFile/Types/VectorStructProperty.h b/src/Gvas/Types/VectorStructProperty.h similarity index 96% rename from src/UESaveFile/Types/VectorStructProperty.h rename to src/Gvas/Types/VectorStructProperty.h index ecf2328..c7e277d 100644 --- a/src/UESaveFile/Types/VectorStructProperty.h +++ b/src/Gvas/Types/VectorStructProperty.h @@ -23,6 +23,8 @@ using namespace Corrade; +namespace Gvas { namespace Types { + struct VectorStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -33,3 +35,5 @@ struct VectorStructProperty : public StructProperty { float x = 0.0f, y = 0.0f, z = 0.0f; }; + +}} diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index 409f94f..cbe309d 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -45,7 +45,7 @@ class Logger { Logger(Logger&&) = delete; Logger& operator=(Logger&&) = delete; - static Logger& instance(); + static auto instance() -> Logger&; void initialise(); @@ -69,7 +69,7 @@ class Logger { std::mutex _logMutex{}; }; -Logger& logger(); +auto logger() -> Logger&; #define LOG(entry_type, message) logger().lockMutex(); \ logger().log(EntryType::entry_type, \ diff --git a/src/Logger/MagnumLogBuffer.h b/src/Logger/MagnumLogBuffer.h index 010c788..da45b04 100644 --- a/src/Logger/MagnumLogBuffer.h +++ b/src/Logger/MagnumLogBuffer.h @@ -28,7 +28,7 @@ class MagnumLogBuffer : public std::stringbuf { ~MagnumLogBuffer() override; private: - int sync() override; + auto sync() -> int override; EntryType _type; }; diff --git a/src/Maps/Accessories.h b/src/Maps/Accessories.h index ab3e6e1..8f8b7b4 100644 --- a/src/Maps/Accessories.h +++ b/src/Maps/Accessories.h @@ -25,659 +25,662 @@ using namespace Corrade; using namespace Containers::Literals; -enum AccessorySize { - S, - M, - L, - XL -}; +namespace mbst { namespace GameData { -struct AccessoryData{ +struct Accessory { Containers::StringView name; - AccessorySize size = AccessorySize::S; + enum Size { + S, + M, + L, + XL + }; + Size size{}; }; -static const std::map accessories { +static const std::map accessories{ // region Primitives - {1, {"Cube"_s, AccessorySize::S}}, - {2, {"Pentagon"_s, AccessorySize::S}}, - {3, {"Hexagon"_s, AccessorySize::S}}, - {4, {"Cylinder"_s, AccessorySize::S}}, - {5, {"Sphere"_s, AccessorySize::S}}, - {6, {"TriPyramid"_s, AccessorySize::S}}, - {7, {"SquPyramid"_s, AccessorySize::S}}, - {8, {"PenPyramid"_s, AccessorySize::S}}, - {9, {"HexPyramid"_s, AccessorySize::S}}, - {10, {"Cone"_s, AccessorySize::S}}, - {11, {"SquStick"_s, AccessorySize::S}}, - {12, {"PenStick"_s, AccessorySize::S}}, - {13, {"HexStick"_s, AccessorySize::S}}, - {14, {"CycStick"_s, AccessorySize::S}}, - {15, {"Capsule"_s, AccessorySize::S}}, - {16, {"Decal Pad 01"_s, AccessorySize::S}}, - {17, {"Decal Pad 02"_s, AccessorySize::S}}, - {18, {"Decal Pad 03"_s, AccessorySize::S}}, - {19, {"Decal Pad 04"_s, AccessorySize::S}}, - {20, {"Decal Pad 05"_s, AccessorySize::S}}, - {21, {"Triangle"_s, AccessorySize::S}}, - {22, {"ThinStar"_s, AccessorySize::S}}, - {23, {"Star"_s, AccessorySize::S}}, - {24, {"SixSideStar"_s, AccessorySize::S}}, - {25, {"Asterisk"_s, AccessorySize::S}}, - {26, {"Ring"_s, AccessorySize::S}}, - {27, {"SawedRing"_s, AccessorySize::S}}, - {28, {"HalfRing"_s, AccessorySize::S}}, - {29, {"Cresent"_s, AccessorySize::S}}, - {30, {"Donut"_s, AccessorySize::S}}, - {31, {"FiveCogWheel"_s, AccessorySize::S}}, - {32, {"SixCogWheel"_s, AccessorySize::S}}, - {33, {"SevenCogWheel"_s, AccessorySize::S}}, - {34, {"EightCogWheel"_s, AccessorySize::S}}, - {35, {"TwelveCogWheel"_s, AccessorySize::S}}, + {1, {"Cube"_s, Accessory::Size::S}}, + {2, {"Pentagon"_s, Accessory::Size::S}}, + {3, {"Hexagon"_s, Accessory::Size::S}}, + {4, {"Cylinder"_s, Accessory::Size::S}}, + {5, {"Sphere"_s, Accessory::Size::S}}, + {6, {"TriPyramid"_s, Accessory::Size::S}}, + {7, {"SquPyramid"_s, Accessory::Size::S}}, + {8, {"PenPyramid"_s, Accessory::Size::S}}, + {9, {"HexPyramid"_s, Accessory::Size::S}}, + {10, {"Cone"_s, Accessory::Size::S}}, + {11, {"SquStick"_s, Accessory::Size::S}}, + {12, {"PenStick"_s, Accessory::Size::S}}, + {13, {"HexStick"_s, Accessory::Size::S}}, + {14, {"CycStick"_s, Accessory::Size::S}}, + {15, {"Capsule"_s, Accessory::Size::S}}, + {16, {"Decal Pad 01"_s, Accessory::Size::S}}, + {17, {"Decal Pad 02"_s, Accessory::Size::S}}, + {18, {"Decal Pad 03"_s, Accessory::Size::S}}, + {19, {"Decal Pad 04"_s, Accessory::Size::S}}, + {20, {"Decal Pad 05"_s, Accessory::Size::S}}, + {21, {"Triangle"_s, Accessory::Size::S}}, + {22, {"ThinStar"_s, Accessory::Size::S}}, + {23, {"Star"_s, Accessory::Size::S}}, + {24, {"SixSideStar"_s, Accessory::Size::S}}, + {25, {"Asterisk"_s, Accessory::Size::S}}, + {26, {"Ring"_s, Accessory::Size::S}}, + {27, {"SawedRing"_s, Accessory::Size::S}}, + {28, {"HalfRing"_s, Accessory::Size::S}}, + {29, {"Cresent"_s, Accessory::Size::S}}, + {30, {"Donut"_s, Accessory::Size::S}}, + {31, {"FiveCogWheel"_s, Accessory::Size::S}}, + {32, {"SixCogWheel"_s, Accessory::Size::S}}, + {33, {"SevenCogWheel"_s, Accessory::Size::S}}, + {34, {"EightCogWheel"_s, Accessory::Size::S}}, + {35, {"TwelveCogWheel"_s, Accessory::Size::S}}, - {51, {"SquBevel"_s, AccessorySize::S}}, - {52, {"TriBevel"_s, AccessorySize::S}}, - {53, {"PenBevel"_s, AccessorySize::S}}, - {54, {"HexBevel"_s, AccessorySize::S}}, - {55, {"CycBevel"_s, AccessorySize::S}}, - {56, {"RecBevel"_s, AccessorySize::S}}, - {57, {"DaiBevel"_s, AccessorySize::S}}, - {58, {"MonBevel"_s, AccessorySize::S}}, - {59, {"CofBevel"_s, AccessorySize::S}}, - {60, {"JevBevel"_s, AccessorySize::S}}, - {61, {"SquEmboss"_s, AccessorySize::S}}, - {62, {"TriEmboss"_s, AccessorySize::S}}, - {63, {"PenEmboss"_s, AccessorySize::S}}, - {64, {"HexEmboss"_s, AccessorySize::S}}, - {65, {"CycEmboss"_s, AccessorySize::S}}, - {66, {"RecEmboss"_s, AccessorySize::S}}, - {67, {"DaiEmboss"_s, AccessorySize::S}}, - {68, {"MonEmboss"_s, AccessorySize::S}}, - {69, {"CofEmboss"_s, AccessorySize::S}}, - {70, {"JevEmboss"_s, AccessorySize::S}}, + {51, {"SquBevel"_s, Accessory::Size::S}}, + {52, {"TriBevel"_s, Accessory::Size::S}}, + {53, {"PenBevel"_s, Accessory::Size::S}}, + {54, {"HexBevel"_s, Accessory::Size::S}}, + {55, {"CycBevel"_s, Accessory::Size::S}}, + {56, {"RecBevel"_s, Accessory::Size::S}}, + {57, {"DaiBevel"_s, Accessory::Size::S}}, + {58, {"MonBevel"_s, Accessory::Size::S}}, + {59, {"CofBevel"_s, Accessory::Size::S}}, + {60, {"JevBevel"_s, Accessory::Size::S}}, + {61, {"SquEmboss"_s, Accessory::Size::S}}, + {62, {"TriEmboss"_s, Accessory::Size::S}}, + {63, {"PenEmboss"_s, Accessory::Size::S}}, + {64, {"HexEmboss"_s, Accessory::Size::S}}, + {65, {"CycEmboss"_s, Accessory::Size::S}}, + {66, {"RecEmboss"_s, Accessory::Size::S}}, + {67, {"DaiEmboss"_s, Accessory::Size::S}}, + {68, {"MonEmboss"_s, Accessory::Size::S}}, + {69, {"CofEmboss"_s, Accessory::Size::S}}, + {70, {"JevEmboss"_s, Accessory::Size::S}}, - {101, {"Flat Hex Pin"_s, AccessorySize::S}}, - {102, {"Cross Circle Pin"_s, AccessorySize::S}}, - {103, {"Flat Circle Pin"_s, AccessorySize::S}}, - {104, {"Hex Circle Pin"_s, AccessorySize::S}}, - {105, {"Circle Button Pin"_s, AccessorySize::S}}, - {106, {"Hexagon Pin"_s, AccessorySize::S}}, - {107, {"Cross Square Pin"_s, AccessorySize::S}}, - {108, {"Flat Square Pin"_s, AccessorySize::S}}, - {109, {"Quad Corner Pin"_s, AccessorySize::S}}, - {110, {"Bi Corner Pin"_s, AccessorySize::S}}, - {111, {"Circle Pin"_s, AccessorySize::S}}, - {112, {"Flat End Pin"_s, AccessorySize::S}}, - {113, {"Flat Cut Pin"_s, AccessorySize::S}}, - {114, {"Radial Pin"_s, AccessorySize::S}}, - {115, {"Diamiter Pin"_s, AccessorySize::S}}, + {101, {"Flat Hex Pin"_s, Accessory::Size::S}}, + {102, {"Cross Circle Pin"_s, Accessory::Size::S}}, + {103, {"Flat Circle Pin"_s, Accessory::Size::S}}, + {104, {"Hex Circle Pin"_s, Accessory::Size::S}}, + {105, {"Circle Button Pin"_s, Accessory::Size::S}}, + {106, {"Hexagon Pin"_s, Accessory::Size::S}}, + {107, {"Cross Square Pin"_s, Accessory::Size::S}}, + {108, {"Flat Square Pin"_s, Accessory::Size::S}}, + {109, {"Quad Corner Pin"_s, Accessory::Size::S}}, + {110, {"Bi Corner Pin"_s, Accessory::Size::S}}, + {111, {"Circle Pin"_s, Accessory::Size::S}}, + {112, {"Flat End Pin"_s, Accessory::Size::S}}, + {113, {"Flat Cut Pin"_s, Accessory::Size::S}}, + {114, {"Radial Pin"_s, Accessory::Size::S}}, + {115, {"Diamiter Pin"_s, Accessory::Size::S}}, - {151, {"TriPoint"_s, AccessorySize::S}}, - {152, {"SquPoint"_s, AccessorySize::S}}, - {153, {"PenPoint"_s, AccessorySize::S}}, - {154, {"HexPoint"_s, AccessorySize::S}}, - {155, {"CycPoint"_s, AccessorySize::S}}, - {156, {"Bevel SquCutPoint"_s, AccessorySize::S}}, - {157, {"Bevel HexCutPoint"_s, AccessorySize::S}}, - {158, {"Bevel HexPoint"_s, AccessorySize::S}}, - {159, {"Bevel CycCutPoint"_s, AccessorySize::S}}, - {160, {"Bevel CycPoint"_s, AccessorySize::S}}, + {151, {"TriPoint"_s, Accessory::Size::S}}, + {152, {"SquPoint"_s, Accessory::Size::S}}, + {153, {"PenPoint"_s, Accessory::Size::S}}, + {154, {"HexPoint"_s, Accessory::Size::S}}, + {155, {"CycPoint"_s, Accessory::Size::S}}, + {156, {"Bevel SquCutPoint"_s, Accessory::Size::S}}, + {157, {"Bevel HexCutPoint"_s, Accessory::Size::S}}, + {158, {"Bevel HexPoint"_s, Accessory::Size::S}}, + {159, {"Bevel CycCutPoint"_s, Accessory::Size::S}}, + {160, {"Bevel CycPoint"_s, Accessory::Size::S}}, - {201, {"Shaped Edge 01"_s, AccessorySize::M}}, - {202, {"Shaped Edge 02"_s, AccessorySize::M}}, - {203, {"Shaped Edge 03"_s, AccessorySize::M}}, - {204, {"Shaped Edge 04"_s, AccessorySize::M}}, - {205, {"Shaped Edge 05"_s, AccessorySize::M}}, - {206, {"Shaped Edge 06"_s, AccessorySize::M}}, - {207, {"Shaped Edge 07"_s, AccessorySize::M}}, - {208, {"Shaped Edge 08"_s, AccessorySize::M}}, - {209, {"Shaped Edge 09"_s, AccessorySize::M}}, - {210, {"Shaped Edge 10"_s, AccessorySize::M}}, - {211, {"Shaped Edge 11"_s, AccessorySize::M}}, - {212, {"Shaped Edge 12"_s, AccessorySize::M}}, - {213, {"Shaped Edge 13"_s, AccessorySize::M}}, - {214, {"Shaped Edge 14"_s, AccessorySize::M}}, - {215, {"Shaped Edge 15"_s, AccessorySize::M}}, - {216, {"Shaped Edge 16"_s, AccessorySize::M}}, - {217, {"Shaped Edge 17"_s, AccessorySize::M}}, - {218, {"Shaped Edge 18"_s, AccessorySize::M}}, - {219, {"Shaped Edge 19"_s, AccessorySize::M}}, - {220, {"Shaped Edge 20"_s, AccessorySize::M}}, + {201, {"Shaped Edge 01"_s, Accessory::Size::M}}, + {202, {"Shaped Edge 02"_s, Accessory::Size::M}}, + {203, {"Shaped Edge 03"_s, Accessory::Size::M}}, + {204, {"Shaped Edge 04"_s, Accessory::Size::M}}, + {205, {"Shaped Edge 05"_s, Accessory::Size::M}}, + {206, {"Shaped Edge 06"_s, Accessory::Size::M}}, + {207, {"Shaped Edge 07"_s, Accessory::Size::M}}, + {208, {"Shaped Edge 08"_s, Accessory::Size::M}}, + {209, {"Shaped Edge 09"_s, Accessory::Size::M}}, + {210, {"Shaped Edge 10"_s, Accessory::Size::M}}, + {211, {"Shaped Edge 11"_s, Accessory::Size::M}}, + {212, {"Shaped Edge 12"_s, Accessory::Size::M}}, + {213, {"Shaped Edge 13"_s, Accessory::Size::M}}, + {214, {"Shaped Edge 14"_s, Accessory::Size::M}}, + {215, {"Shaped Edge 15"_s, Accessory::Size::M}}, + {216, {"Shaped Edge 16"_s, Accessory::Size::M}}, + {217, {"Shaped Edge 17"_s, Accessory::Size::M}}, + {218, {"Shaped Edge 18"_s, Accessory::Size::M}}, + {219, {"Shaped Edge 19"_s, Accessory::Size::M}}, + {220, {"Shaped Edge 20"_s, Accessory::Size::M}}, - {251, {"Fish Tail 01"_s, AccessorySize::M}}, - {252, {"Fish Tail 02"_s, AccessorySize::M}}, - {253, {"Fish Tail 03"_s, AccessorySize::M}}, - {254, {"Fish Tail 04"_s, AccessorySize::M}}, - {255, {"Fish Tail 05"_s, AccessorySize::M}}, - {256, {"Based Separator 01"_s, AccessorySize::M}}, - {257, {"Based Separator 02"_s, AccessorySize::M}}, - {258, {"Based Separator 03"_s, AccessorySize::M}}, - {259, {"Based Separator 04"_s, AccessorySize::M}}, - {260, {"Based Separator 05"_s, AccessorySize::M}}, - {261, {"Based Separator 06"_s, AccessorySize::M}}, - {262, {"Based Separator 07"_s, AccessorySize::M}}, - {263, {"Based Separator 08"_s, AccessorySize::M}}, - {264, {"Based Separator 09"_s, AccessorySize::M}}, - {265, {"Based Separator 10"_s, AccessorySize::M}}, + {251, {"Fish Tail 01"_s, Accessory::Size::M}}, + {252, {"Fish Tail 02"_s, Accessory::Size::M}}, + {253, {"Fish Tail 03"_s, Accessory::Size::M}}, + {254, {"Fish Tail 04"_s, Accessory::Size::M}}, + {255, {"Fish Tail 05"_s, Accessory::Size::M}}, + {256, {"Based Separator 01"_s, Accessory::Size::M}}, + {257, {"Based Separator 02"_s, Accessory::Size::M}}, + {258, {"Based Separator 03"_s, Accessory::Size::M}}, + {259, {"Based Separator 04"_s, Accessory::Size::M}}, + {260, {"Based Separator 05"_s, Accessory::Size::M}}, + {261, {"Based Separator 06"_s, Accessory::Size::M}}, + {262, {"Based Separator 07"_s, Accessory::Size::M}}, + {263, {"Based Separator 08"_s, Accessory::Size::M}}, + {264, {"Based Separator 09"_s, Accessory::Size::M}}, + {265, {"Based Separator 10"_s, Accessory::Size::M}}, - {301, {"Rectangular Box 01"_s, AccessorySize::M}}, - {302, {"Rectangular Box 02"_s, AccessorySize::M}}, - {303, {"Rectangular Box 03"_s, AccessorySize::M}}, - {304, {"Rectangular Box 04"_s, AccessorySize::M}}, - {305, {"Rectangular Box 05"_s, AccessorySize::M}}, - {306, {"CofBox 01"_s, AccessorySize::M}}, - {307, {"CofBox 02"_s, AccessorySize::M}}, - {308, {"CofBox 03"_s, AccessorySize::M}}, - {309, {"CofBox 04"_s, AccessorySize::M}}, - {310, {"CofBox 05"_s, AccessorySize::M}}, - {311, {"Triangular Box 01"_s, AccessorySize::M}}, - {312, {"Triangular Box 02"_s, AccessorySize::M}}, - {313, {"Triangular Box 03"_s, AccessorySize::M}}, - {314, {"Triangular Box 04"_s, AccessorySize::M}}, - {315, {"Triangular Box 05"_s, AccessorySize::M}}, - {316, {"Diagonal Box A01"_s, AccessorySize::M}}, - {317, {"Diagonal Box A02"_s, AccessorySize::M}}, - {318, {"Diagonal Box A03"_s, AccessorySize::M}}, - {319, {"Diagonal Box A04"_s, AccessorySize::M}}, - {320, {"Diagonal Box A05"_s, AccessorySize::M}}, - {321, {"Diagonal Box B01"_s, AccessorySize::M}}, - {322, {"Diagonal Box B02"_s, AccessorySize::M}}, - {323, {"Diagonal Box B03"_s, AccessorySize::M}}, - {324, {"Diagonal Box B04"_s, AccessorySize::M}}, - {325, {"Diagonal Box B05"_s, AccessorySize::M}}, + {301, {"Rectangular Box 01"_s, Accessory::Size::M}}, + {302, {"Rectangular Box 02"_s, Accessory::Size::M}}, + {303, {"Rectangular Box 03"_s, Accessory::Size::M}}, + {304, {"Rectangular Box 04"_s, Accessory::Size::M}}, + {305, {"Rectangular Box 05"_s, Accessory::Size::M}}, + {306, {"CofBox 01"_s, Accessory::Size::M}}, + {307, {"CofBox 02"_s, Accessory::Size::M}}, + {308, {"CofBox 03"_s, Accessory::Size::M}}, + {309, {"CofBox 04"_s, Accessory::Size::M}}, + {310, {"CofBox 05"_s, Accessory::Size::M}}, + {311, {"Triangular Box 01"_s, Accessory::Size::M}}, + {312, {"Triangular Box 02"_s, Accessory::Size::M}}, + {313, {"Triangular Box 03"_s, Accessory::Size::M}}, + {314, {"Triangular Box 04"_s, Accessory::Size::M}}, + {315, {"Triangular Box 05"_s, Accessory::Size::M}}, + {316, {"Diagonal Box A01"_s, Accessory::Size::M}}, + {317, {"Diagonal Box A02"_s, Accessory::Size::M}}, + {318, {"Diagonal Box A03"_s, Accessory::Size::M}}, + {319, {"Diagonal Box A04"_s, Accessory::Size::M}}, + {320, {"Diagonal Box A05"_s, Accessory::Size::M}}, + {321, {"Diagonal Box B01"_s, Accessory::Size::M}}, + {322, {"Diagonal Box B02"_s, Accessory::Size::M}}, + {323, {"Diagonal Box B03"_s, Accessory::Size::M}}, + {324, {"Diagonal Box B04"_s, Accessory::Size::M}}, + {325, {"Diagonal Box B05"_s, Accessory::Size::M}}, // endregion // region Armours - {1001, {"Short Layer 01"_s, AccessorySize::M}}, - {1002, {"Short Layer 02"_s, AccessorySize::M}}, - {1003, {"Short Layer 03"_s, AccessorySize::M}}, - {1004, {"Short Layer 04"_s, AccessorySize::M}}, - {1005, {"Short Layer 05"_s, AccessorySize::M}}, - {1006, {"Long Layer 01"_s, AccessorySize::M}}, - {1007, {"Long Layer 02"_s, AccessorySize::M}}, - {1008, {"Long Layer 03"_s, AccessorySize::M}}, - {1009, {"Long Layer 04"_s, AccessorySize::M}}, - {1010, {"Long Layer 05"_s, AccessorySize::M}}, - {1011, {"Diagonal Long Layer 01"_s, AccessorySize::M}}, - {1012, {"Diagonal Long Layer 02"_s, AccessorySize::M}}, - {1013, {"Diagonal Long Layer 03"_s, AccessorySize::M}}, - {1014, {"Diagonal Long Layer 04"_s, AccessorySize::M}}, - {1015, {"Diagonal Long Layer 05"_s, AccessorySize::M}}, + {1001, {"Short Layer 01"_s, Accessory::Size::M}}, + {1002, {"Short Layer 02"_s, Accessory::Size::M}}, + {1003, {"Short Layer 03"_s, Accessory::Size::M}}, + {1004, {"Short Layer 04"_s, Accessory::Size::M}}, + {1005, {"Short Layer 05"_s, Accessory::Size::M}}, + {1006, {"Long Layer 01"_s, Accessory::Size::M}}, + {1007, {"Long Layer 02"_s, Accessory::Size::M}}, + {1008, {"Long Layer 03"_s, Accessory::Size::M}}, + {1009, {"Long Layer 04"_s, Accessory::Size::M}}, + {1010, {"Long Layer 05"_s, Accessory::Size::M}}, + {1011, {"Diagonal Long Layer 01"_s, Accessory::Size::M}}, + {1012, {"Diagonal Long Layer 02"_s, Accessory::Size::M}}, + {1013, {"Diagonal Long Layer 03"_s, Accessory::Size::M}}, + {1014, {"Diagonal Long Layer 04"_s, Accessory::Size::M}}, + {1015, {"Diagonal Long Layer 05"_s, Accessory::Size::M}}, - {1051, {"Sloped Layer 01"_s, AccessorySize::M}}, - {1052, {"Sloped Layer 02"_s, AccessorySize::M}}, - {1053, {"Sloped Layer 03"_s, AccessorySize::M}}, - {1054, {"Sloped Layer 04"_s, AccessorySize::M}}, - {1055, {"Sloped Layer 05"_s, AccessorySize::M}}, - {1056, {"Sloped Layer 06"_s, AccessorySize::M}}, - {1057, {"Sloped Layer 07"_s, AccessorySize::M}}, - {1058, {"Sloped Layer 08"_s, AccessorySize::M}}, - {1059, {"Sloped Layer 09"_s, AccessorySize::M}}, - {1060, {"Sloped Layer 10"_s, AccessorySize::M}}, - {1061, {"Sloped Layer 11"_s, AccessorySize::M}}, - {1062, {"Sloped Layer 12"_s, AccessorySize::M}}, - {1063, {"Sloped Layer 13"_s, AccessorySize::M}}, - {1064, {"Sloped Layer 14"_s, AccessorySize::M}}, - {1065, {"Sloped Layer 15"_s, AccessorySize::M}}, + {1051, {"Sloped Layer 01"_s, Accessory::Size::M}}, + {1052, {"Sloped Layer 02"_s, Accessory::Size::M}}, + {1053, {"Sloped Layer 03"_s, Accessory::Size::M}}, + {1054, {"Sloped Layer 04"_s, Accessory::Size::M}}, + {1055, {"Sloped Layer 05"_s, Accessory::Size::M}}, + {1056, {"Sloped Layer 06"_s, Accessory::Size::M}}, + {1057, {"Sloped Layer 07"_s, Accessory::Size::M}}, + {1058, {"Sloped Layer 08"_s, Accessory::Size::M}}, + {1059, {"Sloped Layer 09"_s, Accessory::Size::M}}, + {1060, {"Sloped Layer 10"_s, Accessory::Size::M}}, + {1061, {"Sloped Layer 11"_s, Accessory::Size::M}}, + {1062, {"Sloped Layer 12"_s, Accessory::Size::M}}, + {1063, {"Sloped Layer 13"_s, Accessory::Size::M}}, + {1064, {"Sloped Layer 14"_s, Accessory::Size::M}}, + {1065, {"Sloped Layer 15"_s, Accessory::Size::M}}, - {1101, {"Raised Center 01"_s, AccessorySize::M}}, - {1102, {"Raised Center 02"_s, AccessorySize::M}}, - {1103, {"Raised Center 03"_s, AccessorySize::M}}, - {1104, {"Raised Center 04"_s, AccessorySize::M}}, - {1105, {"Raised Center 05"_s, AccessorySize::M}}, - {1106, {"Raised Block 01"_s, AccessorySize::M}}, - {1107, {"Raised Block 02"_s, AccessorySize::M}}, - {1108, {"Raised Block 03"_s, AccessorySize::M}}, - {1109, {"Raised Pointed"_s, AccessorySize::M}}, - {1110, {"Raised Cover"_s, AccessorySize::M}}, - {1111, {"Raised Slant 01"_s, AccessorySize::M}}, - {1112, {"Raised Slant 02"_s, AccessorySize::M}}, - {1113, {"Raised Slant 03"_s, AccessorySize::M}}, - {1114, {"Raised Slant 04"_s, AccessorySize::M}}, - {1115, {"Raised Slant 05"_s, AccessorySize::M}}, + {1101, {"Raised Center 01"_s, Accessory::Size::M}}, + {1102, {"Raised Center 02"_s, Accessory::Size::M}}, + {1103, {"Raised Center 03"_s, Accessory::Size::M}}, + {1104, {"Raised Center 04"_s, Accessory::Size::M}}, + {1105, {"Raised Center 05"_s, Accessory::Size::M}}, + {1106, {"Raised Block 01"_s, Accessory::Size::M}}, + {1107, {"Raised Block 02"_s, Accessory::Size::M}}, + {1108, {"Raised Block 03"_s, Accessory::Size::M}}, + {1109, {"Raised Pointed"_s, Accessory::Size::M}}, + {1110, {"Raised Cover"_s, Accessory::Size::M}}, + {1111, {"Raised Slant 01"_s, Accessory::Size::M}}, + {1112, {"Raised Slant 02"_s, Accessory::Size::M}}, + {1113, {"Raised Slant 03"_s, Accessory::Size::M}}, + {1114, {"Raised Slant 04"_s, Accessory::Size::M}}, + {1115, {"Raised Slant 05"_s, Accessory::Size::M}}, - {1151, {"Wide Patch 01"_s, AccessorySize::L}}, - {1152, {"Wide Patch 02"_s, AccessorySize::L}}, - {1153, {"Wide Patch 03"_s, AccessorySize::L}}, - {1154, {"Wide Patch 04"_s, AccessorySize::L}}, - {1155, {"Wide Patch 05"_s, AccessorySize::L}}, + {1151, {"Wide Patch 01"_s, Accessory::Size::L}}, + {1152, {"Wide Patch 02"_s, Accessory::Size::L}}, + {1153, {"Wide Patch 03"_s, Accessory::Size::L}}, + {1154, {"Wide Patch 04"_s, Accessory::Size::L}}, + {1155, {"Wide Patch 05"_s, Accessory::Size::L}}, - {1201, {"Pointed Armour 01"_s, AccessorySize::L}}, - {1202, {"Pointed Armour 02"_s, AccessorySize::L}}, - {1203, {"Pointed Armour 03"_s, AccessorySize::L}}, - {1204, {"Pointed Armour 04"_s, AccessorySize::L}}, - {1205, {"Pointed Armour 05"_s, AccessorySize::L}}, - {1206, {"Pointed Armour 06"_s, AccessorySize::L}}, - {1207, {"Pointed Armour 07"_s, AccessorySize::L}}, - {1208, {"Pointed Armour 08"_s, AccessorySize::L}}, - {1209, {"Pointed Armour 09"_s, AccessorySize::L}}, - {1210, {"Pointed Armour 10"_s, AccessorySize::L}}, - {1211, {"Pointed Armour 11"_s, AccessorySize::L}}, - {1212, {"Pointed Armour 12"_s, AccessorySize::L}}, - {1213, {"Pointed Armour 13"_s, AccessorySize::L}}, - {1214, {"Pointed Armour 14"_s, AccessorySize::L}}, - {1215, {"Pointed Armour 15"_s, AccessorySize::L}}, + {1201, {"Pointed Armour 01"_s, Accessory::Size::L}}, + {1202, {"Pointed Armour 02"_s, Accessory::Size::L}}, + {1203, {"Pointed Armour 03"_s, Accessory::Size::L}}, + {1204, {"Pointed Armour 04"_s, Accessory::Size::L}}, + {1205, {"Pointed Armour 05"_s, Accessory::Size::L}}, + {1206, {"Pointed Armour 06"_s, Accessory::Size::L}}, + {1207, {"Pointed Armour 07"_s, Accessory::Size::L}}, + {1208, {"Pointed Armour 08"_s, Accessory::Size::L}}, + {1209, {"Pointed Armour 09"_s, Accessory::Size::L}}, + {1210, {"Pointed Armour 10"_s, Accessory::Size::L}}, + {1211, {"Pointed Armour 11"_s, Accessory::Size::L}}, + {1212, {"Pointed Armour 12"_s, Accessory::Size::L}}, + {1213, {"Pointed Armour 13"_s, Accessory::Size::L}}, + {1214, {"Pointed Armour 14"_s, Accessory::Size::L}}, + {1215, {"Pointed Armour 15"_s, Accessory::Size::L}}, - {1251, {"E Limb Cover 01"_s, AccessorySize::L}}, - {1252, {"E Limb Cover 02"_s, AccessorySize::L}}, - {1253, {"E Limb Cover 03"_s, AccessorySize::L}}, - {1254, {"E Limb Cover 04"_s, AccessorySize::L}}, - {1255, {"E Limb Cover 05"_s, AccessorySize::L}}, - {1256, {"E Limb Cover 06"_s, AccessorySize::L}}, - {1257, {"E Limb Cover 07"_s, AccessorySize::L}}, - {1258, {"E Limb Cover 08"_s, AccessorySize::L}}, - {1259, {"E Limb Cover 09"_s, AccessorySize::L}}, - {1260, {"E Limb Cover 10"_s, AccessorySize::L}}, + {1251, {"E Limb Cover 01"_s, Accessory::Size::L}}, + {1252, {"E Limb Cover 02"_s, Accessory::Size::L}}, + {1253, {"E Limb Cover 03"_s, Accessory::Size::L}}, + {1254, {"E Limb Cover 04"_s, Accessory::Size::L}}, + {1255, {"E Limb Cover 05"_s, Accessory::Size::L}}, + {1256, {"E Limb Cover 06"_s, Accessory::Size::L}}, + {1257, {"E Limb Cover 07"_s, Accessory::Size::L}}, + {1258, {"E Limb Cover 08"_s, Accessory::Size::L}}, + {1259, {"E Limb Cover 09"_s, Accessory::Size::L}}, + {1260, {"E Limb Cover 10"_s, Accessory::Size::L}}, - {1301, {"C Limb Cover 01"_s, AccessorySize::L}}, - {1302, {"C Limb Cover 02"_s, AccessorySize::L}}, - {1303, {"C Limb Cover 03"_s, AccessorySize::L}}, - {1304, {"C Limb Cover 04"_s, AccessorySize::L}}, - {1305, {"C Limb Cover 05"_s, AccessorySize::L}}, - {1306, {"C Limb Cover 06"_s, AccessorySize::L}}, - {1307, {"C Limb Cover 07"_s, AccessorySize::L}}, - {1308, {"C Limb Cover 08"_s, AccessorySize::L}}, - {1309, {"C Limb Cover 09"_s, AccessorySize::L}}, - {1310, {"C Limb Cover 10"_s, AccessorySize::L}}, - {1311, {"C Limb Cover 11"_s, AccessorySize::L}}, - {1312, {"C Limb Cover 12"_s, AccessorySize::L}}, - {1313, {"C Limb Cover 13"_s, AccessorySize::L}}, - {1314, {"C Limb Cover 14"_s, AccessorySize::L}}, - {1315, {"C Limb Cover 15"_s, AccessorySize::L}}, - {1316, {"C Limb Cover 16"_s, AccessorySize::L}}, - {1317, {"C Limb Cover 17"_s, AccessorySize::L}}, - {1318, {"C Limb Cover 18"_s, AccessorySize::L}}, - {1319, {"C Limb Cover 19"_s, AccessorySize::L}}, - {1320, {"C Limb Cover 20"_s, AccessorySize::L}}, + {1301, {"C Limb Cover 01"_s, Accessory::Size::L}}, + {1302, {"C Limb Cover 02"_s, Accessory::Size::L}}, + {1303, {"C Limb Cover 03"_s, Accessory::Size::L}}, + {1304, {"C Limb Cover 04"_s, Accessory::Size::L}}, + {1305, {"C Limb Cover 05"_s, Accessory::Size::L}}, + {1306, {"C Limb Cover 06"_s, Accessory::Size::L}}, + {1307, {"C Limb Cover 07"_s, Accessory::Size::L}}, + {1308, {"C Limb Cover 08"_s, Accessory::Size::L}}, + {1309, {"C Limb Cover 09"_s, Accessory::Size::L}}, + {1310, {"C Limb Cover 10"_s, Accessory::Size::L}}, + {1311, {"C Limb Cover 11"_s, Accessory::Size::L}}, + {1312, {"C Limb Cover 12"_s, Accessory::Size::L}}, + {1313, {"C Limb Cover 13"_s, Accessory::Size::L}}, + {1314, {"C Limb Cover 14"_s, Accessory::Size::L}}, + {1315, {"C Limb Cover 15"_s, Accessory::Size::L}}, + {1316, {"C Limb Cover 16"_s, Accessory::Size::L}}, + {1317, {"C Limb Cover 17"_s, Accessory::Size::L}}, + {1318, {"C Limb Cover 18"_s, Accessory::Size::L}}, + {1319, {"C Limb Cover 19"_s, Accessory::Size::L}}, + {1320, {"C Limb Cover 20"_s, Accessory::Size::L}}, - {1351, {"P Limb Cover 01"_s, AccessorySize::XL}}, - {1352, {"P Limb Cover 02"_s, AccessorySize::XL}}, - {1353, {"P Limb Cover 03"_s, AccessorySize::XL}}, - {1354, {"P Limb Cover 04"_s, AccessorySize::XL}}, - {1355, {"P Limb Cover 05"_s, AccessorySize::XL}}, + {1351, {"P Limb Cover 01"_s, Accessory::Size::XL}}, + {1352, {"P Limb Cover 02"_s, Accessory::Size::XL}}, + {1353, {"P Limb Cover 03"_s, Accessory::Size::XL}}, + {1354, {"P Limb Cover 04"_s, Accessory::Size::XL}}, + {1355, {"P Limb Cover 05"_s, Accessory::Size::XL}}, - {1401, {"Flat Cover 01"_s, AccessorySize::XL}}, - {1402, {"Flat Cover 02"_s, AccessorySize::XL}}, - {1403, {"Flat Cover 03"_s, AccessorySize::XL}}, - {1404, {"Flat Cover 04"_s, AccessorySize::XL}}, - {1405, {"Flat Cover 05"_s, AccessorySize::XL}}, - {1406, {"Flat Cover 06"_s, AccessorySize::XL}}, - {1407, {"Flat Cover 07"_s, AccessorySize::XL}}, - {1408, {"Flat Cover 08"_s, AccessorySize::XL}}, - {1409, {"Flat Cover 09"_s, AccessorySize::XL}}, - {1410, {"Flat Cover 10"_s, AccessorySize::XL}}, + {1401, {"Flat Cover 01"_s, Accessory::Size::XL}}, + {1402, {"Flat Cover 02"_s, Accessory::Size::XL}}, + {1403, {"Flat Cover 03"_s, Accessory::Size::XL}}, + {1404, {"Flat Cover 04"_s, Accessory::Size::XL}}, + {1405, {"Flat Cover 05"_s, Accessory::Size::XL}}, + {1406, {"Flat Cover 06"_s, Accessory::Size::XL}}, + {1407, {"Flat Cover 07"_s, Accessory::Size::XL}}, + {1408, {"Flat Cover 08"_s, Accessory::Size::XL}}, + {1409, {"Flat Cover 09"_s, Accessory::Size::XL}}, + {1410, {"Flat Cover 10"_s, Accessory::Size::XL}}, - {1451, {"L Side Opening 01"_s, AccessorySize::XL}}, - {1452, {"L Side Opening 02"_s, AccessorySize::XL}}, - {1453, {"L Side Opening 03"_s, AccessorySize::XL}}, - {1454, {"L Side Opening 04"_s, AccessorySize::XL}}, - {1455, {"L Side Opening 05"_s, AccessorySize::XL}}, - {1456, {"L Side Opening 06"_s, AccessorySize::XL}}, - {1457, {"L Side Opening 07"_s, AccessorySize::XL}}, - {1458, {"L Side Opening 08"_s, AccessorySize::XL}}, - {1459, {"L Side Opening 09"_s, AccessorySize::XL}}, - {1460, {"L Side Opening 10"_s, AccessorySize::XL}}, + {1451, {"L Side Opening 01"_s, Accessory::Size::XL}}, + {1452, {"L Side Opening 02"_s, Accessory::Size::XL}}, + {1453, {"L Side Opening 03"_s, Accessory::Size::XL}}, + {1454, {"L Side Opening 04"_s, Accessory::Size::XL}}, + {1455, {"L Side Opening 05"_s, Accessory::Size::XL}}, + {1456, {"L Side Opening 06"_s, Accessory::Size::XL}}, + {1457, {"L Side Opening 07"_s, Accessory::Size::XL}}, + {1458, {"L Side Opening 08"_s, Accessory::Size::XL}}, + {1459, {"L Side Opening 09"_s, Accessory::Size::XL}}, + {1460, {"L Side Opening 10"_s, Accessory::Size::XL}}, // endregion // region Components - {2001, {"Disc Padding 01"_s, AccessorySize::M}}, - {2002, {"Disc Padding 02"_s, AccessorySize::M}}, - {2003, {"Disc Padding 03"_s, AccessorySize::M}}, - {2004, {"Disc Padding 04"_s, AccessorySize::M}}, - {2005, {"Disc Padding 05"_s, AccessorySize::M}}, - {2006, {"Thin Padding 01"_s, AccessorySize::M}}, - {2007, {"Thin Padding 02"_s, AccessorySize::M}}, - {2008, {"Thin Padding 03"_s, AccessorySize::M}}, - {2009, {"Thin Padding 04"_s, AccessorySize::M}}, - {2010, {"Thin Padding 05"_s, AccessorySize::M}}, - {2011, {"Thick Padding 01"_s, AccessorySize::M}}, - {2012, {"Thick Padding 02"_s, AccessorySize::M}}, - {2013, {"Thick Padding 03"_s, AccessorySize::M}}, - {2014, {"Thick Padding 04"_s, AccessorySize::M}}, - {2015, {"Thick Padding 05"_s, AccessorySize::M}}, - {2016, {"Thick Padding 06"_s, AccessorySize::M}}, - {2017, {"Thick Padding 07"_s, AccessorySize::M}}, - {2018, {"Thick Padding 08"_s, AccessorySize::M}}, - {2019, {"Thick Padding 09"_s, AccessorySize::M}}, - {2020, {"Thick Padding 10"_s, AccessorySize::M}}, - {2021, {"CSide Padding 01"_s, AccessorySize::M}}, - {2022, {"CSide Padding 02"_s, AccessorySize::M}}, - {2023, {"CSide Padding 03"_s, AccessorySize::M}}, - {2024, {"CSide Padding 04"_s, AccessorySize::M}}, - {2025, {"CSide Padding 05"_s, AccessorySize::M}}, + {2001, {"Disc Padding 01"_s, Accessory::Size::M}}, + {2002, {"Disc Padding 02"_s, Accessory::Size::M}}, + {2003, {"Disc Padding 03"_s, Accessory::Size::M}}, + {2004, {"Disc Padding 04"_s, Accessory::Size::M}}, + {2005, {"Disc Padding 05"_s, Accessory::Size::M}}, + {2006, {"Thin Padding 01"_s, Accessory::Size::M}}, + {2007, {"Thin Padding 02"_s, Accessory::Size::M}}, + {2008, {"Thin Padding 03"_s, Accessory::Size::M}}, + {2009, {"Thin Padding 04"_s, Accessory::Size::M}}, + {2010, {"Thin Padding 05"_s, Accessory::Size::M}}, + {2011, {"Thick Padding 01"_s, Accessory::Size::M}}, + {2012, {"Thick Padding 02"_s, Accessory::Size::M}}, + {2013, {"Thick Padding 03"_s, Accessory::Size::M}}, + {2014, {"Thick Padding 04"_s, Accessory::Size::M}}, + {2015, {"Thick Padding 05"_s, Accessory::Size::M}}, + {2016, {"Thick Padding 06"_s, Accessory::Size::M}}, + {2017, {"Thick Padding 07"_s, Accessory::Size::M}}, + {2018, {"Thick Padding 08"_s, Accessory::Size::M}}, + {2019, {"Thick Padding 09"_s, Accessory::Size::M}}, + {2020, {"Thick Padding 10"_s, Accessory::Size::M}}, + {2021, {"CSide Padding 01"_s, Accessory::Size::M}}, + {2022, {"CSide Padding 02"_s, Accessory::Size::M}}, + {2023, {"CSide Padding 03"_s, Accessory::Size::M}}, + {2024, {"CSide Padding 04"_s, Accessory::Size::M}}, + {2025, {"CSide Padding 05"_s, Accessory::Size::M}}, - {2051, {"Container 01"_s, AccessorySize::L}}, - {2052, {"Container 02"_s, AccessorySize::L}}, - {2053, {"Container 03"_s, AccessorySize::L}}, - {2054, {"Container 04"_s, AccessorySize::L}}, - {2055, {"Container 05"_s, AccessorySize::L}}, + {2051, {"Container 01"_s, Accessory::Size::L}}, + {2052, {"Container 02"_s, Accessory::Size::L}}, + {2053, {"Container 03"_s, Accessory::Size::L}}, + {2054, {"Container 04"_s, Accessory::Size::L}}, + {2055, {"Container 05"_s, Accessory::Size::L}}, - {2101, {"Plating 01"_s, AccessorySize::L}}, - {2102, {"Plating 02"_s, AccessorySize::L}}, - {2103, {"Plating 03"_s, AccessorySize::L}}, - {2104, {"Plating 04"_s, AccessorySize::L}}, - {2105, {"Plating 05"_s, AccessorySize::L}}, + {2101, {"Plating 01"_s, Accessory::Size::L}}, + {2102, {"Plating 02"_s, Accessory::Size::L}}, + {2103, {"Plating 03"_s, Accessory::Size::L}}, + {2104, {"Plating 04"_s, Accessory::Size::L}}, + {2105, {"Plating 05"_s, Accessory::Size::L}}, - {2151, {"Complex Base 01"_s, AccessorySize::L}}, - {2152, {"Complex Base 02"_s, AccessorySize::L}}, - {2153, {"Complex Base 03"_s, AccessorySize::L}}, - {2154, {"Complex Base 04"_s, AccessorySize::L}}, - {2155, {"Complex Base 05"_s, AccessorySize::L}}, - {2156, {"Complex Base 06"_s, AccessorySize::L}}, - {2157, {"Complex Base 07"_s, AccessorySize::L}}, - {2158, {"Complex Base 08"_s, AccessorySize::L}}, - {2159, {"Complex Base 09"_s, AccessorySize::L}}, - {2160, {"Complex Base 10"_s, AccessorySize::L}}, + {2151, {"Complex Base 01"_s, Accessory::Size::L}}, + {2152, {"Complex Base 02"_s, Accessory::Size::L}}, + {2153, {"Complex Base 03"_s, Accessory::Size::L}}, + {2154, {"Complex Base 04"_s, Accessory::Size::L}}, + {2155, {"Complex Base 05"_s, Accessory::Size::L}}, + {2156, {"Complex Base 06"_s, Accessory::Size::L}}, + {2157, {"Complex Base 07"_s, Accessory::Size::L}}, + {2158, {"Complex Base 08"_s, Accessory::Size::L}}, + {2159, {"Complex Base 09"_s, Accessory::Size::L}}, + {2160, {"Complex Base 10"_s, Accessory::Size::L}}, - {2201, {"Long Base 01"_s, AccessorySize::XL}}, - {2202, {"Long Base 02"_s, AccessorySize::XL}}, - {2203, {"Long Base 03"_s, AccessorySize::XL}}, - {2204, {"Long Base 04"_s, AccessorySize::XL}}, - {2205, {"Long Base 05"_s, AccessorySize::XL}}, + {2201, {"Long Base 01"_s, Accessory::Size::XL}}, + {2202, {"Long Base 02"_s, Accessory::Size::XL}}, + {2203, {"Long Base 03"_s, Accessory::Size::XL}}, + {2204, {"Long Base 04"_s, Accessory::Size::XL}}, + {2205, {"Long Base 05"_s, Accessory::Size::XL}}, - {2251, {"Straight Wing 01"_s, AccessorySize::XL}}, - {2252, {"Straight Wing 02"_s, AccessorySize::XL}}, - {2253, {"Straight Wing 03"_s, AccessorySize::XL}}, - {2254, {"Straight Wing 04"_s, AccessorySize::XL}}, - {2255, {"Straight Wing 05"_s, AccessorySize::XL}}, - {2256, {"Straight Wing 06"_s, AccessorySize::XL}}, - {2257, {"Straight Wing 07"_s, AccessorySize::XL}}, - {2258, {"Straight Wing 08"_s, AccessorySize::XL}}, - {2259, {"Straight Wing 09"_s, AccessorySize::XL}}, - {2260, {"Straight Wing 10"_s, AccessorySize::XL}}, + {2251, {"Straight Wing 01"_s, Accessory::Size::XL}}, + {2252, {"Straight Wing 02"_s, Accessory::Size::XL}}, + {2253, {"Straight Wing 03"_s, Accessory::Size::XL}}, + {2254, {"Straight Wing 04"_s, Accessory::Size::XL}}, + {2255, {"Straight Wing 05"_s, Accessory::Size::XL}}, + {2256, {"Straight Wing 06"_s, Accessory::Size::XL}}, + {2257, {"Straight Wing 07"_s, Accessory::Size::XL}}, + {2258, {"Straight Wing 08"_s, Accessory::Size::XL}}, + {2259, {"Straight Wing 09"_s, Accessory::Size::XL}}, + {2260, {"Straight Wing 10"_s, Accessory::Size::XL}}, - {2301, {"Triangular Wing 01"_s, AccessorySize::XL}}, - {2302, {"Triangular Wing 02"_s, AccessorySize::XL}}, - {2303, {"Triangular Wing 03"_s, AccessorySize::XL}}, - {2304, {"Triangular Wing 04"_s, AccessorySize::XL}}, - {2305, {"Triangular Wing 05"_s, AccessorySize::XL}}, - {2306, {"Triangular Wing 06"_s, AccessorySize::XL}}, - {2307, {"Triangular Wing 07"_s, AccessorySize::XL}}, - {2308, {"Triangular Wing 08"_s, AccessorySize::XL}}, - {2309, {"Triangular Wing 09"_s, AccessorySize::XL}}, - {2310, {"Triangular Wing 10"_s, AccessorySize::XL}}, - {2311, {"Triangular Wing 11"_s, AccessorySize::L}}, - {2312, {"Triangular Wing 12"_s, AccessorySize::L}}, - {2313, {"Triangular Wing 13"_s, AccessorySize::L}}, - {2314, {"Triangular Wing 14"_s, AccessorySize::L}}, - {2315, {"Triangular Wing 15"_s, AccessorySize::L}}, + {2301, {"Triangular Wing 01"_s, Accessory::Size::XL}}, + {2302, {"Triangular Wing 02"_s, Accessory::Size::XL}}, + {2303, {"Triangular Wing 03"_s, Accessory::Size::XL}}, + {2304, {"Triangular Wing 04"_s, Accessory::Size::XL}}, + {2305, {"Triangular Wing 05"_s, Accessory::Size::XL}}, + {2306, {"Triangular Wing 06"_s, Accessory::Size::XL}}, + {2307, {"Triangular Wing 07"_s, Accessory::Size::XL}}, + {2308, {"Triangular Wing 08"_s, Accessory::Size::XL}}, + {2309, {"Triangular Wing 09"_s, Accessory::Size::XL}}, + {2310, {"Triangular Wing 10"_s, Accessory::Size::XL}}, + {2311, {"Triangular Wing 11"_s, Accessory::Size::L}}, + {2312, {"Triangular Wing 12"_s, Accessory::Size::L}}, + {2313, {"Triangular Wing 13"_s, Accessory::Size::L}}, + {2314, {"Triangular Wing 14"_s, Accessory::Size::L}}, + {2315, {"Triangular Wing 15"_s, Accessory::Size::L}}, - {2351, {"Complex Wing 01"_s, AccessorySize::XL}}, - {2352, {"Complex Wing 02"_s, AccessorySize::XL}}, - {2353, {"Complex Wing 03"_s, AccessorySize::XL}}, - {2354, {"Complex Wing 04"_s, AccessorySize::XL}}, - {2355, {"Complex Wing 05"_s, AccessorySize::XL}}, - {2356, {"Complex Wing 06"_s, AccessorySize::L}}, - {2357, {"Complex Wing 07"_s, AccessorySize::L}}, - {2358, {"Complex Wing 08"_s, AccessorySize::L}}, - {2359, {"Complex Wing 09"_s, AccessorySize::L}}, - {2360, {"Complex Wing 10"_s, AccessorySize::L}}, + {2351, {"Complex Wing 01"_s, Accessory::Size::XL}}, + {2352, {"Complex Wing 02"_s, Accessory::Size::XL}}, + {2353, {"Complex Wing 03"_s, Accessory::Size::XL}}, + {2354, {"Complex Wing 04"_s, Accessory::Size::XL}}, + {2355, {"Complex Wing 05"_s, Accessory::Size::XL}}, + {2356, {"Complex Wing 06"_s, Accessory::Size::L}}, + {2357, {"Complex Wing 07"_s, Accessory::Size::L}}, + {2358, {"Complex Wing 08"_s, Accessory::Size::L}}, + {2359, {"Complex Wing 09"_s, Accessory::Size::L}}, + {2360, {"Complex Wing 10"_s, Accessory::Size::L}}, - {2401, {"Blade 01"_s, AccessorySize::XL}}, - {2402, {"Blade 02"_s, AccessorySize::XL}}, - {2403, {"Blade 03"_s, AccessorySize::XL}}, - {2404, {"Blade 04"_s, AccessorySize::XL}}, - {2405, {"Blade 05"_s, AccessorySize::XL}}, - {2406, {"Blade 06"_s, AccessorySize::XL}}, - {2407, {"Blade 07"_s, AccessorySize::XL}}, - {2408, {"Blade 08"_s, AccessorySize::XL}}, - {2409, {"Blade 09"_s, AccessorySize::XL}}, - {2410, {"Blade 10"_s, AccessorySize::XL}}, - {2411, {"Blade 11"_s, AccessorySize::XL}}, - {2412, {"Blade 12"_s, AccessorySize::XL}}, - {2413, {"Blade 13"_s, AccessorySize::XL}}, - {2414, {"Blade 14"_s, AccessorySize::XL}}, - {2415, {"Blade 15"_s, AccessorySize::XL}}, + {2401, {"Blade 01"_s, Accessory::Size::XL}}, + {2402, {"Blade 02"_s, Accessory::Size::XL}}, + {2403, {"Blade 03"_s, Accessory::Size::XL}}, + {2404, {"Blade 04"_s, Accessory::Size::XL}}, + {2405, {"Blade 05"_s, Accessory::Size::XL}}, + {2406, {"Blade 06"_s, Accessory::Size::XL}}, + {2407, {"Blade 07"_s, Accessory::Size::XL}}, + {2408, {"Blade 08"_s, Accessory::Size::XL}}, + {2409, {"Blade 09"_s, Accessory::Size::XL}}, + {2410, {"Blade 10"_s, Accessory::Size::XL}}, + {2411, {"Blade 11"_s, Accessory::Size::XL}}, + {2412, {"Blade 12"_s, Accessory::Size::XL}}, + {2413, {"Blade 13"_s, Accessory::Size::XL}}, + {2414, {"Blade 14"_s, Accessory::Size::XL}}, + {2415, {"Blade 15"_s, Accessory::Size::XL}}, - {2426, {"Curved Blade 01"_s, AccessorySize::XL}}, - {2427, {"Curved Blade 02"_s, AccessorySize::XL}}, - {2428, {"Curved Blade 03"_s, AccessorySize::XL}}, - {2429, {"Curved Blade 04"_s, AccessorySize::XL}}, - {2430, {"Curved Blade 05"_s, AccessorySize::XL}}, - {2431, {"Axe Head 01"_s, AccessorySize::XL}}, - {2432, {"Axe Head 02"_s, AccessorySize::XL}}, - {2433, {"Axe Head 03"_s, AccessorySize::XL}}, - {2434, {"Axe Head 04"_s, AccessorySize::XL}}, - {2435, {"Axe Head 05"_s, AccessorySize::XL}}, + {2426, {"Curved Blade 01"_s, Accessory::Size::XL}}, + {2427, {"Curved Blade 02"_s, Accessory::Size::XL}}, + {2428, {"Curved Blade 03"_s, Accessory::Size::XL}}, + {2429, {"Curved Blade 04"_s, Accessory::Size::XL}}, + {2430, {"Curved Blade 05"_s, Accessory::Size::XL}}, + {2431, {"Axe Head 01"_s, Accessory::Size::XL}}, + {2432, {"Axe Head 02"_s, Accessory::Size::XL}}, + {2433, {"Axe Head 03"_s, Accessory::Size::XL}}, + {2434, {"Axe Head 04"_s, Accessory::Size::XL}}, + {2435, {"Axe Head 05"_s, Accessory::Size::XL}}, - {2451, {"Horn 01"_s, AccessorySize::M}}, - {2452, {"Horn 02"_s, AccessorySize::M}}, - {2453, {"Horn 03"_s, AccessorySize::M}}, - {2454, {"Horn 04"_s, AccessorySize::M}}, - {2455, {"Horn 05"_s, AccessorySize::M}}, - {2456, {"Horn 06"_s, AccessorySize::M}}, - {2457, {"Horn 07"_s, AccessorySize::M}}, - {2458, {"Horn 08"_s, AccessorySize::M}}, - {2459, {"Horn 09"_s, AccessorySize::M}}, - {2460, {"Horn 10"_s, AccessorySize::M}}, - {2461, {"Horn 11"_s, AccessorySize::M}}, - {2462, {"Horn 12"_s, AccessorySize::M}}, - {2463, {"Horn 13"_s, AccessorySize::M}}, - {2464, {"Horn 14"_s, AccessorySize::M}}, - {2465, {"Horn 15"_s, AccessorySize::M}}, + {2451, {"Horn 01"_s, Accessory::Size::M}}, + {2452, {"Horn 02"_s, Accessory::Size::M}}, + {2453, {"Horn 03"_s, Accessory::Size::M}}, + {2454, {"Horn 04"_s, Accessory::Size::M}}, + {2455, {"Horn 05"_s, Accessory::Size::M}}, + {2456, {"Horn 06"_s, Accessory::Size::M}}, + {2457, {"Horn 07"_s, Accessory::Size::M}}, + {2458, {"Horn 08"_s, Accessory::Size::M}}, + {2459, {"Horn 09"_s, Accessory::Size::M}}, + {2460, {"Horn 10"_s, Accessory::Size::M}}, + {2461, {"Horn 11"_s, Accessory::Size::M}}, + {2462, {"Horn 12"_s, Accessory::Size::M}}, + {2463, {"Horn 13"_s, Accessory::Size::M}}, + {2464, {"Horn 14"_s, Accessory::Size::M}}, + {2465, {"Horn 15"_s, Accessory::Size::M}}, - {2471, {"Mask"_s, AccessorySize::M}}, - {2472, {"Droplet"_s, AccessorySize::M}}, - {2473, {"Thigh"_s, AccessorySize::M}}, - {2474, {"LegS"_s, AccessorySize::M}}, - {2475, {"LegTH"_s, AccessorySize::M}}, - {2476, {"Plume 01"_s, AccessorySize::M}}, - {2477, {"Plume 02"_s, AccessorySize::M}}, - {2478, {"Plume 03"_s, AccessorySize::M}}, - {2479, {"Plume 04"_s, AccessorySize::M}}, - {2480, {"Plume 05"_s, AccessorySize::M}}, + {2471, {"Mask"_s, Accessory::Size::M}}, + {2472, {"Droplet"_s, Accessory::Size::M}}, + {2473, {"Thigh"_s, Accessory::Size::M}}, + {2474, {"LegS"_s, Accessory::Size::M}}, + {2475, {"LegTH"_s, Accessory::Size::M}}, + {2476, {"Plume 01"_s, Accessory::Size::M}}, + {2477, {"Plume 02"_s, Accessory::Size::M}}, + {2478, {"Plume 03"_s, Accessory::Size::M}}, + {2479, {"Plume 04"_s, Accessory::Size::M}}, + {2480, {"Plume 05"_s, Accessory::Size::M}}, - {2491, {"Tail 01"_s, AccessorySize::XL}}, - {2492, {"Tail 02"_s, AccessorySize::XL}}, - {2493, {"Tail 03"_s, AccessorySize::XL}}, - {2494, {"Tail 04"_s, AccessorySize::XL}}, - {2495, {"Tail 05"_s, AccessorySize::XL}}, + {2491, {"Tail 01"_s, Accessory::Size::XL}}, + {2492, {"Tail 02"_s, Accessory::Size::XL}}, + {2493, {"Tail 03"_s, Accessory::Size::XL}}, + {2494, {"Tail 04"_s, Accessory::Size::XL}}, + {2495, {"Tail 05"_s, Accessory::Size::XL}}, - {2501, {"Finger 01"_s, AccessorySize::M}}, - {2502, {"Finger 02"_s, AccessorySize::M}}, - {2503, {"Finger 03"_s, AccessorySize::M}}, - {2504, {"Finger 04"_s, AccessorySize::M}}, - {2505, {"Finger 05"_s, AccessorySize::M}}, + {2501, {"Finger 01"_s, Accessory::Size::M}}, + {2502, {"Finger 02"_s, Accessory::Size::M}}, + {2503, {"Finger 03"_s, Accessory::Size::M}}, + {2504, {"Finger 04"_s, Accessory::Size::M}}, + {2505, {"Finger 05"_s, Accessory::Size::M}}, - {2510, {"Clamp 01"_s, AccessorySize::M}}, - {2511, {"Clamp 02"_s, AccessorySize::M}}, - {2512, {"Clamp 03"_s, AccessorySize::M}}, - {2513, {"Clamp 04"_s, AccessorySize::M}}, - {2514, {"Clamp 05"_s, AccessorySize::M}}, + {2510, {"Clamp 01"_s, Accessory::Size::M}}, + {2511, {"Clamp 02"_s, Accessory::Size::M}}, + {2512, {"Clamp 03"_s, Accessory::Size::M}}, + {2513, {"Clamp 04"_s, Accessory::Size::M}}, + {2514, {"Clamp 05"_s, Accessory::Size::M}}, - {2521, {"Fabric 01"_s, AccessorySize::XL}}, - {2522, {"Fabric 02"_s, AccessorySize::XL}}, - {2523, {"Fabric 03"_s, AccessorySize::XL}}, - {2524, {"Fabric 04"_s, AccessorySize::XL}}, - {2525, {"Fabric 05"_s, AccessorySize::XL}}, + {2521, {"Fabric 01"_s, Accessory::Size::XL}}, + {2522, {"Fabric 02"_s, Accessory::Size::XL}}, + {2523, {"Fabric 03"_s, Accessory::Size::XL}}, + {2524, {"Fabric 04"_s, Accessory::Size::XL}}, + {2525, {"Fabric 05"_s, Accessory::Size::XL}}, - {2551, {"Energy Barrel 01"_s, AccessorySize::XL}}, - {2552, {"Energy Barrel 02"_s, AccessorySize::XL}}, - {2553, {"Energy Barrel 03"_s, AccessorySize::XL}}, - {2554, {"Energy Barrel 04"_s, AccessorySize::XL}}, - {2555, {"Energy Barrel 05"_s, AccessorySize::XL}}, + {2551, {"Energy Barrel 01"_s, Accessory::Size::XL}}, + {2552, {"Energy Barrel 02"_s, Accessory::Size::XL}}, + {2553, {"Energy Barrel 03"_s, Accessory::Size::XL}}, + {2554, {"Energy Barrel 04"_s, Accessory::Size::XL}}, + {2555, {"Energy Barrel 05"_s, Accessory::Size::XL}}, - {2601, {"L Bullet Barrel 01"_s, AccessorySize::XL}}, - {2602, {"L Bullet Barrel 02"_s, AccessorySize::XL}}, - {2603, {"L Bullet Barrel 03"_s, AccessorySize::XL}}, - {2604, {"L Bullet Barrel 04"_s, AccessorySize::XL}}, - {2605, {"L Bullet Barrel 05"_s, AccessorySize::XL}}, - {2606, {"S Bullet Barrel 01"_s, AccessorySize::XL}}, - {2607, {"S Bullet Barrel 02"_s, AccessorySize::XL}}, - {2608, {"S Bullet Barrel 03"_s, AccessorySize::XL}}, - {2609, {"S Bullet Barrel 04"_s, AccessorySize::XL}}, - {2610, {"S Bullet Barrel 05"_s, AccessorySize::XL}}, - {2611, {"B Bullet Barrel 01"_s, AccessorySize::XL}}, - {2612, {"B Bullet Barrel 02"_s, AccessorySize::XL}}, - {2613, {"B Bullet Barrel 03"_s, AccessorySize::XL}}, - {2614, {"B Bullet Barrel 04"_s, AccessorySize::XL}}, - {2615, {"B Bullet Barrel 05"_s, AccessorySize::XL}}, - {2616, {"B Bullet Barrel 06"_s, AccessorySize::XL}}, - {2617, {"B Bullet Barrel 07"_s, AccessorySize::XL}}, - {2618, {"B Bullet Barrel 08"_s, AccessorySize::XL}}, - {2619, {"B Bullet Barrel 09"_s, AccessorySize::XL}}, - {2620, {"B Bullet Barrel 10"_s, AccessorySize::XL}}, + {2601, {"L Bullet Barrel 01"_s, Accessory::Size::XL}}, + {2602, {"L Bullet Barrel 02"_s, Accessory::Size::XL}}, + {2603, {"L Bullet Barrel 03"_s, Accessory::Size::XL}}, + {2604, {"L Bullet Barrel 04"_s, Accessory::Size::XL}}, + {2605, {"L Bullet Barrel 05"_s, Accessory::Size::XL}}, + {2606, {"S Bullet Barrel 01"_s, Accessory::Size::XL}}, + {2607, {"S Bullet Barrel 02"_s, Accessory::Size::XL}}, + {2608, {"S Bullet Barrel 03"_s, Accessory::Size::XL}}, + {2609, {"S Bullet Barrel 04"_s, Accessory::Size::XL}}, + {2610, {"S Bullet Barrel 05"_s, Accessory::Size::XL}}, + {2611, {"B Bullet Barrel 01"_s, Accessory::Size::XL}}, + {2612, {"B Bullet Barrel 02"_s, Accessory::Size::XL}}, + {2613, {"B Bullet Barrel 03"_s, Accessory::Size::XL}}, + {2614, {"B Bullet Barrel 04"_s, Accessory::Size::XL}}, + {2615, {"B Bullet Barrel 05"_s, Accessory::Size::XL}}, + {2616, {"B Bullet Barrel 06"_s, Accessory::Size::XL}}, + {2617, {"B Bullet Barrel 07"_s, Accessory::Size::XL}}, + {2618, {"B Bullet Barrel 08"_s, Accessory::Size::XL}}, + {2619, {"B Bullet Barrel 09"_s, Accessory::Size::XL}}, + {2620, {"B Bullet Barrel 10"_s, Accessory::Size::XL}}, - {2651, {"Cylinder Scope 01"_s, AccessorySize::M}}, - {2652, {"Cylinder Scope 02"_s, AccessorySize::M}}, - {2653, {"Cylinder Scope 03"_s, AccessorySize::M}}, - {2654, {"Cylinder Scope 04"_s, AccessorySize::M}}, - {2655, {"Cylinder Scope 05"_s, AccessorySize::M}}, - {2656, {"Elec Scope 01"_s, AccessorySize::M}}, - {2657, {"Elec Scope 02"_s, AccessorySize::M}}, - {2658, {"Elec Scope 03"_s, AccessorySize::M}}, - {2659, {"Elec Scope 04"_s, AccessorySize::M}}, - {2660, {"Elec Scope 05"_s, AccessorySize::M}}, - {2661, {"Mark Scope 01"_s, AccessorySize::S}}, - {2662, {"Mark Scope 02"_s, AccessorySize::S}}, - {2663, {"Mark Scope 03"_s, AccessorySize::S}}, - {2664, {"Mark Scope 04"_s, AccessorySize::S}}, - {2665, {"Mark Scope 05"_s, AccessorySize::S}}, + {2651, {"Cylinder Scope 01"_s, Accessory::Size::M}}, + {2652, {"Cylinder Scope 02"_s, Accessory::Size::M}}, + {2653, {"Cylinder Scope 03"_s, Accessory::Size::M}}, + {2654, {"Cylinder Scope 04"_s, Accessory::Size::M}}, + {2655, {"Cylinder Scope 05"_s, Accessory::Size::M}}, + {2656, {"Elec Scope 01"_s, Accessory::Size::M}}, + {2657, {"Elec Scope 02"_s, Accessory::Size::M}}, + {2658, {"Elec Scope 03"_s, Accessory::Size::M}}, + {2659, {"Elec Scope 04"_s, Accessory::Size::M}}, + {2660, {"Elec Scope 05"_s, Accessory::Size::M}}, + {2661, {"Mark Scope 01"_s, Accessory::Size::S}}, + {2662, {"Mark Scope 02"_s, Accessory::Size::S}}, + {2663, {"Mark Scope 03"_s, Accessory::Size::S}}, + {2664, {"Mark Scope 04"_s, Accessory::Size::S}}, + {2665, {"Mark Scope 05"_s, Accessory::Size::S}}, - {2701, {"S Single Weaponry"_s, AccessorySize::M}}, - {2702, {"S Packed Weaponry 01"_s, AccessorySize::M}}, - {2703, {"S Packed Weaponry 02"_s, AccessorySize::M}}, - {2704, {"S Packed Weaponry 03"_s, AccessorySize::M}}, - {2705, {"S Packed Weaponry 04"_s, AccessorySize::M}}, - {2706, {"L Single Weaponry"_s, AccessorySize::XL}}, - {2707, {"L Packed Weaponry 01"_s, AccessorySize::XL}}, - {2708, {"L Packed Weaponry 02"_s, AccessorySize::XL}}, - {2709, {"L Packed Weaponry 03"_s, AccessorySize::XL}}, - {2710, {"L Packed Weaponry 04"_s, AccessorySize::XL}}, - {2711, {"Atk Single Weaponry"_s, AccessorySize::XL}}, - {2712, {"Atk Packed Weaponry 01"_s, AccessorySize::XL}}, - {2713, {"Atk Packed Weaponry 02"_s, AccessorySize::XL}}, - {2714, {"Atk Packed Weaponry 03"_s, AccessorySize::XL}}, - {2715, {"Atk Packed Weaponry 04"_s, AccessorySize::XL}}, + {2701, {"S Single Weaponry"_s, Accessory::Size::M}}, + {2702, {"S Packed Weaponry 01"_s, Accessory::Size::M}}, + {2703, {"S Packed Weaponry 02"_s, Accessory::Size::M}}, + {2704, {"S Packed Weaponry 03"_s, Accessory::Size::M}}, + {2705, {"S Packed Weaponry 04"_s, Accessory::Size::M}}, + {2706, {"L Single Weaponry"_s, Accessory::Size::XL}}, + {2707, {"L Packed Weaponry 01"_s, Accessory::Size::XL}}, + {2708, {"L Packed Weaponry 02"_s, Accessory::Size::XL}}, + {2709, {"L Packed Weaponry 03"_s, Accessory::Size::XL}}, + {2710, {"L Packed Weaponry 04"_s, Accessory::Size::XL}}, + {2711, {"Atk Single Weaponry"_s, Accessory::Size::XL}}, + {2712, {"Atk Packed Weaponry 01"_s, Accessory::Size::XL}}, + {2713, {"Atk Packed Weaponry 02"_s, Accessory::Size::XL}}, + {2714, {"Atk Packed Weaponry 03"_s, Accessory::Size::XL}}, + {2715, {"Atk Packed Weaponry 04"_s, Accessory::Size::XL}}, - {2751, {"Vent 01"_s, AccessorySize::M}}, - {2752, {"Vent 02"_s, AccessorySize::M}}, - {2753, {"Vent 03"_s, AccessorySize::M}}, - {2754, {"Vent 04"_s, AccessorySize::M}}, - {2755, {"Vent 05"_s, AccessorySize::M}}, - {2756, {"Vent 06"_s, AccessorySize::M}}, - {2757, {"Vent 07"_s, AccessorySize::M}}, - {2758, {"Vent 08"_s, AccessorySize::M}}, - {2759, {"Vent 09"_s, AccessorySize::M}}, - {2760, {"Vent 10"_s, AccessorySize::M}}, + {2751, {"Vent 01"_s, Accessory::Size::M}}, + {2752, {"Vent 02"_s, Accessory::Size::M}}, + {2753, {"Vent 03"_s, Accessory::Size::M}}, + {2754, {"Vent 04"_s, Accessory::Size::M}}, + {2755, {"Vent 05"_s, Accessory::Size::M}}, + {2756, {"Vent 06"_s, Accessory::Size::M}}, + {2757, {"Vent 07"_s, Accessory::Size::M}}, + {2758, {"Vent 08"_s, Accessory::Size::M}}, + {2759, {"Vent 09"_s, Accessory::Size::M}}, + {2760, {"Vent 10"_s, Accessory::Size::M}}, - {2901, {"Complex Construct 01"_s, AccessorySize::L}}, - {2902, {"Complex Construct 02"_s, AccessorySize::L}}, - {2903, {"Complex Construct 03"_s, AccessorySize::L}}, - {2904, {"Complex Construct 04"_s, AccessorySize::L}}, - {2905, {"Complex Construct 05"_s, AccessorySize::L}}, + {2901, {"Complex Construct 01"_s, Accessory::Size::L}}, + {2902, {"Complex Construct 02"_s, Accessory::Size::L}}, + {2903, {"Complex Construct 03"_s, Accessory::Size::L}}, + {2904, {"Complex Construct 04"_s, Accessory::Size::L}}, + {2905, {"Complex Construct 05"_s, Accessory::Size::L}}, - {2950, {"Q Mask 01"_s, AccessorySize::M}}, - {2951, {"Q Mask 02"_s, AccessorySize::M}}, - {2952, {"Q Mask 03"_s, AccessorySize::M}}, - {2953, {"Q Mask 04"_s, AccessorySize::M}}, - {2954, {"Q Mask 05"_s, AccessorySize::M}}, + {2950, {"Q Mask 01"_s, Accessory::Size::M}}, + {2951, {"Q Mask 02"_s, Accessory::Size::M}}, + {2952, {"Q Mask 03"_s, Accessory::Size::M}}, + {2953, {"Q Mask 04"_s, Accessory::Size::M}}, + {2954, {"Q Mask 05"_s, Accessory::Size::M}}, // endregion // region Connectors - {3001, {"Circular Vent 01"_s, AccessorySize::M}}, - {3002, {"Circular Vent 02"_s, AccessorySize::M}}, - {3003, {"Circular Vent 03"_s, AccessorySize::M}}, - {3004, {"Circular Vent 04"_s, AccessorySize::M}}, - {3005, {"Circular Vent 05"_s, AccessorySize::M}}, - {3006, {"Circular Vent 06"_s, AccessorySize::M}}, - {3007, {"Circular Vent 07"_s, AccessorySize::M}}, - {3008, {"Circular Vent 08"_s, AccessorySize::M}}, - {3009, {"Circular Vent 09"_s, AccessorySize::M}}, - {3010, {"Circular Vent 10"_s, AccessorySize::M}}, - {3011, {"Circular Vent 11"_s, AccessorySize::M}}, - {3012, {"Circular Vent 12"_s, AccessorySize::M}}, - {3013, {"Circular Vent 13"_s, AccessorySize::M}}, - {3014, {"Circular Vent 14"_s, AccessorySize::M}}, - {3015, {"Circular Vent 15"_s, AccessorySize::M}}, + {3001, {"Circular Vent 01"_s, Accessory::Size::M}}, + {3002, {"Circular Vent 02"_s, Accessory::Size::M}}, + {3003, {"Circular Vent 03"_s, Accessory::Size::M}}, + {3004, {"Circular Vent 04"_s, Accessory::Size::M}}, + {3005, {"Circular Vent 05"_s, Accessory::Size::M}}, + {3006, {"Circular Vent 06"_s, Accessory::Size::M}}, + {3007, {"Circular Vent 07"_s, Accessory::Size::M}}, + {3008, {"Circular Vent 08"_s, Accessory::Size::M}}, + {3009, {"Circular Vent 09"_s, Accessory::Size::M}}, + {3010, {"Circular Vent 10"_s, Accessory::Size::M}}, + {3011, {"Circular Vent 11"_s, Accessory::Size::M}}, + {3012, {"Circular Vent 12"_s, Accessory::Size::M}}, + {3013, {"Circular Vent 13"_s, Accessory::Size::M}}, + {3014, {"Circular Vent 14"_s, Accessory::Size::M}}, + {3015, {"Circular Vent 15"_s, Accessory::Size::M}}, - {3051, {"Reactor 01"_s, AccessorySize::L}}, - {3052, {"Reactor 02"_s, AccessorySize::L}}, - {3053, {"Reactor 03"_s, AccessorySize::L}}, - {3054, {"Reactor 04"_s, AccessorySize::L}}, - {3055, {"Reactor 05"_s, AccessorySize::L}}, + {3051, {"Reactor 01"_s, Accessory::Size::L}}, + {3052, {"Reactor 02"_s, Accessory::Size::L}}, + {3053, {"Reactor 03"_s, Accessory::Size::L}}, + {3054, {"Reactor 04"_s, Accessory::Size::L}}, + {3055, {"Reactor 05"_s, Accessory::Size::L}}, - {3101, {"Connecting Tube 01"_s, AccessorySize::XL}}, - {3102, {"Connecting Tube 02"_s, AccessorySize::XL}}, - {3103, {"Connecting Tube 03"_s, AccessorySize::XL}}, - {3104, {"Connecting Tube 04"_s, AccessorySize::XL}}, - {3105, {"Connecting Tube 05"_s, AccessorySize::XL}}, + {3101, {"Connecting Tube 01"_s, Accessory::Size::XL}}, + {3102, {"Connecting Tube 02"_s, Accessory::Size::XL}}, + {3103, {"Connecting Tube 03"_s, Accessory::Size::XL}}, + {3104, {"Connecting Tube 04"_s, Accessory::Size::XL}}, + {3105, {"Connecting Tube 05"_s, Accessory::Size::XL}}, - {3151, {"Latch 01"_s, AccessorySize::M}}, - {3152, {"Latch 02"_s, AccessorySize::M}}, - {3153, {"Latch 03"_s, AccessorySize::M}}, - {3154, {"Latch 04"_s, AccessorySize::M}}, - {3155, {"Latch 05"_s, AccessorySize::M}}, - {3156, {"Latch 06"_s, AccessorySize::M}}, - {3157, {"Latch 07"_s, AccessorySize::M}}, - {3158, {"Latch 08"_s, AccessorySize::M}}, - {3159, {"Latch 09"_s, AccessorySize::M}}, - {3160, {"Latch 10"_s, AccessorySize::M}}, - {3161, {"Latch 11"_s, AccessorySize::M}}, - {3162, {"Latch 12"_s, AccessorySize::M}}, - {3163, {"Latch 13"_s, AccessorySize::M}}, - {3164, {"Latch 14"_s, AccessorySize::M}}, - {3165, {"Latch 15"_s, AccessorySize::M}}, + {3151, {"Latch 01"_s, Accessory::Size::M}}, + {3152, {"Latch 02"_s, Accessory::Size::M}}, + {3153, {"Latch 03"_s, Accessory::Size::M}}, + {3154, {"Latch 04"_s, Accessory::Size::M}}, + {3155, {"Latch 05"_s, Accessory::Size::M}}, + {3156, {"Latch 06"_s, Accessory::Size::M}}, + {3157, {"Latch 07"_s, Accessory::Size::M}}, + {3158, {"Latch 08"_s, Accessory::Size::M}}, + {3159, {"Latch 09"_s, Accessory::Size::M}}, + {3160, {"Latch 10"_s, Accessory::Size::M}}, + {3161, {"Latch 11"_s, Accessory::Size::M}}, + {3162, {"Latch 12"_s, Accessory::Size::M}}, + {3163, {"Latch 13"_s, Accessory::Size::M}}, + {3164, {"Latch 14"_s, Accessory::Size::M}}, + {3165, {"Latch 15"_s, Accessory::Size::M}}, - {3201, {"Short Connector 01"_s, AccessorySize::M}}, - {3202, {"Short Connector 02"_s, AccessorySize::M}}, - {3203, {"Short Connector 03"_s, AccessorySize::M}}, - {3204, {"Short Connector 04"_s, AccessorySize::M}}, - {3205, {"Short Connector 05"_s, AccessorySize::M}}, - {3206, {"Antenna 01"_s, AccessorySize::S}}, - {3207, {"Antenna 02"_s, AccessorySize::S}}, - {3208, {"Antenna 03"_s, AccessorySize::S}}, - {3209, {"Antenna 04"_s, AccessorySize::S}}, - {3210, {"Antenna 05"_s, AccessorySize::S}}, + {3201, {"Short Connector 01"_s, Accessory::Size::M}}, + {3202, {"Short Connector 02"_s, Accessory::Size::M}}, + {3203, {"Short Connector 03"_s, Accessory::Size::M}}, + {3204, {"Short Connector 04"_s, Accessory::Size::M}}, + {3205, {"Short Connector 05"_s, Accessory::Size::M}}, + {3206, {"Antenna 01"_s, Accessory::Size::S}}, + {3207, {"Antenna 02"_s, Accessory::Size::S}}, + {3208, {"Antenna 03"_s, Accessory::Size::S}}, + {3209, {"Antenna 04"_s, Accessory::Size::S}}, + {3210, {"Antenna 05"_s, Accessory::Size::S}}, - {3226, {"Long Connector 01"_s, AccessorySize::XL}}, - {3227, {"Long Connector 02"_s, AccessorySize::XL}}, - {3228, {"Long Connector 03"_s, AccessorySize::XL}}, - {3229, {"Long Connector 04"_s, AccessorySize::XL}}, - {3230, {"Long Connector 05"_s, AccessorySize::XL}}, - {3231, {"Long Connector 06"_s, AccessorySize::XL}}, - {3232, {"Long Connector 07"_s, AccessorySize::XL}}, - {3233, {"Long Connector 08"_s, AccessorySize::XL}}, - {3234, {"Long Connector 09"_s, AccessorySize::XL}}, - {3235, {"Long Connector 10"_s, AccessorySize::XL}}, + {3226, {"Long Connector 01"_s, Accessory::Size::XL}}, + {3227, {"Long Connector 02"_s, Accessory::Size::XL}}, + {3228, {"Long Connector 03"_s, Accessory::Size::XL}}, + {3229, {"Long Connector 04"_s, Accessory::Size::XL}}, + {3230, {"Long Connector 05"_s, Accessory::Size::XL}}, + {3231, {"Long Connector 06"_s, Accessory::Size::XL}}, + {3232, {"Long Connector 07"_s, Accessory::Size::XL}}, + {3233, {"Long Connector 08"_s, Accessory::Size::XL}}, + {3234, {"Long Connector 09"_s, Accessory::Size::XL}}, + {3235, {"Long Connector 10"_s, Accessory::Size::XL}}, - {3251, {"Complex Connector 01"_s, AccessorySize::XL}}, - {3252, {"Complex Connector 02"_s, AccessorySize::XL}}, - {3253, {"Complex Connector 03"_s, AccessorySize::XL}}, - {3254, {"Complex Connector 04"_s, AccessorySize::XL}}, - {3255, {"Complex Connector 05"_s, AccessorySize::XL}}, + {3251, {"Complex Connector 01"_s, Accessory::Size::XL}}, + {3252, {"Complex Connector 02"_s, Accessory::Size::XL}}, + {3253, {"Complex Connector 03"_s, Accessory::Size::XL}}, + {3254, {"Complex Connector 04"_s, Accessory::Size::XL}}, + {3255, {"Complex Connector 05"_s, Accessory::Size::XL}}, - {3301, {"Tube Line 01"_s, AccessorySize::L}}, - {3302, {"Tube Line 02"_s, AccessorySize::L}}, - {3303, {"Tube Line 03"_s, AccessorySize::L}}, - {3304, {"Tube Line 04"_s, AccessorySize::XL}}, - {3305, {"Tube Line 05"_s, AccessorySize::XL}}, - {3306, {"Tube Line 06"_s, AccessorySize::M}}, - {3307, {"Tube Line 07"_s, AccessorySize::M}}, - {3308, {"Tube Line 08"_s, AccessorySize::M}}, - {3309, {"Tube Line 09"_s, AccessorySize::L}}, - {3310, {"Tube Line 10"_s, AccessorySize::L}}, + {3301, {"Tube Line 01"_s, Accessory::Size::L}}, + {3302, {"Tube Line 02"_s, Accessory::Size::L}}, + {3303, {"Tube Line 03"_s, Accessory::Size::L}}, + {3304, {"Tube Line 04"_s, Accessory::Size::XL}}, + {3305, {"Tube Line 05"_s, Accessory::Size::XL}}, + {3306, {"Tube Line 06"_s, Accessory::Size::M}}, + {3307, {"Tube Line 07"_s, Accessory::Size::M}}, + {3308, {"Tube Line 08"_s, Accessory::Size::M}}, + {3309, {"Tube Line 09"_s, Accessory::Size::L}}, + {3310, {"Tube Line 10"_s, Accessory::Size::L}}, - {3351, {"Radar Plate 01"_s, AccessorySize::M}}, - {3352, {"Radar Plate 02"_s, AccessorySize::M}}, - {3353, {"Radar Plate 03"_s, AccessorySize::M}}, - {3354, {"Radar Plate 04"_s, AccessorySize::M}}, - {3355, {"Radar Plate 05"_s, AccessorySize::M}}, - {3356, {"Radar Pod 01"_s, AccessorySize::M}}, - {3357, {"Radar Pod 02"_s, AccessorySize::M}}, - {3358, {"Radar Pod 03"_s, AccessorySize::M}}, - {3359, {"Radar Pod 04"_s, AccessorySize::M}}, - {3360, {"Radar Pod 05"_s, AccessorySize::M}}, + {3351, {"Radar Plate 01"_s, Accessory::Size::M}}, + {3352, {"Radar Plate 02"_s, Accessory::Size::M}}, + {3353, {"Radar Plate 03"_s, Accessory::Size::M}}, + {3354, {"Radar Plate 04"_s, Accessory::Size::M}}, + {3355, {"Radar Plate 05"_s, Accessory::Size::M}}, + {3356, {"Radar Pod 01"_s, Accessory::Size::M}}, + {3357, {"Radar Pod 02"_s, Accessory::Size::M}}, + {3358, {"Radar Pod 03"_s, Accessory::Size::M}}, + {3359, {"Radar Pod 04"_s, Accessory::Size::M}}, + {3360, {"Radar Pod 05"_s, Accessory::Size::M}}, - {3401, {"Tri Pod 01"_s, AccessorySize::M}}, - {3402, {"Tri Pod 02"_s, AccessorySize::M}}, - {3403, {"Tri Pod 03"_s, AccessorySize::M}}, - {3404, {"Tri Pod 04"_s, AccessorySize::M}}, - {3405, {"Tri Pod 05"_s, AccessorySize::M}}, - {3406, {"Signal Pod 01"_s, AccessorySize::M}}, - {3407, {"Signal Pod 02"_s, AccessorySize::M}}, - {3408, {"Signal Pod 03"_s, AccessorySize::M}}, - {3409, {"Signal Pod 04"_s, AccessorySize::M}}, - {3410, {"Signal Pod 05"_s, AccessorySize::M}}, + {3401, {"Tri Pod 01"_s, Accessory::Size::M}}, + {3402, {"Tri Pod 02"_s, Accessory::Size::M}}, + {3403, {"Tri Pod 03"_s, Accessory::Size::M}}, + {3404, {"Tri Pod 04"_s, Accessory::Size::M}}, + {3405, {"Tri Pod 05"_s, Accessory::Size::M}}, + {3406, {"Signal Pod 01"_s, Accessory::Size::M}}, + {3407, {"Signal Pod 02"_s, Accessory::Size::M}}, + {3408, {"Signal Pod 03"_s, Accessory::Size::M}}, + {3409, {"Signal Pod 04"_s, Accessory::Size::M}}, + {3410, {"Signal Pod 05"_s, Accessory::Size::M}}, // endregion }; + +}} diff --git a/src/Maps/ArmourSets.h b/src/Maps/ArmourSets.h index a59fe8b..6aeb01b 100644 --- a/src/Maps/ArmourSets.h +++ b/src/Maps/ArmourSets.h @@ -25,6 +25,8 @@ using namespace Corrade; using namespace Containers::Literals; +namespace mbst { namespace GameData { + struct ArmourSet { Containers::StringView name; bool neck_compatible; @@ -55,3 +57,5 @@ static const std::map armour_sets { {26, {"Axial Core S-Type"_s, false}}, {27, {"Axial Core X-Type"_s, false}}, }; + +}} diff --git a/src/Maps/LastMissionId.h b/src/Maps/LastMissionId.h index 4d8a4f0..f535ca1 100644 --- a/src/Maps/LastMissionId.h +++ b/src/Maps/LastMissionId.h @@ -23,36 +23,40 @@ using namespace Corrade; using namespace Containers::Literals; +namespace mbst { namespace GameData { + static const std::map mission_id_map {{ // Story missions - {0x0064, "Mission 1 - Training"_s}, - {0x0065, "Mission 2 - Patrol Operation"_s}, - {0x0066, "Mission 3 - Fusion Cells in the Snow"_s}, - {0x0067, "Mission 4 - Earning Changes"_s}, - {0x0068, "Mission 5 - Unexpected Coordination"_s}, - {0x0069, "Mission 6 - Empowering Void"_s}, - {0x006A, "Mission 7 - Logisitics Obstacles"_s}, - {0x006B, "Mission 8 - Wrath of the Wastelands"_s}, - {0x006C, "Mission 9 - Suspicious Originator"_s}, - {0x006D, "Mission 10 - Researchers Data Recovery"_s}, - {0x006E, "Mission 11 - Tempestuous Sector"_s}, - {0x006F, "Mission 12 - Clashes of Metal"_s}, - {0x0070, "Mission 13 - The Sandstorm Glutton"_s}, - {0x0071, "Mission 14 - An Icy Investigation"_s}, - {0x0072, "Mission 15 - Outposts Line of Defense"_s}, - {0x0073, "Mission 16 - Hidden in the Pass"_s}, - {0x0074, "Mission 17 - Homebase Security"_s}, + {100, "Mission 1 - Training"_s}, + {101, "Mission 2 - Patrol Operation"_s}, + {102, "Mission 3 - Fusion Cells in the Snow"_s}, + {103, "Mission 4 - Earning Changes"_s}, + {104, "Mission 5 - Unexpected Coordination"_s}, + {105, "Mission 6 - Empowering Void"_s}, + {106, "Mission 7 - Logisitics Obstacles"_s}, + {107, "Mission 8 - Wrath of the Wastelands"_s}, + {108, "Mission 9 - Suspicious Originator"_s}, + {109, "Mission 10 - Researchers Data Recovery"_s}, + {110, "Mission 11 - Tempestuous Sector"_s}, + {111, "Mission 12 - Clashes of Metal"_s}, + {112, "Mission 13 - The Sandstorm Glutton"_s}, + {113, "Mission 14 - An Icy Investigation"_s}, + {114, "Mission 15 - Outposts Line of Defense"_s}, + {115, "Mission 16 - Hidden in the Pass"_s}, + {116, "Mission 17 - Homebase Security"_s}, // Hunting grounds - {0x00C8, "Hunt 1 - Desert Pathway Safety"_s}, - {0x00C9, "Hunt 2 - Snowfield Custodian"_s}, - {0x00CA, "Hunt 3 - Abandoned Valley Raid"_s}, - {0x00CB, "Hunt 4 - Depths of the Machineries"_s}, - {0x00CC, "Hunt 5 - Crater Crashers"_s}, - {0x00CD, "Hunt 6 - Prototype Performance Tests"_s}, + {200, "Hunt 1 - Desert Pathway Safety"_s}, + {201, "Hunt 2 - Snowfield Custodian"_s}, + {202, "Hunt 3 - Abandoned Valley Raid"_s}, + {203, "Hunt 4 - Depths of the Machineries"_s}, + {204, "Hunt 5 - Crater Crashers"_s}, + {205, "Hunt 6 - Prototype Performance Tests"_s}, // Challenges - {0x012C, "Challenge 1 - Redline Battlefront"_s}, - {0x0140, "Challenge 2 - Void Convergence"_s}, - {0x0190, "Challenge 3 - Gates of Ascension"_s} + {300, "Challenge 1 - Redline Battlefront"_s}, + {320, "Challenge 2 - Void Convergence"_s}, + {400, "Challenge 3 - Gates of Ascension"_s} }}; + +}} diff --git a/src/Maps/StoryProgress.h b/src/Maps/StoryProgress.h index 61d857e..e5f4938 100644 --- a/src/Maps/StoryProgress.h +++ b/src/Maps/StoryProgress.h @@ -22,6 +22,8 @@ using namespace Corrade; using namespace Containers::Literals; +namespace mbst { namespace GameData { + struct StoryProgressPoint { std::int32_t id{}; Containers::StringView chapter = nullptr; @@ -109,3 +111,5 @@ static const Corrade::Containers::Array story_progress {0x070A, "Chapter 3"_s, "Got hunt 6 briefing"_s, "After mission 17"_s}, } }; + +}} diff --git a/src/Maps/StyleNames.h b/src/Maps/StyleNames.h index b54a7ef..e977b3b 100644 --- a/src/Maps/StyleNames.h +++ b/src/Maps/StyleNames.h @@ -25,6 +25,8 @@ using namespace Corrade; using namespace Containers::Literals; +namespace mbst { namespace GameData { + extern const std::map style_names #ifdef STYLENAMES_DEFINITION { @@ -193,3 +195,5 @@ extern const std::map style_names } #endif ; + +}} diff --git a/src/Maps/WeaponParts.h b/src/Maps/WeaponParts.h index 878fa96..f8f49ae 100644 --- a/src/Maps/WeaponParts.h +++ b/src/Maps/WeaponParts.h @@ -25,6 +25,8 @@ using namespace Corrade; using namespace Containers::Literals; +namespace mbst { namespace GameData { + // region Melee static const std::map melee_grips { {0, "Combat Grip (1H)"_s}, @@ -430,3 +432,5 @@ static const std::map elauncher_pods { {399, "P Base EPod (Photon)"_s}, }; // endregion + +}} diff --git a/src/Mass/Accessory.h b/src/Mass/Accessory.h index c82b24b..c72600a 100644 --- a/src/Mass/Accessory.h +++ b/src/Mass/Accessory.h @@ -24,6 +24,8 @@ using namespace Corrade; using namespace Magnum; +namespace mbst { namespace GameObjects { + struct Accessory { std::int32_t attachIndex = -1; std::int32_t id = -1; @@ -34,3 +36,5 @@ struct Accessory { Vector3 relativeRotationOffset{0.0f}; Vector3 localScale{1.0f}; }; + +}} diff --git a/src/Mass/ArmourPart.h b/src/Mass/ArmourPart.h index 300948e..e4314a4 100644 --- a/src/Mass/ArmourPart.h +++ b/src/Mass/ArmourPart.h @@ -24,16 +24,19 @@ using namespace Corrade; -enum class ArmourSlot { - #define c(enumerator, enumstr, name) enumerator, - #include "../Maps/ArmourSlots.hpp" - #undef c -}; +namespace mbst { namespace GameObjects { struct ArmourPart { - ArmourSlot slot = ArmourSlot::Face; + enum class Slot { + #define c(enumerator, enumstr, name) enumerator, + #include "../Maps/ArmourSlots.hpp" + #undef c + }; + Slot slot = Slot::Face; std::int32_t id = 0; Containers::StaticArray<4, std::int32_t> styles{ValueInit}; Containers::Array decals; Containers::Array accessories; }; + +}} diff --git a/src/Mass/BulletLauncherAttachment.h b/src/Mass/BulletLauncherAttachment.h index 5be79e0..b111064 100644 --- a/src/Mass/BulletLauncherAttachment.h +++ b/src/Mass/BulletLauncherAttachment.h @@ -24,23 +24,26 @@ using namespace Corrade; using namespace Magnum; +namespace mbst { namespace GameObjects { + enum class BulletLauncherAttachmentStyle { #define c(enumerator, enumstr) enumerator, #include "../Maps/BulletLauncherAttachmentStyles.hpp" #undef c }; -enum class BulletLauncherSocket { - #define c(enumerator, enumstr, name) enumerator, - #include "../Maps/BulletLauncherSockets.hpp" - #undef c -}; - struct BulletLauncherAttachment { - BulletLauncherSocket socket = BulletLauncherSocket::Auto; + enum class Socket { + #define c(enumerator, enumstr, name) enumerator, + #include "../Maps/BulletLauncherSockets.hpp" + #undef c + }; + Socket socket = Socket::Auto; Vector3 relativeLocation; Vector3 offsetLocation; Vector3 relativeRotation; Vector3 offsetRotation; Vector3 relativeScale; }; + +}} diff --git a/src/Mass/CustomStyle.h b/src/Mass/CustomStyle.h index 73d7cb3..bfdcdd4 100644 --- a/src/Mass/CustomStyle.h +++ b/src/Mass/CustomStyle.h @@ -25,6 +25,8 @@ using namespace Corrade; using namespace Magnum; +namespace mbst { namespace GameObjects { + struct CustomStyle { Containers::String name; Color4 colour{0.0f}; @@ -38,3 +40,5 @@ struct CustomStyle { float rotation = 0.0f; float scale = 0.5f; }; + +}} diff --git a/src/Mass/Decal.h b/src/Mass/Decal.h index 3bf7f14..4c057b5 100644 --- a/src/Mass/Decal.h +++ b/src/Mass/Decal.h @@ -23,6 +23,8 @@ using namespace Magnum; +namespace mbst { namespace GameObjects { + struct Decal { std::int32_t id = -1; Color4 colour{0.0f}; @@ -35,3 +37,5 @@ struct Decal { bool flip = false; bool wrap = false; }; + +}} diff --git a/src/Mass/Joints.h b/src/Mass/Joints.h index d2bb3fa..ce30800 100644 --- a/src/Mass/Joints.h +++ b/src/Mass/Joints.h @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +namespace mbst { namespace GameObjects { + struct Joints { float neck = 0.0f; float body = 0.0f; @@ -26,3 +28,5 @@ struct Joints { float upperLegs = 0.0f; float lowerLegs = 0.0f; }; + +}} diff --git a/src/Mass/Mass.cpp b/src/Mass/Mass.cpp index f34475e..901f820 100644 --- a/src/Mass/Mass.cpp +++ b/src/Mass/Mass.cpp @@ -23,17 +23,19 @@ #include "PropertyNames.h" #include "../Logger/Logger.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/BoolProperty.h" -#include "../UESaveFile/Types/ColourStructProperty.h" -#include "../UESaveFile/Types/GenericStructProperty.h" -#include "../UESaveFile/Types/IntProperty.h" -#include "../UESaveFile/Types/StringProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/BoolProperty.h" +#include "../Gvas/Types/ColourStructProperty.h" +#include "../Gvas/Types/GenericStructProperty.h" +#include "../Gvas/Types/IntProperty.h" +#include "../Gvas/Types/StringProperty.h" #include "Mass.h" using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + Mass::Mass(Containers::StringView path) { auto split = Utility::Path::split(path); _folder = split.first(); @@ -54,21 +56,21 @@ Mass::getNameFromFile(Containers::StringView path) { return Containers::NullOpt; } - UESaveFile mass{path}; + Gvas::File mass{path}; if(!mass.valid()) { LOG_ERROR_FORMAT("{} is invalid: {}", path, mass.lastError()); return Containers::NullOpt; } - auto unit_data = mass.at(MASS_UNIT_DATA); + auto unit_data = mass.at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, path); return Containers::NullOpt; } - auto name_prop = unit_data->at(MASS_NAME); + auto name_prop = unit_data->at(MASS_NAME); if(!name_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, path); @@ -125,7 +127,7 @@ Mass::refreshValues() { } LOG_INFO("Getting the unit data."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; @@ -133,7 +135,7 @@ Mass::refreshValues() { } LOG_INFO("Reading the M.A.S.S. name."); - auto name_prop = unit_data->at(MASS_NAME); + auto name_prop = unit_data->at(MASS_NAME); if(!name_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, _filename); @@ -220,7 +222,7 @@ Mass::refreshValues() { } LOG_INFO("Getting the associated account."); - auto account_prop = _mass->at("Account"_s); + auto account_prop = _mass->at("Account"_s); if(!account_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_ACCOUNT, _filename); _state = State::Invalid; @@ -247,7 +249,7 @@ bool Mass::setName(Containers::StringView new_name) { _name = {new_name}; - auto unit_data = _mass->at("UnitData"_s); + auto unit_data = _mass->at("UnitData"_s); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); @@ -255,7 +257,7 @@ Mass::setName(Containers::StringView new_name) { return false; } - auto name_prop = unit_data->at("Name_45_A037C5D54E53456407BDF091344529BB"_s); + auto name_prop = unit_data->at("Name_45_A037C5D54E53456407BDF091344529BB"_s); if(!name_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_NAME, _filename); @@ -347,7 +349,7 @@ bool Mass::updateAccount(Containers::StringView new_account) { _account = new_account; - auto account = _mass->at(MASS_ACCOUNT); + auto account = _mass->at(MASS_ACCOUNT); if(!account) { _lastError = "Couldn't find the " MASS_ACCOUNT " property."_s; _state = State::Invalid; @@ -371,7 +373,7 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& { LOG_INFO_FORMAT("Getting tuning data ({}, {}).", big_node_prop_name, small_nodes_prop_name); - auto node_id = _mass->at(big_node_prop_name); + auto node_id = _mass->at(big_node_prop_name); if(!node_id) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", big_node_prop_name, _filename); _state = State::Invalid; @@ -379,7 +381,7 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& } big_node_id = node_id->value; - auto node_ids = _mass->at(small_nodes_prop_name); + auto node_ids = _mass->at(small_nodes_prop_name); if(!node_ids) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", small_nodes_prop_name, _filename); _state = State::Invalid; @@ -394,8 +396,10 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& } for(std::uint32_t i = 0; i < small_nodes_ids.size(); i++) { - auto small_node_id = node_ids->at(i); + auto small_node_id = node_ids->at(i); CORRADE_INTERNAL_ASSERT(small_node_id); small_nodes_ids[i] = small_node_id->value; } } + +}} diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index eb1398b..ec1b419 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -36,12 +36,13 @@ #include "WeaponPart.h" #include "Weapon.h" -#include "../UESaveFile/UESaveFile.h" +#include "../Gvas/File.h" +#include "../Gvas/Types/Types.h" using namespace Corrade; using namespace Magnum; -struct ArrayProperty; +namespace mbst { namespace GameObjects { class Mass { public: @@ -53,106 +54,106 @@ class Mass { Mass(Mass&&) = default; Mass& operator=(Mass&&) = default; - Containers::StringView lastError(); + auto lastError() -> Containers::StringView ; - static Containers::Optional getNameFromFile(Containers::StringView path); + static auto getNameFromFile(Containers::StringView path) -> Containers::Optional; void refreshValues(); - Containers::StringView filename(); + auto filename() -> Containers::StringView; - Containers::StringView name(); + auto name() -> Containers::StringView; bool setName(Containers::StringView new_name); enum class State: std::uint8_t { Empty, Invalid, Valid }; - State state(); + auto state() -> State; bool dirty() const; void setDirty(bool dirty = true); - Joints& jointSliders(); + auto jointSliders() -> Joints&; void getJointSliders(); bool writeJointSliders(); - Containers::ArrayView frameStyles(); + auto frameStyles() -> Containers::ArrayView; void getFrameStyles(); bool writeFrameStyles(); - Color4& eyeFlareColour(); + auto eyeFlareColour() -> Color4&; void getEyeFlareColour(); bool writeEyeFlareColour(); - Containers::ArrayView frameCustomStyles(); + auto frameCustomStyles() -> Containers::ArrayView; void getFrameCustomStyles(); bool writeFrameCustomStyle(std::size_t index); - Containers::ArrayView armourParts(); + auto armourParts() -> Containers::ArrayView; void getArmourParts(); - bool writeArmourPart(ArmourSlot slot); + bool writeArmourPart(ArmourPart::Slot slot); - BulletLauncherAttachmentStyle& bulletLauncherAttachmentStyle(); - Containers::ArrayView bulletLauncherAttachments(); + auto bulletLauncherAttachmentStyle() -> BulletLauncherAttachmentStyle&; + auto bulletLauncherAttachments() -> Containers::ArrayView; void getBulletLauncherAttachments(); bool writeBulletLauncherAttachments(); - Containers::ArrayView armourCustomStyles(); + auto armourCustomStyles() -> Containers::ArrayView; void getArmourCustomStyles(); bool writeArmourCustomStyle(std::size_t index); - Containers::ArrayView meleeWeapons(); + auto meleeWeapons() -> Containers::ArrayView; void getMeleeWeapons(); bool writeMeleeWeapons(); - Containers::ArrayView shields(); + auto shields() -> Containers::ArrayView; void getShields(); bool writeShields(); - Containers::ArrayView bulletShooters(); + auto bulletShooters() -> Containers::ArrayView; void getBulletShooters(); bool writeBulletShooters(); - Containers::ArrayView energyShooters(); + auto energyShooters() -> Containers::ArrayView; void getEnergyShooters(); bool writeEnergyShooters(); - Containers::ArrayView bulletLaunchers(); + auto bulletLaunchers() -> Containers::ArrayView; void getBulletLaunchers(); bool writeBulletLaunchers(); - Containers::ArrayView energyLaunchers(); + auto energyLaunchers() -> Containers::ArrayView; void getEnergyLaunchers(); bool writeEnergyLaunchers(); - Containers::ArrayView globalStyles(); + auto globalStyles() -> Containers::ArrayView; void getGlobalStyles(); bool writeGlobalStyle(std::size_t index); void getTuning(); - std::int32_t& engine(); - Containers::ArrayView gears(); + auto engine() -> std::int32_t&; + auto gears() -> Containers::ArrayView; - std::int32_t& os(); - Containers::ArrayView modules(); + auto os() -> std::int32_t&; + auto modules() -> Containers::ArrayView; - std::int32_t& architecture(); - Containers::ArrayView techs(); + auto architecture() -> std::int32_t&; + auto techs() -> Containers::ArrayView; - Containers::StringView account(); + auto account() -> Containers::StringView; bool updateAccount(Containers::StringView new_account); private: - void getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array); - bool writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array); + void getCustomStyles(Containers::ArrayView styles, Gvas::Types::ArrayProperty* style_array); + bool writeCustomStyle(const CustomStyle& style, std::size_t index, Gvas::Types::ArrayProperty* style_array); - void getDecals(Containers::ArrayView decals, ArrayProperty* decal_array); - void writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array); + void getDecals(Containers::ArrayView decals, Gvas::Types::ArrayProperty* decal_array); + void writeDecals(Containers::ArrayView decals, Gvas::Types::ArrayProperty* decal_array); - void getAccessories(Containers::ArrayView accessories, ArrayProperty* accessory_array); - void writeAccessories(Containers::ArrayView accessories, ArrayProperty* accs_array); + void getAccessories(Containers::ArrayView accessories, Gvas::Types::ArrayProperty* accessory_array); + void writeAccessories(Containers::ArrayView accessories, Gvas::Types::ArrayProperty* accs_array); void getWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array); bool writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array); @@ -161,7 +162,7 @@ class Mass { Containers::StringView small_nodes_prop_name, Containers::ArrayView small_nodes_ids); - Containers::Optional _mass; + Containers::Optional _mass; Containers::String _lastError; @@ -211,3 +212,5 @@ class Mass { Containers::String _account; }; + +}} diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 990d637..796a1e9 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -18,17 +18,19 @@ #include "PropertyNames.h" #include "../Logger/Logger.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/ByteProperty.h" -#include "../UESaveFile/Types/GenericStructProperty.h" -#include "../UESaveFile/Types/IntProperty.h" -#include "../UESaveFile/Types/StringProperty.h" -#include "../UESaveFile/Types/VectorStructProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/ByteProperty.h" +#include "../Gvas/Types/GenericStructProperty.h" +#include "../Gvas/Types/IntProperty.h" +#include "../Gvas/Types/StringProperty.h" +#include "../Gvas/Types/VectorStructProperty.h" #include "Mass.h" using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + Containers::ArrayView Mass::armourParts() { return _armour.parts; @@ -38,14 +40,14 @@ void Mass::getArmourParts() { LOG_INFO("Getting armour parts."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto armour_array = unit_data->at(MASS_ARMOUR_PARTS); + auto armour_array = unit_data->at(MASS_ARMOUR_PARTS); if(!armour_array) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_ARMOUR_PARTS, _filename); _state = State::Invalid; @@ -60,11 +62,11 @@ Mass::getArmourParts() { } for(std::uint32_t i = 0; i < armour_array->items.size(); i++) { - auto part_prop = armour_array->at(i); + auto part_prop = armour_array->at(i); auto& part = _armour.parts[i]; - auto& armour_slot = part_prop->at(MASS_ARMOUR_SLOT)->enumValue; - #define c(enumerator, strenum, name) if(armour_slot == (strenum)) { part.slot = ArmourSlot::enumerator; } else + auto& armour_slot = part_prop->at(MASS_ARMOUR_SLOT)->enumValue; + #define c(enumerator, strenum, name) if(armour_slot == (strenum)) { part.slot = ArmourPart::Slot::enumerator; } else #include "../Maps/ArmourSlots.hpp" #undef c { @@ -73,9 +75,9 @@ Mass::getArmourParts() { return; } - part.id = part_prop->at(MASS_ARMOUR_ID)->value; + part.id = part_prop->at(MASS_ARMOUR_ID)->value; - auto part_styles = part_prop->at(MASS_ARMOUR_STYLES); + auto part_styles = part_prop->at(MASS_ARMOUR_STYLES); if(!part_styles) { LOG_ERROR_FORMAT("Part styles not found for part number {}.", i); _state = State::Invalid; @@ -90,10 +92,10 @@ Mass::getArmourParts() { } for(std::uint32_t j = 0; j < part_styles->items.size(); j++) { - part.styles[j] = part_styles->at(j)->value; + part.styles[j] = part_styles->at(j)->value; } - auto decals_array = part_prop->at(MASS_ARMOUR_DECALS); + auto decals_array = part_prop->at(MASS_ARMOUR_DECALS); if(!decals_array) { LOG_ERROR_FORMAT("Part decals not found for part number {}.", i); _state = State::Invalid; @@ -104,7 +106,7 @@ Mass::getArmourParts() { getDecals(part.decals, decals_array); - auto accs_array = part_prop->at(MASS_ARMOUR_ACCESSORIES); + auto accs_array = part_prop->at(MASS_ARMOUR_ACCESSORIES); if(!accs_array) { LOG_WARNING_FORMAT("Part accessories not found for part number {}.", i); part.accessories = Containers::Array{}; @@ -120,12 +122,12 @@ Mass::getArmourParts() { } bool -Mass::writeArmourPart(ArmourSlot slot) { +Mass::writeArmourPart(ArmourPart::Slot slot) { LOG_INFO_FORMAT("Writing armour part in slot {}.", static_cast(slot)); auto& part = *std::find_if(_armour.parts.begin(), _armour.parts.end(), [&slot](const ArmourPart& part){ return slot == part.slot; }); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "Couldn't find the unit data in " + _filename + "."; LOG_ERROR(_lastError); @@ -133,7 +135,7 @@ Mass::writeArmourPart(ArmourSlot slot) { return false; } - auto armour_array = unit_data->at(MASS_ARMOUR_PARTS); + auto armour_array = unit_data->at(MASS_ARMOUR_PARTS); if(!armour_array) { _lastError = "Couldn't find the armour part array in " + _filename + "."; LOG_ERROR(_lastError); @@ -143,18 +145,18 @@ Mass::writeArmourPart(ArmourSlot slot) { Containers::StringView slot_str = nullptr; switch(slot) { - #define c(enumerator, strenum, name) case ArmourSlot::enumerator: \ + #define c(enumerator, strenum, name) case ArmourPart::Slot::enumerator: \ slot_str = strenum; \ break; #include "../Maps/ArmourSlots.hpp" #undef c } - GenericStructProperty* part_prop = nullptr; + Gvas::Types::GenericStructProperty* part_prop = nullptr; for(std::uint32_t i = 0; i < armour_array->items.size(); i++) { - part_prop = armour_array->at(i); - if(slot_str == part_prop->at(MASS_ARMOUR_SLOT)->enumValue) { + part_prop = armour_array->at(i); + if(slot_str == part_prop->at(MASS_ARMOUR_SLOT)->enumValue) { break; } else { @@ -165,7 +167,7 @@ Mass::writeArmourPart(ArmourSlot slot) { if(!part_prop) { auto prefix = "Couldn't find the armour part for slot "_s; switch(slot) { - #define c(enumerator, strenum, name) case ArmourSlot::enumerator: \ + #define c(enumerator, strenum, name) case ArmourPart::Slot::enumerator: \ _lastError = prefix + "ArmourSlot::" #enumerator "."_s; \ break; #include "../Maps/ArmourSlots.hpp" @@ -175,18 +177,18 @@ Mass::writeArmourPart(ArmourSlot slot) { return false; } - part_prop->at(MASS_ARMOUR_ID)->value = part.id; + part_prop->at(MASS_ARMOUR_ID)->value = part.id; - auto part_styles = part_prop->at(MASS_ARMOUR_STYLES); + auto part_styles = part_prop->at(MASS_ARMOUR_STYLES); for(std::uint32_t i = 0; i < part.styles.size(); i++) { - part_styles->at(i)->value = part.styles[i]; + part_styles->at(i)->value = part.styles[i]; } - auto decals_array = part_prop->at(MASS_ARMOUR_DECALS); + auto decals_array = part_prop->at(MASS_ARMOUR_DECALS); writeDecals(part.decals, decals_array); if(!part.accessories.isEmpty()) { - auto accs_array = part_prop->at(MASS_ARMOUR_ACCESSORIES); + auto accs_array = part_prop->at(MASS_ARMOUR_ACCESSORIES); writeAccessories(part.accessories, accs_array); } @@ -212,15 +214,15 @@ void Mass::getBulletLauncherAttachments() { LOG_INFO("Getting the bullet launcher attachment data."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto attach_style_prop = unit_data->at(MASS_BL_ATTACHMENT_STYLE); - auto attach_array = unit_data->at(MASS_BL_ATTACHMENTS); + auto attach_style_prop = unit_data->at(MASS_BL_ATTACHMENT_STYLE); + auto attach_array = unit_data->at(MASS_BL_ATTACHMENTS); if(!attach_style_prop && !attach_array) { LOG_WARNING_FORMAT("No bullet launcher attachment data found in {}.", _filename); @@ -239,11 +241,11 @@ Mass::getBulletLauncherAttachments() { attach_array->items.size() == _armour.blAttachment.size()) { for(std::uint32_t i = 0; i < attach_array->items.size(); i++) { - auto attachment_prop = attach_array->at(i); + auto attachment_prop = attach_array->at(i); auto& attachment = _armour.blAttachment[i]; - Containers::StringView socket = attachment_prop->at(MASS_BL_ATTACHMENT_SOCKET)->value; - #define c(enumerator, strenum, name) if(socket == (strenum)) { attachment.socket = BulletLauncherSocket::enumerator; } else + Containers::StringView socket = attachment_prop->at(MASS_BL_ATTACHMENT_SOCKET)->value; + #define c(enumerator, strenum, name) if(socket == (strenum)) { attachment.socket = BulletLauncherAttachment::Socket::enumerator; } else #include "../Maps/BulletLauncherSockets.hpp" #undef c { @@ -252,15 +254,15 @@ Mass::getBulletLauncherAttachments() { return; } - auto rel_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELLOC); + auto rel_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELLOC); attachment.relativeLocation = Vector3{rel_loc_prop->x, rel_loc_prop->y, rel_loc_prop->z}; - auto off_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFLOC); + auto off_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFLOC); attachment.offsetLocation = Vector3{off_loc_prop->x, off_loc_prop->y, off_loc_prop->z}; - auto rel_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELROT); + auto rel_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELROT); attachment.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z}; - auto off_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFROT); + auto off_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFROT); attachment.offsetRotation = Vector3{off_rot_prop->x, off_rot_prop->y, off_rot_prop->z}; - auto rel_scale_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELSCALE); + auto rel_scale_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELSCALE); attachment.relativeScale = Vector3{rel_scale_prop->x, rel_scale_prop->y, rel_scale_prop->z}; } } @@ -284,7 +286,7 @@ bool Mass::writeBulletLauncherAttachments() { LOG_INFO("Writing bullet launcher attachments."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in " + _filename; LOG_ERROR(_lastError); @@ -292,8 +294,8 @@ Mass::writeBulletLauncherAttachments() { return false; } - auto attach_style_prop = unit_data->at(MASS_BL_ATTACHMENT_STYLE); - auto attach_array = unit_data->at(MASS_BL_ATTACHMENTS); + auto attach_style_prop = unit_data->at(MASS_BL_ATTACHMENT_STYLE); + auto attach_array = unit_data->at(MASS_BL_ATTACHMENTS); if(!attach_style_prop && !attach_array) { _lastError = "No attachment properties to write to in " + _filename; @@ -314,12 +316,12 @@ Mass::writeBulletLauncherAttachments() { attach_array->items.size() == _armour.blAttachment.size()) { for(std::uint32_t i = 0; i < attach_array->items.size(); i++) { - auto attachment_prop = attach_array->at(i); + auto attachment_prop = attach_array->at(i); auto& attachment = _armour.blAttachment[i]; - auto& socket = attachment_prop->at(MASS_BL_ATTACHMENT_SOCKET)->value; + auto& socket = attachment_prop->at(MASS_BL_ATTACHMENT_SOCKET)->value; switch(attachment.socket) { - #define c(enumerator, strenum, name) case BulletLauncherSocket::enumerator: socket = strenum; break; + #define c(enumerator, strenum, name) case BulletLauncherAttachment::Socket::enumerator: socket = strenum; break; #include "../Maps/BulletLauncherSockets.hpp" #undef c default: @@ -328,23 +330,23 @@ Mass::writeBulletLauncherAttachments() { return false; } - auto rel_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELLOC); + auto rel_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELLOC); rel_loc_prop->x = attachment.relativeLocation.x(); rel_loc_prop->y = attachment.relativeLocation.y(); rel_loc_prop->z = attachment.relativeLocation.z(); - auto off_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFLOC); + auto off_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFLOC); off_loc_prop->x = attachment.offsetLocation.x(); off_loc_prop->y = attachment.offsetLocation.y(); off_loc_prop->z = attachment.offsetLocation.z(); - auto rel_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELROT); + auto rel_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELROT); rel_rot_prop->x = attachment.relativeRotation.x(); rel_rot_prop->y = attachment.relativeRotation.y(); rel_rot_prop->z = attachment.relativeRotation.z(); - auto off_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFROT); + auto off_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFROT); off_rot_prop->x = attachment.offsetRotation.x(); off_rot_prop->y = attachment.offsetRotation.y(); off_rot_prop->z = attachment.offsetRotation.z(); - auto rel_scale_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELSCALE); + auto rel_scale_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELSCALE); rel_scale_prop->x = attachment.relativeScale.x(); rel_scale_prop->y = attachment.relativeScale.y(); rel_scale_prop->z = attachment.relativeScale.z(); @@ -352,10 +354,10 @@ Mass::writeBulletLauncherAttachments() { } if(!attach_style_prop) { - attach_style_prop = new ByteProperty; + attach_style_prop = new Gvas::Types::ByteProperty; attach_style_prop->name.emplace(MASS_BL_ATTACHMENT_STYLE); attach_style_prop->enumType = "enuBLAttachmentStyle"_s; - ByteProperty::ptr prop{attach_style_prop}; + Gvas::Types::ByteProperty::ptr prop{attach_style_prop}; arrayAppend(unit_data->properties, std::move(prop)); } @@ -389,14 +391,14 @@ void Mass::getArmourCustomStyles() { LOG_INFO("Getting the custom armour styles."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto armour_styles = unit_data->at(MASS_CUSTOM_ARMOUR_STYLES); + auto armour_styles = unit_data->at(MASS_CUSTOM_ARMOUR_STYLES); if(!armour_styles) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_CUSTOM_ARMOUR_STYLES, _filename); _state = State::Invalid; @@ -423,7 +425,7 @@ Mass::writeArmourCustomStyle(std::size_t index) { return false; } - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "Couldn't find unit data in "_s + _filename; LOG_ERROR(_lastError); @@ -431,7 +433,7 @@ Mass::writeArmourCustomStyle(std::size_t index) { return false; } - auto armour_styles = unit_data->at(MASS_CUSTOM_ARMOUR_STYLES); + auto armour_styles = unit_data->at(MASS_CUSTOM_ARMOUR_STYLES); if(!armour_styles) { _lastError = "Couldn't find armour custom styles in "_s + _filename; LOG_ERROR(_lastError); @@ -441,3 +443,5 @@ Mass::writeArmourCustomStyle(std::size_t index) { return writeCustomStyle(_armour.customStyles[index], index, armour_styles); } + +}} diff --git a/src/Mass/Mass_DecalsAccessories.cpp b/src/Mass/Mass_DecalsAccessories.cpp index 002a95b..91fcc71 100644 --- a/src/Mass/Mass_DecalsAccessories.cpp +++ b/src/Mass/Mass_DecalsAccessories.cpp @@ -15,138 +15,142 @@ // along with this program. If not, see . #include "PropertyNames.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/BoolProperty.h" -#include "../UESaveFile/Types/ColourStructProperty.h" -#include "../UESaveFile/Types/FloatProperty.h" -#include "../UESaveFile/Types/GenericStructProperty.h" -#include "../UESaveFile/Types/RotatorStructProperty.h" -#include "../UESaveFile/Types/VectorStructProperty.h" -#include "../UESaveFile/Types/Vector2DStructProperty.h" -#include "../UESaveFile/Types/IntProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/BoolProperty.h" +#include "../Gvas/Types/ColourStructProperty.h" +#include "../Gvas/Types/FloatProperty.h" +#include "../Gvas/Types/GenericStructProperty.h" +#include "../Gvas/Types/RotatorStructProperty.h" +#include "../Gvas/Types/VectorStructProperty.h" +#include "../Gvas/Types/Vector2DStructProperty.h" +#include "../Gvas/Types/IntProperty.h" #include "Mass.h" using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + void -Mass::getDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { +Mass::getDecals(Containers::ArrayView decals, Gvas::Types::ArrayProperty* decal_array) { for(std::uint32_t i = 0; i < decal_array->items.size(); i++) { - auto decal_prop = decal_array->at(i); + auto decal_prop = decal_array->at(i); CORRADE_INTERNAL_ASSERT(decal_prop); auto& decal = decals[i]; - decal.id = decal_prop->at(MASS_DECAL_ID)->value; - auto colour_prop = decal_prop->at(MASS_DECAL_COLOUR); + decal.id = decal_prop->at(MASS_DECAL_ID)->value; + auto colour_prop = decal_prop->at(MASS_DECAL_COLOUR); decal.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a}; - auto pos_prop = decal_prop->at(MASS_DECAL_POSITION); + auto pos_prop = decal_prop->at(MASS_DECAL_POSITION); decal.position = Vector3{pos_prop->x, pos_prop->y, pos_prop->z}; - auto u_prop = decal_prop->at(MASS_DECAL_UAXIS); + auto u_prop = decal_prop->at(MASS_DECAL_UAXIS); decal.uAxis = Vector3{u_prop->x, u_prop->y, u_prop->z}; - auto v_prop = decal_prop->at(MASS_DECAL_VAXIS); + auto v_prop = decal_prop->at(MASS_DECAL_VAXIS); decal.vAxis = Vector3{v_prop->x, v_prop->y, v_prop->z}; - auto offset_prop = decal_prop->at(MASS_DECAL_OFFSET); + auto offset_prop = decal_prop->at(MASS_DECAL_OFFSET); decal.offset = Vector2{offset_prop->x, offset_prop->y}; - decal.scale = decal_prop->at(MASS_DECAL_SCALE)->value; - decal.rotation = decal_prop->at(MASS_DECAL_ROTATION)->value; - decal.flip = decal_prop->at(MASS_DECAL_FLIP)->value; - decal.wrap = decal_prop->at(MASS_DECAL_WRAP)->value; + decal.scale = decal_prop->at(MASS_DECAL_SCALE)->value; + decal.rotation = decal_prop->at(MASS_DECAL_ROTATION)->value; + decal.flip = decal_prop->at(MASS_DECAL_FLIP)->value; + decal.wrap = decal_prop->at(MASS_DECAL_WRAP)->value; } } void -Mass::writeDecals(Containers::ArrayView decals, ArrayProperty* decal_array) { +Mass::writeDecals(Containers::ArrayView decals, Gvas::Types::ArrayProperty* decal_array) { for(std::uint32_t i = 0; i < decal_array->items.size(); i++) { - auto decal_prop = decal_array->at(i); + auto decal_prop = decal_array->at(i); CORRADE_INTERNAL_ASSERT(decal_prop); auto& decal = decals[i]; - decal_prop->at(MASS_DECAL_ID)->value = decal.id; - auto colour_prop = decal_prop->at(MASS_DECAL_COLOUR); + decal_prop->at(MASS_DECAL_ID)->value = decal.id; + auto colour_prop = decal_prop->at(MASS_DECAL_COLOUR); colour_prop->r = decal.colour.r(); colour_prop->g = decal.colour.g(); colour_prop->b = decal.colour.b(); colour_prop->a = decal.colour.a(); - auto pos_prop = decal_prop->at(MASS_DECAL_POSITION); + auto pos_prop = decal_prop->at(MASS_DECAL_POSITION); pos_prop->x = decal.position.x(); pos_prop->y = decal.position.y(); pos_prop->z = decal.position.z(); - auto u_prop = decal_prop->at(MASS_DECAL_UAXIS); + auto u_prop = decal_prop->at(MASS_DECAL_UAXIS); u_prop->x = decal.uAxis.x(); u_prop->y = decal.uAxis.y(); u_prop->z = decal.uAxis.z(); - auto v_prop = decal_prop->at(MASS_DECAL_VAXIS); + auto v_prop = decal_prop->at(MASS_DECAL_VAXIS); v_prop->x = decal.vAxis.x(); v_prop->y = decal.vAxis.y(); v_prop->z = decal.vAxis.z(); - auto offset_prop = decal_prop->at(MASS_DECAL_OFFSET); + auto offset_prop = decal_prop->at(MASS_DECAL_OFFSET); offset_prop->x = decal.offset.x(); offset_prop->y = decal.offset.y(); - decal_prop->at(MASS_DECAL_SCALE)->value = decal.scale; - decal_prop->at(MASS_DECAL_ROTATION)->value = decal.rotation; - decal_prop->at(MASS_DECAL_FLIP)->value = decal.flip; - decal_prop->at(MASS_DECAL_WRAP)->value = decal.wrap; + decal_prop->at(MASS_DECAL_SCALE)->value = decal.scale; + decal_prop->at(MASS_DECAL_ROTATION)->value = decal.rotation; + decal_prop->at(MASS_DECAL_FLIP)->value = decal.flip; + decal_prop->at(MASS_DECAL_WRAP)->value = decal.wrap; } } void -Mass::getAccessories(Containers::ArrayView accessories, ArrayProperty* accessory_array) { +Mass::getAccessories(Containers::ArrayView accessories, Gvas::Types::ArrayProperty* accessory_array) { for(std::uint32_t i = 0; i < accessory_array->items.size(); i++) { - auto acc_prop = accessory_array->at(i); + auto acc_prop = accessory_array->at(i); CORRADE_INTERNAL_ASSERT(acc_prop); auto& accessory = accessories[i]; - accessory.attachIndex = acc_prop->at(MASS_ACCESSORY_ATTACH_INDEX)->value; - accessory.id = acc_prop->at(MASS_ACCESSORY_ID)->value; - auto acc_styles = acc_prop->at(MASS_ACCESSORY_STYLES); + accessory.attachIndex = acc_prop->at(MASS_ACCESSORY_ATTACH_INDEX)->value; + accessory.id = acc_prop->at(MASS_ACCESSORY_ID)->value; + auto acc_styles = acc_prop->at(MASS_ACCESSORY_STYLES); for(std::uint32_t j = 0; j < acc_styles->items.size(); j++) { - accessory.styles[j] = acc_styles->at(j)->value; + accessory.styles[j] = acc_styles->at(j)->value; } - auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); + auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); accessory.relativePosition = Vector3{rel_pos_prop->x, rel_pos_prop->y, rel_pos_prop->z}; - auto rel_pos_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFPOS); + auto rel_pos_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFPOS); accessory.relativePositionOffset = Vector3{rel_pos_offset_prop->x, rel_pos_offset_prop->y, rel_pos_offset_prop->z}; - auto rel_rot_prop = acc_prop->at(MASS_ACCESSORY_RELROT); + auto rel_rot_prop = acc_prop->at(MASS_ACCESSORY_RELROT); accessory.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z}; - auto rel_rot_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFROT); + auto rel_rot_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFROT); accessory.relativeRotationOffset = Vector3{rel_rot_offset_prop->x, rel_rot_offset_prop->y, rel_rot_offset_prop->z}; - auto local_scale_prop = acc_prop->at(MASS_ACCESSORY_SCALE); + auto local_scale_prop = acc_prop->at(MASS_ACCESSORY_SCALE); accessory.localScale = Vector3{local_scale_prop->x, local_scale_prop->y, local_scale_prop->z}; } } void -Mass::writeAccessories(Containers::ArrayView accessories, ArrayProperty* accs_array) { +Mass::writeAccessories(Containers::ArrayView accessories, Gvas::Types::ArrayProperty* accs_array) { for(std::uint32_t i = 0; i < accs_array->items.size(); i++) { - auto acc_prop = accs_array->at(i); + auto acc_prop = accs_array->at(i); CORRADE_INTERNAL_ASSERT(acc_prop); auto& accessory = accessories[i]; - acc_prop->at(MASS_ACCESSORY_ATTACH_INDEX)->value = accessory.attachIndex; - acc_prop->at(MASS_ACCESSORY_ID)->value = accessory.id; - auto acc_styles = acc_prop->at(MASS_ACCESSORY_STYLES); + acc_prop->at(MASS_ACCESSORY_ATTACH_INDEX)->value = accessory.attachIndex; + acc_prop->at(MASS_ACCESSORY_ID)->value = accessory.id; + auto acc_styles = acc_prop->at(MASS_ACCESSORY_STYLES); for(std::uint32_t j = 0; j < acc_styles->items.size(); j++) { - acc_styles->at(j)->value = accessory.styles[j]; + acc_styles->at(j)->value = accessory.styles[j]; } - auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); + auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); rel_pos_prop->x = accessory.relativePosition.x(); rel_pos_prop->y = accessory.relativePosition.y(); rel_pos_prop->z = accessory.relativePosition.z(); - auto rel_pos_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFPOS); + auto rel_pos_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFPOS); rel_pos_offset_prop->x = accessory.relativePositionOffset.x(); rel_pos_offset_prop->y = accessory.relativePositionOffset.y(); rel_pos_offset_prop->z = accessory.relativePositionOffset.z(); - auto rel_rot_prop = acc_prop->at(MASS_ACCESSORY_RELROT); + auto rel_rot_prop = acc_prop->at(MASS_ACCESSORY_RELROT); rel_rot_prop->x = accessory.relativeRotation.x(); rel_rot_prop->y = accessory.relativeRotation.y(); rel_rot_prop->z = accessory.relativeRotation.z(); - auto rel_rot_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFROT); + auto rel_rot_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFROT); rel_rot_offset_prop->x = accessory.relativeRotationOffset.x(); rel_rot_offset_prop->y = accessory.relativeRotationOffset.y(); rel_rot_offset_prop->z = accessory.relativeRotationOffset.z(); - auto local_scale_prop = acc_prop->at(MASS_ACCESSORY_SCALE); + auto local_scale_prop = acc_prop->at(MASS_ACCESSORY_SCALE); local_scale_prop->x = accessory.localScale.x(); local_scale_prop->y = accessory.localScale.y(); local_scale_prop->z = accessory.localScale.z(); } } + +}} diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index 510bcdb..1c44096 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -16,16 +16,18 @@ #include "PropertyNames.h" #include "../Logger/Logger.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/ColourStructProperty.h" -#include "../UESaveFile/Types/FloatProperty.h" -#include "../UESaveFile/Types/GenericStructProperty.h" -#include "../UESaveFile/Types/IntProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/ColourStructProperty.h" +#include "../Gvas/Types/FloatProperty.h" +#include "../Gvas/Types/GenericStructProperty.h" +#include "../Gvas/Types/IntProperty.h" #include "Mass.h" using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + Joints& Mass::jointSliders() { return _frame.joints; @@ -35,35 +37,35 @@ void Mass::getJointSliders() { LOG_INFO("Getting joint sliders."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto frame_prop = unit_data->at(MASS_FRAME); + auto frame_prop = unit_data->at(MASS_FRAME); if(!frame_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME, _filename); _state = State::Invalid; return; } - auto length = frame_prop->at(MASS_JOINT_NECK); + auto length = frame_prop->at(MASS_JOINT_NECK); _frame.joints.neck = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_BODY); + length = frame_prop->at(MASS_JOINT_BODY); _frame.joints.body = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_SHOULDER); + length = frame_prop->at(MASS_JOINT_SHOULDER); _frame.joints.shoulders = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_HIP); + length = frame_prop->at(MASS_JOINT_HIP); _frame.joints.hips = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_ARM_UPPER); + length = frame_prop->at(MASS_JOINT_ARM_UPPER); _frame.joints.upperArms = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_ARM_LOWER); + length = frame_prop->at(MASS_JOINT_ARM_LOWER); _frame.joints.lowerArms = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_LEG_UPPER); + length = frame_prop->at(MASS_JOINT_LEG_UPPER); _frame.joints.upperLegs = (length ? length->value : 0.0f); - length = frame_prop->at(MASS_JOINT_LEG_LOWER); + length = frame_prop->at(MASS_JOINT_LEG_LOWER); _frame.joints.lowerLegs = (length ? length->value : 0.0f); } @@ -71,7 +73,7 @@ bool Mass::writeJointSliders() { LOG_INFO("Writing joint sliders"); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in "_s + _filename; LOG_ERROR(_lastError); @@ -79,7 +81,7 @@ Mass::writeJointSliders() { return false; } - auto frame_prop = unit_data->at(MASS_FRAME); + auto frame_prop = unit_data->at(MASS_FRAME); if(!frame_prop) { _lastError = "No frame data in "_s + _filename; @@ -88,9 +90,9 @@ Mass::writeJointSliders() { return false; } - Containers::Array temp; + Containers::Array temp; - auto length = frame_prop->atMove(MASS_JOINT_NECK); + auto length = frame_prop->atMove(MASS_JOINT_NECK); if(_frame.joints.neck != 0.0f) { if(!length) { length.emplace(); @@ -100,7 +102,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_BODY); + length = frame_prop->atMove(MASS_JOINT_BODY); if(_frame.joints.body != 0.0f) { if(!length) { length.emplace(); @@ -110,7 +112,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_SHOULDER); + length = frame_prop->atMove(MASS_JOINT_SHOULDER); if(_frame.joints.shoulders != 0.0f) { if(!length) { length.emplace(); @@ -120,7 +122,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_ARM_UPPER); + length = frame_prop->atMove(MASS_JOINT_ARM_UPPER); if(_frame.joints.upperArms != 0.0f) { if(!length) { length.emplace(); @@ -130,7 +132,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_ARM_LOWER); + length = frame_prop->atMove(MASS_JOINT_ARM_LOWER); if(_frame.joints.lowerArms != 0.0f) { if(!length) { length.emplace(); @@ -140,7 +142,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_HIP); + length = frame_prop->atMove(MASS_JOINT_HIP); if(_frame.joints.hips != 0.0f) { if(!length) { length.emplace(); @@ -150,7 +152,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_LEG_UPPER); + length = frame_prop->atMove(MASS_JOINT_LEG_UPPER); if(_frame.joints.upperLegs != 0.0f) { if(!length) { length.emplace(); @@ -160,7 +162,7 @@ Mass::writeJointSliders() { arrayAppend(temp, std::move(length)); } - length = frame_prop->atMove(MASS_JOINT_LEG_LOWER); + length = frame_prop->atMove(MASS_JOINT_LEG_LOWER); if(_frame.joints.lowerLegs != 0.0f) { if(!length) { length.emplace(); @@ -193,21 +195,21 @@ void Mass::getFrameStyles() { LOG_INFO("Getting frame styles."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto frame_prop = unit_data->at(MASS_FRAME); + auto frame_prop = unit_data->at(MASS_FRAME); if(!frame_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME, _filename); _state = State::Invalid; return; } - auto frame_styles = frame_prop->at(MASS_FRAME_STYLES); + auto frame_styles = frame_prop->at(MASS_FRAME_STYLES); if(!frame_styles) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME_STYLES, _filename); _state = State::Invalid; @@ -222,7 +224,7 @@ Mass::getFrameStyles() { } for(std::uint32_t i = 0; i < frame_styles->items.size(); i++) { - _frame.styles[i] = frame_styles->at(i)->value; + _frame.styles[i] = frame_styles->at(i)->value; } } @@ -230,7 +232,7 @@ bool Mass::writeFrameStyles() { LOG_INFO("Writing frame styles."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in "_s + _filename; LOG_ERROR(_lastError); @@ -238,7 +240,7 @@ Mass::writeFrameStyles() { return false; } - auto frame = unit_data->at(MASS_FRAME); + auto frame = unit_data->at(MASS_FRAME); if(!frame) { _lastError = "No frame data in "_s + _filename; LOG_ERROR(_lastError); @@ -246,7 +248,7 @@ Mass::writeFrameStyles() { return false; } - auto frame_styles = frame->at(MASS_FRAME_STYLES); + auto frame_styles = frame->at(MASS_FRAME_STYLES); if(!frame_styles) { _lastError = "No frame styles in "_s + _filename; LOG_ERROR(_lastError); @@ -255,7 +257,7 @@ Mass::writeFrameStyles() { } for(std::uint32_t i = 0; i < frame_styles->items.size(); i++) { - frame_styles->at(i)->value = _frame.styles[i]; + frame_styles->at(i)->value = _frame.styles[i]; } if(!_mass->saveToFile()) { @@ -275,21 +277,21 @@ void Mass::getEyeFlareColour() { LOG_INFO("Getting the eye flare colour."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto frame_prop = unit_data->at(MASS_FRAME); + auto frame_prop = unit_data->at(MASS_FRAME); if(!frame_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_FRAME, _filename); _state = State::Invalid; return; } - auto eye_flare_prop = frame_prop->at(MASS_EYE_FLARE); + auto eye_flare_prop = frame_prop->at(MASS_EYE_FLARE); if(!eye_flare_prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_EYE_FLARE, _filename); _state = State::Invalid; @@ -303,7 +305,7 @@ bool Mass::writeEyeFlareColour() { LOG_INFO("Writing the eye flare colour."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in "_s + _filename; LOG_ERROR(_lastError); @@ -311,7 +313,7 @@ Mass::writeEyeFlareColour() { return false; } - auto frame = unit_data->at(MASS_FRAME); + auto frame = unit_data->at(MASS_FRAME); if(!frame) { _lastError = "No frame data in "_s + _filename; LOG_ERROR(_lastError); @@ -319,7 +321,7 @@ Mass::writeEyeFlareColour() { return false; } - auto eye_flare_prop = frame->at(MASS_EYE_FLARE); + auto eye_flare_prop = frame->at(MASS_EYE_FLARE); if(!eye_flare_prop) { _lastError = "No eye flare property in "_s + _filename; LOG_ERROR(_lastError); @@ -349,14 +351,14 @@ void Mass::getFrameCustomStyles() { LOG_INFO("Getting the frame's custom styles."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto frame_styles = unit_data->at(MASS_CUSTOM_FRAME_STYLES); + auto frame_styles = unit_data->at(MASS_CUSTOM_FRAME_STYLES); if(!frame_styles) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_CUSTOM_FRAME_STYLES, _filename); _state = State::Invalid; @@ -383,7 +385,7 @@ Mass::writeFrameCustomStyle(std::size_t index) { return false; } - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in "_s + _filename; LOG_ERROR(_lastError); @@ -391,7 +393,7 @@ Mass::writeFrameCustomStyle(std::size_t index) { return false; } - auto frame_styles = unit_data->at(MASS_CUSTOM_FRAME_STYLES); + auto frame_styles = unit_data->at(MASS_CUSTOM_FRAME_STYLES); if(!frame_styles) { _lastError = "No frame styles in "_s + _filename; LOG_ERROR(_lastError); @@ -401,3 +403,5 @@ Mass::writeFrameCustomStyle(std::size_t index) { return writeCustomStyle(_frame.customStyles[index], index, frame_styles); } + +}} diff --git a/src/Mass/Mass_Styles.cpp b/src/Mass/Mass_Styles.cpp index ea22921..48a3f94 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/Mass/Mass_Styles.cpp @@ -16,17 +16,19 @@ #include "PropertyNames.h" #include "../Logger/Logger.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/ColourStructProperty.h" -#include "../UESaveFile/Types/FloatProperty.h" -#include "../UESaveFile/Types/GenericStructProperty.h" -#include "../UESaveFile/Types/IntProperty.h" -#include "../UESaveFile/Types/StringProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/ColourStructProperty.h" +#include "../Gvas/Types/FloatProperty.h" +#include "../Gvas/Types/GenericStructProperty.h" +#include "../Gvas/Types/IntProperty.h" +#include "../Gvas/Types/StringProperty.h" #include "Mass.h" using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + Containers::ArrayView Mass::globalStyles() { return _globalStyles; @@ -36,14 +38,14 @@ void Mass::getGlobalStyles() { LOG_INFO("Getting global styles."); - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto global_styles = unit_data->at(MASS_GLOBAL_STYLES); + auto global_styles = unit_data->at(MASS_GLOBAL_STYLES); if(!global_styles) { LOG_WARNING_FORMAT("Couldn't find global styles in {}.", _filename); _globalStyles = Containers::Array{0}; @@ -67,7 +69,7 @@ Mass::writeGlobalStyle(std::size_t index) { return false; } - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data found in "_s + _filename; LOG_ERROR(_lastError); @@ -75,7 +77,7 @@ Mass::writeGlobalStyle(std::size_t index) { return false; } - auto global_styles = unit_data->at(MASS_GLOBAL_STYLES); + auto global_styles = unit_data->at(MASS_GLOBAL_STYLES); if(!global_styles) { _lastError = "No global styles found in "_s + _filename; LOG_ERROR(_lastError); @@ -87,59 +89,59 @@ Mass::writeGlobalStyle(std::size_t index) { } void -Mass::getCustomStyles(Containers::ArrayView styles, ArrayProperty* style_array) { +Mass::getCustomStyles(Containers::ArrayView styles, Gvas::Types::ArrayProperty* style_array) { for(std::uint32_t i = 0; i < style_array->items.size(); i++) { - auto style_prop = style_array->at(i); + auto style_prop = style_array->at(i); auto& style = styles[i]; - style.name = style_prop->at(MASS_STYLE_NAME)->value; - auto colour_prop = style_prop->at(MASS_STYLE_COLOUR); + style.name = style_prop->at(MASS_STYLE_NAME)->value; + auto colour_prop = style_prop->at(MASS_STYLE_COLOUR); style.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a}; - style.metallic = style_prop->at(MASS_STYLE_METALLIC)->value; - style.gloss = style_prop->at(MASS_STYLE_GLOSS)->value; + style.metallic = style_prop->at(MASS_STYLE_METALLIC)->value; + style.gloss = style_prop->at(MASS_STYLE_GLOSS)->value; style.glow = colour_prop->a != 0.0f; - style.patternId = style_prop->at(MASS_STYLE_PATTERN_ID)->value; - style.opacity = style_prop->at(MASS_STYLE_PATTERN_OPACITY)->value; + style.patternId = style_prop->at(MASS_STYLE_PATTERN_ID)->value; + style.opacity = style_prop->at(MASS_STYLE_PATTERN_OPACITY)->value; style.offset = Vector2{ - style_prop->at(MASS_STYLE_PATTERN_OFFSETX)->value, - style_prop->at(MASS_STYLE_PATTERN_OFFSETY)->value + style_prop->at(MASS_STYLE_PATTERN_OFFSETX)->value, + style_prop->at(MASS_STYLE_PATTERN_OFFSETY)->value }; - style.rotation = style_prop->at(MASS_STYLE_PATTERN_ROTATION)->value; - style.scale = style_prop->at(MASS_STYLE_PATTERN_SCALE)->value; + style.rotation = style_prop->at(MASS_STYLE_PATTERN_ROTATION)->value; + style.scale = style_prop->at(MASS_STYLE_PATTERN_SCALE)->value; } } bool -Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayProperty* style_array) { +Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, Gvas::Types::ArrayProperty* style_array) { if(!style_array) { _lastError = "style_array is null."_s; LOG_ERROR(_lastError); return false; } - auto style_prop = style_array->at(index); + auto style_prop = style_array->at(index); if(!style_prop) { _lastError = "Style index is out of range in "_s + _filename; LOG_ERROR(_lastError); return false; } - style_prop->at(MASS_STYLE_NAME)->value = style.name; - auto colour_prop = style_prop->at(MASS_STYLE_COLOUR); + style_prop->at(MASS_STYLE_NAME)->value = style.name; + auto colour_prop = style_prop->at(MASS_STYLE_COLOUR); colour_prop->r = style.colour.r(); colour_prop->g = style.colour.g(); colour_prop->b = style.colour.b(); colour_prop->a = style.glow ? 1.0f : 0.0f; - style_prop->at(MASS_STYLE_METALLIC)->value = style.metallic; - style_prop->at(MASS_STYLE_GLOSS)->value = style.gloss; + style_prop->at(MASS_STYLE_METALLIC)->value = style.metallic; + style_prop->at(MASS_STYLE_GLOSS)->value = style.gloss; - style_prop->at(MASS_STYLE_PATTERN_ID)->value = style.patternId; - style_prop->at(MASS_STYLE_PATTERN_OPACITY)->value = style.opacity; - style_prop->at(MASS_STYLE_PATTERN_OFFSETX)->value = style.offset.x(); - style_prop->at(MASS_STYLE_PATTERN_OFFSETY)->value = style.offset.y(); - style_prop->at(MASS_STYLE_PATTERN_ROTATION)->value = style.rotation; - style_prop->at(MASS_STYLE_PATTERN_SCALE)->value = style.scale; + style_prop->at(MASS_STYLE_PATTERN_ID)->value = style.patternId; + style_prop->at(MASS_STYLE_PATTERN_OPACITY)->value = style.opacity; + style_prop->at(MASS_STYLE_PATTERN_OFFSETX)->value = style.offset.x(); + style_prop->at(MASS_STYLE_PATTERN_OFFSETY)->value = style.offset.y(); + style_prop->at(MASS_STYLE_PATTERN_ROTATION)->value = style.rotation; + style_prop->at(MASS_STYLE_PATTERN_SCALE)->value = style.scale; if(!_mass->saveToFile()) { _lastError = _mass->lastError(); @@ -148,3 +150,5 @@ Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, ArrayPropert return true; } + +}} diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index ba21459..11a5ca6 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -16,18 +16,20 @@ #include "PropertyNames.h" #include "../Logger/Logger.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/BoolProperty.h" -#include "../UESaveFile/Types/ByteProperty.h" -#include "../UESaveFile/Types/ColourStructProperty.h" -#include "../UESaveFile/Types/GenericStructProperty.h" -#include "../UESaveFile/Types/IntProperty.h" -#include "../UESaveFile/Types/StringProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/BoolProperty.h" +#include "../Gvas/Types/ByteProperty.h" +#include "../Gvas/Types/ColourStructProperty.h" +#include "../Gvas/Types/GenericStructProperty.h" +#include "../Gvas/Types/IntProperty.h" +#include "../Gvas/Types/StringProperty.h" #include "Mass.h" using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + Containers::ArrayView Mass::meleeWeapons() { return _weapons.melee; @@ -132,14 +134,14 @@ Mass::writeEnergyLaunchers() { void Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) { - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", MASS_UNIT_DATA, _filename); _state = State::Invalid; return; } - auto prop = unit_data->at(prop_name); + auto prop = unit_data->at(prop_name); if(!prop) { LOG_ERROR_FORMAT("Couldn't find {} in {}.", prop_name, _filename); _state = State::Invalid; @@ -154,12 +156,12 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(i); + auto weapon_prop = prop->at(i); auto& weapon = weapon_array[i]; - weapon.name = weapon_prop->at(MASS_WEAPON_NAME)->value; - auto& weapon_type = weapon_prop->at(MASS_WEAPON_TYPE)->enumValue; - #define c(enumerator, strenum, name) if(weapon_type == (strenum)) { weapon.type = WeaponType::enumerator; } else + weapon.name = weapon_prop->at(MASS_WEAPON_NAME)->value; + auto& weapon_type = weapon_prop->at(MASS_WEAPON_TYPE)->enumValue; + #define c(enumerator, strenum, name) if(weapon_type == (strenum)) { weapon.type = Weapon::Type::enumerator; } else #include "../Maps/WeaponTypes.hpp" #undef c { @@ -168,28 +170,28 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_ELEMENT); + auto parts_prop = weapon_prop->at(MASS_WEAPON_ELEMENT); weapon.parts = Containers::Array{ValueInit, parts_prop->items.size()}; for(std::uint32_t j = 0; j < parts_prop->items.size(); j++) { - auto part_prop = parts_prop->at(j); + auto part_prop = parts_prop->at(j); auto& part = weapon.parts[j]; - part.id = part_prop->at(MASS_WEAPON_PART_ID)->value; + part.id = part_prop->at(MASS_WEAPON_PART_ID)->value; - auto part_styles = part_prop->at(MASS_WEAPON_PART_STYLES); + auto part_styles = part_prop->at(MASS_WEAPON_PART_STYLES); for(std::uint32_t k = 0; k < part_styles->items.size(); k++) { - part.styles[k] = part_styles->at(k)->value; + part.styles[k] = part_styles->at(k)->value; } - auto part_decals = part_prop->at(MASS_WEAPON_PART_DECALS); + auto part_decals = part_prop->at(MASS_WEAPON_PART_DECALS); if(part_decals->items.size() != part.decals.size()) { part.decals = Containers::Array{part_decals->items.size()}; } getDecals(part.decals, part_decals); - auto part_accs = part_prop->at(MASS_WEAPON_PART_ACCESSORIES); + auto part_accs = part_prop->at(MASS_WEAPON_PART_ACCESSORIES); if(!part_accs) { part.accessories = Containers::Array{0}; continue; @@ -201,7 +203,7 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_CUSTOM_WEAPON_STYLES); + auto custom_styles = weapon_prop->at(MASS_CUSTOM_WEAPON_STYLES); if(!custom_styles) { LOG_ERROR_FORMAT("Can't find weapon custom styles in {}", _filename); _state = State::Invalid; @@ -217,9 +219,9 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_ATTACH)->value; - auto& damage_type = weapon_prop->at(MASS_WEAPON_DAMAGE_TYPE)->enumValue; - #define c(enumerator, strenum) if(damage_type == (strenum)) { weapon.damageType = DamageType::enumerator; } else + weapon.attached = weapon_prop->at(MASS_WEAPON_ATTACH)->value; + auto& damage_type = weapon_prop->at(MASS_WEAPON_DAMAGE_TYPE)->enumValue; + #define c(enumerator, strenum) if(damage_type == (strenum)) { weapon.damageType = Weapon::DamageType::enumerator; } else #include "../Maps/DamageTypes.hpp" #undef c { @@ -227,9 +229,9 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_DUAL_WIELD)->value; - auto& effect_colour_mode = weapon_prop->at(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue; - #define c(enumerator, strenum) if(effect_colour_mode == (strenum)) { weapon.effectColourMode = EffectColourMode::enumerator; } else + weapon.dualWield = weapon_prop->at(MASS_WEAPON_DUAL_WIELD)->value; + auto& effect_colour_mode = weapon_prop->at(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue; + #define c(enumerator, strenum) if(effect_colour_mode == (strenum)) { weapon.effectColourMode = Weapon::EffectColourMode::enumerator; } else #include "../Maps/EffectColourModes.hpp" #undef c { @@ -237,14 +239,14 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_COLOUR_EFX); + auto effect_colour = weapon_prop->at(MASS_WEAPON_COLOUR_EFX); weapon.effectColour = Color4{effect_colour->r, effect_colour->g, effect_colour->b, effect_colour->a}; } } bool Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView weapon_array) { - auto unit_data = _mass->at(MASS_UNIT_DATA); + auto unit_data = _mass->at(MASS_UNIT_DATA); if(!unit_data) { _lastError = "No unit data in "_s + _filename; LOG_ERROR(_lastError); @@ -252,7 +254,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(prop_name); + auto prop = unit_data->at(prop_name); if(!prop) { _lastError = prop_name + " not found in "_s + _filename; LOG_ERROR(_lastError); @@ -269,12 +271,12 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(i); + auto weapon_prop = prop->at(i); auto& weapon = weapon_array[i]; - weapon_prop->at(MASS_WEAPON_NAME)->value = weapon.name; + weapon_prop->at(MASS_WEAPON_NAME)->value = weapon.name; switch(weapon.type) { - #define c(enumerator, strenum, name) case WeaponType::enumerator: weapon_prop->at(MASS_WEAPON_TYPE)->enumValue = strenum; break; + #define c(enumerator, strenum, name) case Weapon::Type::enumerator: weapon_prop->at(MASS_WEAPON_TYPE)->enumValue = strenum; break; #include "../Maps/WeaponTypes.hpp" #undef c default: @@ -283,7 +285,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_ELEMENT); + auto parts_prop = weapon_prop->at(MASS_WEAPON_ELEMENT); if(parts_prop->items.size() != weapon.parts.size()) { _lastError = Utility::format("Weapon part arrays are not of the same size. Expected {}, got {} instead.", weapon.parts.size(), parts_prop->items.size()); @@ -293,20 +295,20 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewitems.size(); j++) { - auto part_prop = parts_prop->at(j); + auto part_prop = parts_prop->at(j); auto& part = weapon.parts[j]; - part_prop->at(MASS_WEAPON_PART_ID)->value = part.id; + part_prop->at(MASS_WEAPON_PART_ID)->value = part.id; - auto part_styles = part_prop->at(MASS_WEAPON_PART_STYLES); + auto part_styles = part_prop->at(MASS_WEAPON_PART_STYLES); for(std::uint32_t k = 0; k < part_styles->items.size(); k++) { - part_styles->at(k)->value = part.styles[k]; + part_styles->at(k)->value = part.styles[k]; } - auto part_decals = part_prop->at(MASS_WEAPON_PART_DECALS); + auto part_decals = part_prop->at(MASS_WEAPON_PART_DECALS); writeDecals(part.decals, part_decals); - auto part_accs = part_prop->at(MASS_WEAPON_PART_ACCESSORIES); + auto part_accs = part_prop->at(MASS_WEAPON_PART_ACCESSORIES); if(!part_accs) { continue; } @@ -322,7 +324,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_CUSTOM_WEAPON_STYLES); + auto custom_styles = weapon_prop->at(MASS_CUSTOM_WEAPON_STYLES); if(!custom_styles) { _lastError = "No custom styles found for weapon."_s; LOG_ERROR(_lastError); @@ -342,9 +344,9 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_ATTACH)->value = weapon.attached; + weapon_prop->at(MASS_WEAPON_ATTACH)->value = weapon.attached; switch(weapon.damageType) { - #define c(enumerator, strenum) case DamageType::enumerator: weapon_prop->at(MASS_WEAPON_DAMAGE_TYPE)->enumValue = strenum; break; + #define c(enumerator, strenum) case Weapon::DamageType::enumerator: weapon_prop->at(MASS_WEAPON_DAMAGE_TYPE)->enumValue = strenum; break; #include "../Maps/DamageTypes.hpp" #undef c default: @@ -352,10 +354,10 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_DUAL_WIELD)->value = weapon.dualWield; + weapon_prop->at(MASS_WEAPON_DUAL_WIELD)->value = weapon.dualWield; switch(weapon.effectColourMode) { - #define c(enumerator, enumstr) case EffectColourMode::enumerator: \ - weapon_prop->at(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue = enumstr; \ + #define c(enumerator, enumstr) case Weapon::EffectColourMode::enumerator: \ + weapon_prop->at(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue = enumstr; \ break; #include "../Maps/EffectColourModes.hpp" #undef c @@ -364,7 +366,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_COLOUR_EFX); + auto effect_colour = weapon_prop->at(MASS_WEAPON_COLOUR_EFX); effect_colour->r = weapon.effectColour.r(); effect_colour->g = weapon.effectColour.g(); effect_colour->b = weapon.effectColour.b(); @@ -378,3 +380,5 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayView{other.parts.size()}; @@ -47,3 +50,5 @@ Weapon& Weapon::operator=(const Weapon& other) { return *this; } + +}} diff --git a/src/Mass/Weapon.h b/src/Mass/Weapon.h index 63fc5b1..c8a44a8 100644 --- a/src/Mass/Weapon.h +++ b/src/Mass/Weapon.h @@ -29,19 +29,7 @@ using namespace Corrade; using namespace Magnum; -#define c(enumerator, ...) enumerator, -enum class WeaponType { - #include "../Maps/WeaponTypes.hpp" -}; - -enum class DamageType { - #include "../Maps/DamageTypes.hpp" -}; - -enum class EffectColourMode { - #include "../Maps/EffectColourModes.hpp" -}; -#undef c +namespace mbst { namespace GameObjects { struct Weapon { Weapon() = default; @@ -52,8 +40,20 @@ struct Weapon { Weapon(Weapon&& other) = default; Weapon& operator=(Weapon&& other) = default; + #define c(enumerator, ...) enumerator, + enum class Type { + #include "../Maps/WeaponTypes.hpp" + }; + enum class DamageType { + #include "../Maps/DamageTypes.hpp" + }; + enum class EffectColourMode { + #include "../Maps/EffectColourModes.hpp" + }; + #undef c + Containers::String name; - WeaponType type = WeaponType::Melee; + Type type = Type::Melee; Containers::Array parts; Containers::StaticArray<16, CustomStyle> customStyles{ValueInit}; bool attached = false; @@ -62,3 +62,5 @@ struct Weapon { EffectColourMode effectColourMode = EffectColourMode::Default; Color4 effectColour{0.0f}; }; + +}} diff --git a/src/Mass/WeaponPart.h b/src/Mass/WeaponPart.h index 2afdd0f..2340baf 100644 --- a/src/Mass/WeaponPart.h +++ b/src/Mass/WeaponPart.h @@ -24,6 +24,8 @@ using namespace Corrade; +namespace mbst { namespace GameObjects { + struct WeaponPart { WeaponPart() = default; @@ -61,3 +63,5 @@ struct WeaponPart { Containers::Array decals{}; Containers::Array accessories{}; }; + +}} diff --git a/src/MassManager/MassManager.cpp b/src/MassManager/MassManager.cpp index 9b21197..7753e00 100644 --- a/src/MassManager/MassManager.cpp +++ b/src/MassManager/MassManager.cpp @@ -25,6 +25,8 @@ using namespace Containers::Literals; +namespace mbst { + MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir): _saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir} @@ -33,7 +35,7 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie for(std::uint32_t i = 0; i < _hangars.size(); i++) { mass_filename = Utility::Path::join(_saveDirectory, Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account)); - new(&_hangars[i]) Mass{mass_filename}; + new(&_hangars[i]) GameObjects::Mass{mass_filename}; } refreshStagedMasses(); @@ -44,7 +46,7 @@ MassManager::lastError() { return _lastError; } -Mass& +GameObjects::Mass& MassManager::hangar(std::int32_t hangar) { return _hangars[hangar]; } @@ -60,7 +62,7 @@ MassManager::refreshHangar(std::int32_t hangar) { Containers::String mass_filename = Utility::Path::join(_saveDirectory, Utility::format("{}Unit{:.2d}{}.sav", _demo ? "Demo" : "", hangar, _account)); - _hangars[hangar] = Mass{mass_filename}; + _hangars[hangar] = GameObjects::Mass{mass_filename}; } bool @@ -83,7 +85,7 @@ MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { Utility::Path::copy(source, source + ".tmp"_s); { - Mass mass{source + ".tmp"_s}; + GameObjects::Mass mass{source + ".tmp"_s}; if(!mass.updateAccount(_account)) { _lastError = mass.lastError(); Utility::Path::remove(source + ".tmp"_s); @@ -114,7 +116,7 @@ MassManager::exportMass(std::int32_t hangar) { return false; } - if(_hangars[hangar].state() != Mass::State::Valid) { + if(_hangars[hangar].state() != GameObjects::Mass::State::Valid) { _lastError = Utility::format("There is no valid data to export in hangar {:.2d}", hangar + 1); LOG_ERROR(_lastError); return false; @@ -149,22 +151,22 @@ MassManager::moveMass(std::int32_t source, std::int32_t destination) { Containers::String source_file = Utility::Path::join(_saveDirectory, _hangars[source].filename()); Containers::String dest_file = Utility::Path::join(_saveDirectory, _hangars[destination].filename()); - Mass::State dest_state = _hangars[destination].state(); + GameObjects::Mass::State dest_state = _hangars[destination].state(); switch(dest_state) { - case Mass::State::Empty: + case GameObjects::Mass::State::Empty: break; - case Mass::State::Invalid: + case GameObjects::Mass::State::Invalid: Utility::Path::remove(dest_file); break; - case Mass::State::Valid: + case GameObjects::Mass::State::Valid: Utility::Path::move(dest_file, dest_file + ".tmp"_s); break; } Utility::Path::move(source_file, dest_file); - if(dest_state == Mass::State::Valid) { + if(dest_state == GameObjects::Mass::State::Valid) { Utility::Path::move(dest_file + ".tmp"_s, source_file); } @@ -214,7 +216,7 @@ MassManager::refreshStagedMasses() { LOG_INFO("Scanning for staged M.A.S.S.es..."); for(Containers::StringView file : list_view) { - auto name = Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, file)); + auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, file)); if(name) { LOG_INFO_FORMAT("Found staged M.A.S.S.: {}", *name); @@ -234,7 +236,7 @@ MassManager::refreshStagedMass(Containers::StringView filename) { auto it = _stagedMasses.find(filename); if(file_exists) { - auto name = Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, filename)); + auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, filename)); if(name) { _stagedMasses[filename] = *name; } @@ -263,3 +265,5 @@ MassManager::deleteStagedMass(Containers::StringView filename) { return true; } + +} diff --git a/src/MassManager/MassManager.h b/src/MassManager/MassManager.h index 8ede9aa..708e42e 100644 --- a/src/MassManager/MassManager.h +++ b/src/MassManager/MassManager.h @@ -26,13 +26,15 @@ using namespace Corrade; +namespace mbst { + class MassManager { public: MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); - Containers::StringView lastError(); + auto lastError() -> Containers::StringView; - Mass& hangar(int hangar); + auto hangar(int hangar) -> GameObjects::Mass&; void refreshHangar(int hangar); @@ -42,7 +44,7 @@ class MassManager { bool moveMass(int source, int destination); bool deleteMass(int hangar); - std::map const& stagedMasses(); + auto stagedMasses() -> std::map const&; void refreshStagedMasses(); void refreshStagedMass(Containers::StringView filename); bool deleteStagedMass(Containers::StringView filename); @@ -54,9 +56,11 @@ class MassManager { Containers::String _lastError; - Containers::StaticArray<32, Mass> _hangars{NoInit}; + Containers::StaticArray<32, GameObjects::Mass> _hangars{NoInit}; Containers::StringView _stagingAreaDirectory; std::map _stagedMasses; }; + +} diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index a6a9bd2..bc2fb3a 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -21,16 +21,18 @@ #include "PropertyNames.h" #include "../Logger/Logger.h" -#include "../UESaveFile/Types/ArrayProperty.h" -#include "../UESaveFile/Types/ResourceItemValue.h" -#include "../UESaveFile/Types/IntProperty.h" -#include "../UESaveFile/Types/StringProperty.h" +#include "../Gvas/Types/ArrayProperty.h" +#include "../Gvas/Types/ResourceItemValue.h" +#include "../Gvas/Types/IntProperty.h" +#include "../Gvas/Types/StringProperty.h" #include "Profile.h" using namespace Corrade; using namespace Containers::Literals; +namespace mbst { namespace GameObjects { + Profile::Profile(Containers::StringView path): _profile(path) { @@ -45,13 +47,13 @@ Profile::Profile(Containers::StringView path): _filename = Utility::Path::split(path).second(); if(_filename.hasPrefix("Demo"_s)) { - _type = ProfileType::Demo; + _type = Type::Demo; } else { - _type = ProfileType::FullGame; + _type = Type::FullGame; } - auto account_prop = _profile.at(PROFILE_ACCOUNT); + auto account_prop = _profile.at(PROFILE_ACCOUNT); if(!account_prop) { _lastError = "Couldn't find an account ID in "_s + _filename; _valid = false; @@ -77,14 +79,14 @@ Profile::filename() const { return _filename; } -ProfileType +Profile::Type Profile::type() const { return _type; } bool Profile::isDemo() const { - return _type == ProfileType::Demo; + return _type == Type::Demo; } Containers::StringView @@ -107,7 +109,7 @@ Profile::refreshValues() { } LOG_INFO("Getting the company name."); - auto name_prop = _profile.at(PROFILE_NAME); + auto name_prop = _profile.at(PROFILE_NAME); if(!name_prop) { _lastError = "No company name in "_s + _filename; LOG_ERROR(_lastError); @@ -117,49 +119,49 @@ Profile::refreshValues() { _name = name_prop->value; LOG_INFO("Getting the active frame slot."); - auto prop = _profile.at(PROFILE_ACTIVE_FRAME_SLOT); + auto prop = _profile.at(PROFILE_ACTIVE_FRAME_SLOT); _activeFrameSlot = prop ? prop->value : 0; LOG_INFO("Getting the credits."); - prop = _profile.at(PROFILE_CREDITS); + prop = _profile.at(PROFILE_CREDITS); _credits = prop ? prop->value : 0; LOG_INFO("Getting the story progress."); - prop = _profile.at(PROFILE_STORY_PROGRESS); + prop = _profile.at(PROFILE_STORY_PROGRESS); _storyProgress = prop ? prop->value : 0; LOG_INFO("Getting the last mission ID."); - prop = _profile.at(PROFILE_LAST_MISSION_ID); + prop = _profile.at(PROFILE_LAST_MISSION_ID); _lastMissionId = prop ? prop->value : 0; LOG_INFO("Getting the materials."); - _materials[VerseSteel] = getResource(PROFILE_MATERIAL, VerseSteel); - _materials[Undinium] = getResource(PROFILE_MATERIAL, Undinium); - _materials[NecriumAlloy] = getResource(PROFILE_MATERIAL, NecriumAlloy); - _materials[Lunarite] = getResource(PROFILE_MATERIAL, Lunarite); - _materials[Asterite] = getResource(PROFILE_MATERIAL, Asterite); - _materials[HalliteFragma] = getResource(PROFILE_MATERIAL, HalliteFragma); + _materials[GameData::MaterialID::VerseSteel] = getResource(PROFILE_MATERIAL, GameData::MaterialID::VerseSteel); + _materials[GameData::MaterialID::Undinium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Undinium); + _materials[GameData::MaterialID::NecriumAlloy] = getResource(PROFILE_MATERIAL, GameData::MaterialID::NecriumAlloy); + _materials[GameData::MaterialID::Lunarite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Lunarite); + _materials[GameData::MaterialID::Asterite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Asterite); + _materials[GameData::MaterialID::HalliteFragma] = getResource(PROFILE_MATERIAL, GameData::MaterialID::HalliteFragma); - _materials[Ednil] = getResource(PROFILE_MATERIAL, Ednil); - _materials[Nuflalt] = getResource(PROFILE_MATERIAL, Nuflalt); - _materials[Aurelene] = getResource(PROFILE_MATERIAL, Aurelene); - _materials[Soldus] = getResource(PROFILE_MATERIAL, Soldus); - _materials[SynthesisedN] = getResource(PROFILE_MATERIAL, SynthesisedN); - _materials[Nanoc] = getResource(PROFILE_MATERIAL, Nanoc); + _materials[GameData::MaterialID::Ednil] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Ednil); + _materials[GameData::MaterialID::Nuflalt] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Nuflalt); + _materials[GameData::MaterialID::Aurelene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Aurelene); + _materials[GameData::MaterialID::Soldus] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Soldus); + _materials[GameData::MaterialID::SynthesisedN] = getResource(PROFILE_MATERIAL, GameData::MaterialID::SynthesisedN); + _materials[GameData::MaterialID::Nanoc] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Nanoc); - _materials[Alcarbonite] = getResource(PROFILE_MATERIAL, Alcarbonite); - _materials[Keriphene] = getResource(PROFILE_MATERIAL, Keriphene); - _materials[NitinolCM] = getResource(PROFILE_MATERIAL, NitinolCM); - _materials[Quarkium] = getResource(PROFILE_MATERIAL, Quarkium); - _materials[Alterene] = getResource(PROFILE_MATERIAL, Alterene); - _materials[Cosmium] = getResource(PROFILE_MATERIAL, Cosmium); + _materials[GameData::MaterialID::Alcarbonite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Alcarbonite); + _materials[GameData::MaterialID::Keriphene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Keriphene); + _materials[GameData::MaterialID::NitinolCM] = getResource(PROFILE_MATERIAL, GameData::MaterialID::NitinolCM); + _materials[GameData::MaterialID::Quarkium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Quarkium); + _materials[GameData::MaterialID::Alterene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Alterene); + _materials[GameData::MaterialID::Cosmium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Cosmium); - _materials[MixedComposition] = getResource(PROFILE_QUARK_DATA, MixedComposition); - _materials[VoidResidue] = getResource(PROFILE_QUARK_DATA, VoidResidue); - _materials[MuscularConstruction] = getResource(PROFILE_QUARK_DATA, MuscularConstruction); - _materials[MineralExoskeletology] = getResource(PROFILE_QUARK_DATA, MineralExoskeletology); - _materials[CarbonisedSkin] = getResource(PROFILE_QUARK_DATA, CarbonisedSkin); - _materials[IsolatedVoidParticle] = getResource(PROFILE_QUARK_DATA, IsolatedVoidParticle); + _materials[GameData::MaterialID::MixedComposition] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::MixedComposition); + _materials[GameData::MaterialID::VoidResidue] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::VoidResidue); + _materials[GameData::MaterialID::MuscularConstruction] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::MuscularConstruction); + _materials[GameData::MaterialID::MineralExoskeletology] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::MineralExoskeletology); + _materials[GameData::MaterialID::CarbonisedSkin] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::CarbonisedSkin); + _materials[GameData::MaterialID::IsolatedVoidParticle] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::IsolatedVoidParticle); _valid = true; } @@ -171,7 +173,7 @@ Profile::companyName() const { bool Profile::renameCompany(Containers::StringView new_name) { - auto name_prop = _profile.at(PROFILE_NAME); + auto name_prop = _profile.at(PROFILE_NAME); if(!name_prop) { _lastError = "No company name in "_s + _filename; LOG_ERROR(_lastError); @@ -201,13 +203,13 @@ Profile::credits() const { bool Profile::setCredits(std::int32_t amount) { - auto credits_prop = _profile.at(PROFILE_CREDITS); + auto credits_prop = _profile.at(PROFILE_CREDITS); if(!credits_prop) { - credits_prop = new IntProperty; + credits_prop = new Gvas::Types::IntProperty; credits_prop->name.emplace("Credit"_s); credits_prop->valueLength = sizeof(std::int32_t); - _profile.appendProperty(IntProperty::ptr{credits_prop}); + _profile.appendProperty(Gvas::Types::IntProperty::ptr{credits_prop}); } credits_prop->value = amount; @@ -227,13 +229,13 @@ Profile::storyProgress() const { bool Profile::setStoryProgress(std::int32_t progress) { - auto story_progress_prop = _profile.at("StoryProgress"_s); + auto story_progress_prop = _profile.at("StoryProgress"_s); if(!story_progress_prop) { - story_progress_prop = new IntProperty; + story_progress_prop = new Gvas::Types::IntProperty; story_progress_prop->name.emplace("StoryProgress"_s); story_progress_prop->valueLength = sizeof(std::int32_t); - _profile.appendProperty(IntProperty::ptr{story_progress_prop}); + _profile.appendProperty(Gvas::Types::IntProperty::ptr{story_progress_prop}); } story_progress_prop->value = progress; @@ -252,41 +254,41 @@ Profile::lastMissionId() const { } std::int32_t -Profile::material(MaterialID id) const { +Profile::material(GameData::MaterialID id) const { return _materials.at(id); } bool -Profile::setMaterial(MaterialID id, std::int32_t amount) { - Containers::StringView container = id > MixedComposition ? PROFILE_QUARK_DATA : PROFILE_MATERIAL; - auto mats_prop = _profile.at(container); +Profile::setMaterial(GameData::MaterialID id, std::int32_t amount) { + Containers::StringView container = id > GameData::MaterialID::MixedComposition ? PROFILE_QUARK_DATA : PROFILE_MATERIAL; + auto mats_prop = _profile.at(container); if(!mats_prop) { - mats_prop = new ArrayProperty; + mats_prop = new Gvas::Types::ArrayProperty; mats_prop->name.emplace(container); mats_prop->itemType = "StructProperty"; - _profile.appendProperty(ArrayProperty::ptr{mats_prop}); + _profile.appendProperty(Gvas::Types::ArrayProperty::ptr{mats_prop}); } - auto predicate = [&id](UnrealPropertyBase::ptr& prop){ - auto res_prop = dynamic_cast(prop.get()); + auto predicate = [&id](Gvas::Types::UnrealPropertyBase::ptr& prop){ + auto res_prop = dynamic_cast(prop.get()); return res_prop->id == id; }; auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate); - ResourceItemValue* res_prop; + Gvas::Types::ResourceItemValue* res_prop; if(it == mats_prop->items.end()) { - res_prop = new ResourceItemValue; + res_prop = new Gvas::Types::ResourceItemValue; if(mats_prop->items.isEmpty()) { res_prop->name.emplace(container); } res_prop->id = id; - ResourceItemValue::ptr prop{res_prop}; + Gvas::Types::ResourceItemValue::ptr prop{res_prop}; arrayAppend(mats_prop->items, std::move(prop)); } else { - res_prop = dynamic_cast(it->get()); + res_prop = dynamic_cast(it->get()); } res_prop->quantity = amount; @@ -300,18 +302,20 @@ Profile::setMaterial(MaterialID id, std::int32_t amount) { } std::int32_t -Profile::getResource(Containers::StringView container, MaterialID id) { - auto mats_prop = _profile.at(container); +Profile::getResource(Containers::StringView container, GameData::MaterialID id) { + auto mats_prop = _profile.at(container); if(!mats_prop) { return 0; } - auto predicate = [&id](UnrealPropertyBase::ptr& prop){ - auto res_prop = dynamic_cast(prop.get()); + auto predicate = [&id](Gvas::Types::UnrealPropertyBase::ptr& prop){ + auto res_prop = dynamic_cast(prop.get()); return res_prop->id == id; }; auto it = std::find_if(mats_prop->items.begin(), mats_prop->items.end(), predicate); - return it != mats_prop->items.end() ? dynamic_cast(it->get())->quantity : 0; + return it != mats_prop->items.end() ? dynamic_cast(it->get())->quantity : 0; } + +}} diff --git a/src/Profile/Profile.h b/src/Profile/Profile.h index 64b036a..ef299e6 100644 --- a/src/Profile/Profile.h +++ b/src/Profile/Profile.h @@ -21,16 +21,13 @@ #include #include -#include "../UESaveFile/UESaveFile.h" +#include "../Gvas/File.h" #include "ResourceIDs.h" using namespace Corrade; -enum class ProfileType: std::uint8_t { - Demo, - FullGame -}; +namespace mbst { namespace GameObjects { class Profile { public: @@ -42,7 +39,12 @@ class Profile { auto filename() const -> Containers::StringView; - ProfileType type() const; + enum class Type: std::uint8_t { + Demo, + FullGame + }; + + auto type() const -> Type; bool isDemo() const; auto account() const -> Containers::StringView; @@ -52,27 +54,27 @@ class Profile { auto companyName() const -> Containers::StringView; bool renameCompany(Containers::StringView new_name); - std::int32_t activeFrameSlot() const; + auto activeFrameSlot() const -> std::int32_t; - std::int32_t credits() const; + auto credits() const -> std::int32_t; bool setCredits(std::int32_t credits); - std::int32_t storyProgress() const; + auto storyProgress() const -> std::int32_t; bool setStoryProgress(std::int32_t progress); - std::int32_t lastMissionId() const; + auto lastMissionId() const -> std::int32_t; - std::int32_t material(MaterialID id) const; - bool setMaterial(MaterialID id, std::int32_t amount); + auto material(GameData::MaterialID id) const -> std::int32_t; + bool setMaterial(GameData::MaterialID id, std::int32_t amount); private: - std::int32_t getResource(Containers::StringView container, MaterialID id); + auto getResource(Containers::StringView container, GameData::MaterialID id) -> std::int32_t; Containers::String _filename; - ProfileType _type; + Type _type; - UESaveFile _profile; + Gvas::File _profile; Containers::String _name; std::int32_t _activeFrameSlot = 0; @@ -80,10 +82,12 @@ class Profile { std::int32_t _storyProgress = 0; std::int32_t _lastMissionId = 0; - std::map _materials; + std::map _materials; Containers::String _account; bool _valid = false; Containers::String _lastError; }; + +}} diff --git a/src/Profile/ResourceIDs.h b/src/Profile/ResourceIDs.h index b1b2735..37f4b7f 100644 --- a/src/Profile/ResourceIDs.h +++ b/src/Profile/ResourceIDs.h @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +namespace mbst { namespace GameData { + enum MaterialID : std::int32_t { VerseSteel = 0xC3500, Undinium = 0xC3501, @@ -45,3 +47,5 @@ enum MaterialID : std::int32_t { CarbonisedSkin = 0xDBBA4, IsolatedVoidParticle = 0xDBBA5, }; + +}} diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index 7919fd8..a42d893 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -33,6 +33,8 @@ using namespace Containers::Literals; +namespace mbst { + ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir): _saveDirectory{save_dir}, _backupsDirectory{backup_dir} @@ -50,7 +52,7 @@ ProfileManager::lastError() { return _lastError; } -Containers::ArrayView +Containers::ArrayView ProfileManager::profiles() { return _profiles; } @@ -59,7 +61,7 @@ bool ProfileManager::refreshProfiles() { LOG_INFO("Refreshing profiles."); - _profiles = Containers::Array{}; + _profiles = Containers::Array{}; using Utility::Path::ListFlag; auto files = Utility::Path::list(_saveDirectory, @@ -78,7 +80,7 @@ ProfileManager::refreshProfiles() { auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate)); for(const auto& file : files_view) { - Profile profile{Utility::Path::join(_saveDirectory, file)}; + GameObjects::Profile profile{Utility::Path::join(_saveDirectory, file)}; if(!profile.valid()) { LOG_WARNING_FORMAT("Profile {} is invalid: {}", file, profile.lastError()); @@ -97,7 +99,7 @@ ProfileManager::refreshProfiles() { return true; } -Profile* +GameObjects::Profile* ProfileManager::getProfile(std::size_t index) { return index <= _profiles.size() ? &(_profiles[index]) : nullptr; } @@ -116,14 +118,15 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { if(delete_builds) { for(std::uint8_t i = 0; i < 32; ++i) { auto filename = Utility::format("{}Unit{:.2d}{}.sav", - _profiles[index].type() == ProfileType::Demo ? "Demo": "", + _profiles[index].type() == GameObjects::Profile::Type::Demo ? "Demo": "", i, _profiles[index].account()); Utility::Path::remove(Utility::Path::join(_saveDirectory, filename)); } } auto file = _profiles[index].filename(); - auto it = std::remove_if(_profiles.begin(), _profiles.end(), [&file](Profile& profile){ return profile.filename() == file; }); + auto it = std::remove_if(_profiles.begin(), _profiles.end(), + [&file](GameObjects::Profile& profile){ return profile.filename() == file; }); if(it != _profiles.end()) { arrayRemoveSuffix(_profiles, 1); @@ -268,10 +271,10 @@ ProfileManager::refreshBackups() { backup.company = info[0]; if(info[1].hasPrefix("full")) { - backup.type = ProfileType::FullGame; + backup.demo = false; } else if(info[1].hasPrefix("demo")) { - backup.type = ProfileType::Demo; + backup.demo = true; } else { continue; @@ -376,3 +379,5 @@ ProfileManager::restoreBackup(std::size_t index) { return true; } + +} diff --git a/src/ProfileManager/ProfileManager.h b/src/ProfileManager/ProfileManager.h index 5b9db95..c6dff6b 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/ProfileManager/ProfileManager.h @@ -27,10 +27,12 @@ using namespace Corrade; +namespace mbst { + struct Backup { Containers::String filename; Containers::String company; - ProfileType type; + bool demo; struct { std::int32_t year; std::int32_t month; @@ -47,16 +49,16 @@ class ProfileManager { explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir); auto ready() const -> bool; - Containers::StringView lastError(); + auto lastError() -> Containers::StringView; - Containers::ArrayView profiles(); + auto profiles() -> Containers::ArrayView; bool refreshProfiles(); - Profile* getProfile(std::size_t index); + auto getProfile(std::size_t index) -> GameObjects::Profile*; bool deleteProfile(std::size_t index, bool delete_builds); bool backupProfile(std::size_t index, bool backup_builds); - Containers::ArrayView backups(); + auto backups() -> Containers::ArrayView; void refreshBackups(); bool deleteBackup(std::size_t index); @@ -69,6 +71,8 @@ class ProfileManager { Containers::StringView _saveDirectory; Containers::StringView _backupsDirectory; - Containers::Array _profiles; + Containers::Array _profiles; Containers::Array _backups; }; + +} diff --git a/src/ToastQueue/ToastQueue.cpp b/src/ToastQueue/ToastQueue.cpp index 637f87b..19f1ad9 100644 --- a/src/ToastQueue/ToastQueue.cpp +++ b/src/ToastQueue/ToastQueue.cpp @@ -26,6 +26,8 @@ using namespace Containers::Literals; +namespace mbst { + constexpr std::uint32_t success_colour = 0xff67d23bu; constexpr std::uint32_t info_colour = 0xffcc832fu; constexpr std::uint32_t warning_colour = 0xff2fcfc7u; @@ -172,3 +174,5 @@ void ToastQueue::removeToast(std::int64_t index) { _toasts.erase(_toasts.begin() + index); } + +} diff --git a/src/ToastQueue/ToastQueue.h b/src/ToastQueue/ToastQueue.h index 8d2ce40..1d175e7 100644 --- a/src/ToastQueue/ToastQueue.h +++ b/src/ToastQueue/ToastQueue.h @@ -27,6 +27,8 @@ using namespace Corrade; using namespace Magnum; +namespace mbst { + class Toast { public: enum class Type: std::uint8_t { @@ -46,25 +48,25 @@ class Toast { Toast(Toast&& other) = default; Toast& operator=(Toast&& other) = default; - Type type(); + auto type() -> Type; - Containers::StringView message(); + auto message() -> Containers::StringView; - std::chrono::milliseconds timeout(); + auto timeout() -> std::chrono::milliseconds; - std::chrono::steady_clock::time_point creationTime(); + auto creationTime() -> std::chrono::steady_clock::time_point; - std::chrono::milliseconds elapsedTime(); + auto elapsedTime() -> std::chrono::milliseconds; - Phase phase(); + auto phase() -> Phase; - float opacity(); + auto opacity() -> float; private: - Type _type{Type::Default}; - Containers::String _message; - std::chrono::milliseconds _timeout; - std::chrono::steady_clock::time_point _creationTime; + Type _type{Type::Default}; + Containers::String _message; + std::chrono::milliseconds _timeout; + std::chrono::steady_clock::time_point _creationTime; Animation::Track _phaseTrack; }; @@ -82,3 +84,5 @@ class ToastQueue { std::vector _toasts; }; + +} diff --git a/src/UESaveFile/CMakeLists.txt b/src/UESaveFile/CMakeLists.txt deleted file mode 100644 index 7a9c7fa..0000000 --- a/src/UESaveFile/CMakeLists.txt +++ /dev/null @@ -1,98 +0,0 @@ -# MassBuilderSaveTool -# Copyright (C) 2021-2023 Guillaume Jacquemin -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -add_library(UESaveFile STATIC EXCLUDE_FROM_ALL - Serialisers/AbstractUnrealCollectionPropertySerialiser.h - Serialisers/AbstractUnrealPropertySerialiser.h - Serialisers/AbstractUnrealStructSerialiser.h - Serialisers/ArrayPropertySerialiser.h - Serialisers/ArrayPropertySerialiser.cpp - Serialisers/BoolPropertySerialiser.h - Serialisers/BoolPropertySerialiser.cpp - Serialisers/BytePropertySerialiser.h - Serialisers/BytePropertySerialiser.cpp - Serialisers/ColourPropertySerialiser.h - Serialisers/ColourPropertySerialiser.cpp - Serialisers/DateTimePropertySerialiser.h - Serialisers/DateTimePropertySerialiser.cpp - Serialisers/EnumPropertySerialiser.h - Serialisers/EnumPropertySerialiser.cpp - Serialisers/FloatPropertySerialiser.h - Serialisers/FloatPropertySerialiser.cpp - Serialisers/GuidPropertySerialiser.h - Serialisers/GuidPropertySerialiser.cpp - Serialisers/IntPropertySerialiser.h - Serialisers/IntPropertySerialiser.cpp - Serialisers/MapPropertySerialiser.h - Serialisers/MapPropertySerialiser.cpp - Serialisers/ResourcePropertySerialiser.h - Serialisers/ResourcePropertySerialiser.cpp - Serialisers/RotatorPropertySerialiser.h - Serialisers/RotatorPropertySerialiser.cpp - Serialisers/StringPropertySerialiser.h - Serialisers/StringPropertySerialiser.cpp - Serialisers/SetPropertySerialiser.h - Serialisers/SetPropertySerialiser.cpp - Serialisers/StructSerialiser.h - Serialisers/StructSerialiser.cpp - Serialisers/TextPropertySerialiser.h - Serialisers/TextPropertySerialiser.cpp - Serialisers/UnrealPropertySerialiser.h - Serialisers/VectorPropertySerialiser.h - Serialisers/VectorPropertySerialiser.cpp - Serialisers/Vector2DPropertySerialiser.h - Serialisers/Vector2DPropertySerialiser.cpp - - Types/ArrayProperty.h - Types/BoolProperty.h - Types/ByteProperty.h - Types/ColourStructProperty.h - Types/DateTimeStructProperty.h - Types/EnumProperty.h - Types/FloatProperty.h - Types/GenericStructProperty.h - Types/GuidStructProperty.h - Types/IntProperty.h - Types/MapProperty.h - Types/NoneProperty.h - Types/RotatorStructProperty.h - Types/SetProperty.h - Types/StringProperty.h - Types/StructProperty.h - Types/ResourceItemValue.h - Types/TextProperty.h - Types/UnrealProperty.h - Types/UnrealPropertyBase.h - Types/VectorStructProperty.h - - Debug.h - Debug.cpp - UESaveFile.h - UESaveFile.cpp - BinaryReader.h - BinaryReader.cpp - BinaryWriter.h - BinaryWriter.cpp - PropertySerialiser.h - PropertySerialiser.cpp -) - -target_link_libraries(UESaveFile PRIVATE - Corrade::Containers - Corrade::Utility - Magnum::Magnum - Logger -) diff --git a/src/UESaveFile/PropertySerialiser.h b/src/UESaveFile/PropertySerialiser.h deleted file mode 100644 index db89fa9..0000000 --- a/src/UESaveFile/PropertySerialiser.h +++ /dev/null @@ -1,61 +0,0 @@ -#pragma once - -// MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include -#include -#include - -#include "Serialisers/AbstractUnrealPropertySerialiser.h" -#include "Serialisers/AbstractUnrealCollectionPropertySerialiser.h" - -#include "Types/UnrealPropertyBase.h" - -using namespace Corrade; - -class BinaryReader; -class BinaryWriter; - -class PropertySerialiser { - public: - static PropertySerialiser& instance(); - - UnrealPropertyBase::ptr read(BinaryReader& reader); - UnrealPropertyBase::ptr readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, - Containers::String name); - Containers::Array readSet(BinaryReader& reader, Containers::StringView item_type, - std::uint32_t count); - UnrealPropertyBase::ptr deserialise(Containers::String name, Containers::String type, std::size_t value_length, - BinaryReader& reader); - - bool serialise(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written, - BinaryWriter& writer); - bool write(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer); - bool writeItem(UnrealPropertyBase::ptr& prop, Containers::StringView item_type, std::size_t& bytes_written, - BinaryWriter& writer); - bool writeSet(Containers::ArrayView props, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer); - - private: - PropertySerialiser(); - - AbstractUnrealPropertySerialiser* getSerialiser(Containers::StringView item_type); - AbstractUnrealCollectionPropertySerialiser* getCollectionSerialiser(Containers::StringView item_type); - - Containers::Array _serialisers; - Containers::Array _collectionSerialisers; -}; diff --git a/src/UESaveFile/Serialisers/StructSerialiser.h b/src/UESaveFile/Serialisers/StructSerialiser.h deleted file mode 100644 index 2644e6c..0000000 --- a/src/UESaveFile/Serialisers/StructSerialiser.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -// MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include -#include - -#include "AbstractUnrealCollectionPropertySerialiser.h" -#include "AbstractUnrealPropertySerialiser.h" -#include "AbstractUnrealStructSerialiser.h" - -#include "../Types/StructProperty.h" - -class StructSerialiser : public AbstractUnrealPropertySerialiser, public AbstractUnrealCollectionPropertySerialiser { - public: - using ptr = Containers::Pointer; - - StringArrayView types() override; - - PropertyArray deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) override; - UnrealPropertyBase::ptr deserialise(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser) override; - - bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) override; - bool serialise(UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; - - private: - StructProperty::ptr readStructValue(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, - PropertySerialiser& serialiser); - bool writeStructValue(StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser); -} ; diff --git a/src/UpdateChecker/UpdateChecker.cpp b/src/UpdateChecker/UpdateChecker.cpp index dd44d5b..e4b3225 100644 --- a/src/UpdateChecker/UpdateChecker.cpp +++ b/src/UpdateChecker/UpdateChecker.cpp @@ -27,6 +27,8 @@ using namespace Corrade; +namespace mbst { + UpdateChecker::UpdateChecker() { LOG_INFO("Initialising update checker."); curl_global_init(CURL_GLOBAL_DEFAULT); @@ -116,3 +118,5 @@ Containers::StringView UpdateChecker::downloadLink() const { return _downloadLink; } + +} diff --git a/src/UpdateChecker/UpdateChecker.h b/src/UpdateChecker/UpdateChecker.h index f460010..2e567d0 100644 --- a/src/UpdateChecker/UpdateChecker.h +++ b/src/UpdateChecker/UpdateChecker.h @@ -18,6 +18,8 @@ #include "../Version/Version.h" +namespace mbst { + class UpdateChecker { public: explicit UpdateChecker(); @@ -47,3 +49,5 @@ class UpdateChecker { Version _foundVersion{}; Containers::String _downloadLink; }; + +} diff --git a/src/Utilities/Crc32.cpp b/src/Utilities/Crc32.cpp new file mode 100644 index 0000000..66b6d8b --- /dev/null +++ b/src/Utilities/Crc32.cpp @@ -0,0 +1,56 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "Crc32.h" + +namespace mbst { namespace Crc32 { + +std::uint32_t +update(std::uint32_t initial, Containers::ArrayView data) { + static const auto table = []{ + std::uint32_t polynomial = 0xEDB88320u; + Containers::StaticArray<256, std::uint32_t> temp{ValueInit}; + + for(std::uint32_t i = 0; i < 256; i++) { + std::uint32_t c = i; + + for(std::size_t j = 0; j < 8; j++) { + if(c & 1) { + c = polynomial ^ (c >> 1); + } + else { + c >>= 1; + } + } + + temp[i] = c; + } + + return temp; + }(); + + std::uint32_t c = initial ^ 0xFFFFFFFF; + + auto u = Containers::arrayCast(data); + + for(std::size_t i = 0; i < data.size(); ++i) { + c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8); + } + + return c ^ 0xFFFFFFFF; +} + +}} diff --git a/src/Utilities/Crc32.h b/src/Utilities/Crc32.h index 08e819a..a2f7af9 100644 --- a/src/Utilities/Crc32.h +++ b/src/Utilities/Crc32.h @@ -23,40 +23,8 @@ using namespace Corrade; -namespace Crc32 { +namespace mbst { namespace Utilities { -std::uint32_t update(std::uint32_t initial, Containers::ArrayView data) { - static const auto table = []{ - std::uint32_t polynomial = 0xEDB88320u; - Containers::StaticArray<256, std::uint32_t> temp{ValueInit}; +auto crc32(std::uint32_t initial, Containers::ArrayView data) -> std::uint32_t; - for(std::uint32_t i = 0; i < 256; i++) { - std::uint32_t c = i; - - for(std::size_t j = 0; j < 8; j++) { - if(c & 1) { - c = polynomial ^ (c >> 1); - } - else { - c >>= 1; - } - } - - temp[i] = c; - } - - return temp; - }(); - - std::uint32_t c = initial ^ 0xFFFFFFFF; - - auto u = Containers::arrayCast(data); - - for(std::size_t i = 0; i < data.size(); ++i) { - c = table[(c ^ u[i]) & 0xFF] ^ (c >> 8); - } - - return c ^ 0xFFFFFFFF; -} - -} // Crc32 +}} diff --git a/src/Version/Version.cpp b/src/Version/Version.cpp new file mode 100644 index 0000000..88016f7 --- /dev/null +++ b/src/Version/Version.cpp @@ -0,0 +1,41 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2023 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "Version.h" + +namespace mbst { + +Version::Version(Containers::StringView str) { + std::size_t start_point = 0; + + if(str[0] == 'v') { + start_point++; + } + + auto components = Containers::StringView{str.data() + start_point}.split('.'); + + major = std::strtol(components[0].data(), nullptr, 10); + minor = std::strtol(components[1].data(), nullptr, 10); + patch = std::strtol(components[2].data(), nullptr, 10); + + fullVersion = major * 10000 + minor * 100 + patch; + + if(str.hasSuffix("-pre")) { + prerelease = true; + } +} + +} diff --git a/src/Version/Version.h b/src/Version/Version.h index fb1ad23..71e2acb 100644 --- a/src/Version/Version.h +++ b/src/Version/Version.h @@ -25,28 +25,12 @@ using namespace Corrade; +namespace mbst { + struct Version { explicit Version() = default; - explicit Version(Containers::StringView str) { - std::size_t start_point = 0; - - if(str[0] == 'v') { - start_point++; - } - - auto components = Containers::StringView{str.data() + start_point}.split('.'); - - major = std::strtol(components[0].data(), nullptr, 10); - minor = std::strtol(components[1].data(), nullptr, 10); - patch = std::strtol(components[2].data(), nullptr, 10); - - fullVersion = major * 10000 + minor * 100 + patch; - - if(str.hasSuffix("-pre")) { - prerelease = true; - } - } + explicit Version(Containers::StringView str); constexpr explicit Version(long major_, long minor_, long patch_, bool prerelease_): major{major_}, minor{minor_}, patch{patch_}, prerelease{prerelease_}, @@ -55,17 +39,17 @@ struct Version { //ctor } - long major = 0; - long minor = 0; - long patch = 0; - bool prerelease = false; + long major = 0; + long minor = 0; + long patch = 0; + bool prerelease = false; long fullVersion = 0; - bool operator==(const Version& other) const { + inline bool operator==(const Version& other) const { return fullVersion == other.fullVersion && prerelease == other.prerelease; } - bool operator>(const Version& other) const { + inline bool operator>(const Version& other) const { if((fullVersion > other.fullVersion) || (fullVersion == other.fullVersion && !prerelease && other.prerelease)) { @@ -87,3 +71,5 @@ constexpr Version current_version{ SAVETOOL_VERSION_PATCH, SAVETOOL_VERSION_PRERELEASE }; + +} diff --git a/src/main.cpp b/src/main.cpp index dc6dc87..85eb88e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -24,7 +24,7 @@ #include "Configuration/Configuration.h" #include "Logger/MagnumLogBuffer.h" -#include "SaveTool/SaveTool.h" +#include "Application/Application.h" int main(int argc, char** argv) { MagnumLogBuffer debug_intercept_buffer{EntryType::Info}; @@ -54,7 +54,7 @@ int main(int argc, char** argv) { if(locale.hasSuffix(".65001")) { LOG_INFO("Wine detected."); - conf().setRunningInWine(true); + mbst::conf().setRunningInWine(true); } } @@ -86,7 +86,7 @@ int main(int argc, char** argv) { LOG_INFO_FORMAT("Processor: {}", Containers::arrayCast(brand).data()); } - SaveTool app({argc, argv}); + mbst::Application app({argc, argv}); int result = app.exec(); ReleaseMutex(mutex_handle); -- 2.39.5 From 5af4ad0e66bc36e313883c6c84022e111049a12e Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Wed, 29 Nov 2023 12:58:52 +0100 Subject: [PATCH 042/126] Update submodules. libzip also changed its branch name from master to main, so adapt to that too. --- .gitmodules | 2 +- third-party/SDL | 2 +- third-party/corrade | 2 +- third-party/curl | 2 +- third-party/efsw | 2 +- third-party/imgui | 2 +- third-party/libzip | 2 +- third-party/magnum | 2 +- third-party/magnum-integration | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.gitmodules b/.gitmodules index a4d5f8f..efa45ca 100644 --- a/.gitmodules +++ b/.gitmodules @@ -21,7 +21,7 @@ [submodule "libzip"] path = third-party/libzip url = https://github.com/nih-at/libzip - branch = master + branch = main [submodule "efsw"] path = third-party/efsw url = https://github.com/SpartanJ/efsw diff --git a/third-party/SDL b/third-party/SDL index f032e8c..0134672 160000 --- a/third-party/SDL +++ b/third-party/SDL @@ -1 +1 @@ -Subproject commit f032e8c19165aeee6f9b47e82fb56809d4aeae1e +Subproject commit 01346723455a37c1cd14bba28ebeffe268002bcd diff --git a/third-party/corrade b/third-party/corrade index 183b375..4922edf 160000 --- a/third-party/corrade +++ b/third-party/corrade @@ -1 +1 @@ -Subproject commit 183b375b73fa3e819a6b41dbcc0cf2f06773d2b4 +Subproject commit 4922edf269ce77efe073f6b750a34892e1f3c30d diff --git a/third-party/curl b/third-party/curl index 864090c..a4ed3e7 160000 --- a/third-party/curl +++ b/third-party/curl @@ -1 +1 @@ -Subproject commit 864090ca39c3c9fe994104ed23d29c37caa61a8e +Subproject commit a4ed3e766a68ff7517ee9cf3cb71c7255e8ee9b0 diff --git a/third-party/efsw b/third-party/efsw index 19398b8..bc85baf 160000 --- a/third-party/efsw +++ b/third-party/efsw @@ -1 +1 @@ -Subproject commit 19398b80bc5161b9a890035d1de47244165c2f17 +Subproject commit bc85bafae7d7b641e326ed5d01bfffd5eb0352f5 diff --git a/third-party/imgui b/third-party/imgui index f617fe7..7965494 160000 --- a/third-party/imgui +++ b/third-party/imgui @@ -1 +1 @@ -Subproject commit f617fe7890f78bc300e7a068a1c2acc9e9ce1e97 +Subproject commit 7965494ff323c8a3232ac1233a08b984e3c981ae diff --git a/third-party/libzip b/third-party/libzip index bdc03ab..0b6ebe6 160000 --- a/third-party/libzip +++ b/third-party/libzip @@ -1 +1 @@ -Subproject commit bdc03ab23b703fcc516436d6ebcbfb6ac4484033 +Subproject commit 0b6ebe6fad8adb1ec95bb5529c5af2185d40c2cf diff --git a/third-party/magnum b/third-party/magnum index 0d31f74..b91b0b2 160000 --- a/third-party/magnum +++ b/third-party/magnum @@ -1 +1 @@ -Subproject commit 0d31f7461b31698ea5bf92ec66ff5056a6ad7360 +Subproject commit b91b0b24cde81a4eb9029cb2202b3a652c9bd0e9 diff --git a/third-party/magnum-integration b/third-party/magnum-integration index 35c05fd..bb8a4a8 160000 --- a/third-party/magnum-integration +++ b/third-party/magnum-integration @@ -1 +1 @@ -Subproject commit 35c05fda3e243b696e2b3a3dcd230c819ca108e0 +Subproject commit bb8a4a870f217fc9ac15ff0ddc145974be49a5e7 -- 2.39.5 From 90fd22225fab689aba3303c7e81ae854c805a7df Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Wed, 29 Nov 2023 13:00:05 +0100 Subject: [PATCH 043/126] ProfileManager: adapt to Corrade changes. --- src/ProfileManager/ProfileManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index a42d893..5037234 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -142,7 +142,7 @@ ProfileManager::backupProfile(std::size_t index, bool backup_builds) { auto& profile = _profiles[index]; auto filename = Utility::format("{}_{}{:.2d}{:.2d}_{:.2d}{:.2d}{:.2d}.backup.mbst", - Utility::String::replaceAll(profile.companyName().data(), " ", "_").c_str(), + Utility::String::replaceAll(profile.companyName().data(), " ", "_").data(), time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, time->tm_hour, time->tm_min, time->tm_sec); -- 2.39.5 From df9e6bcd17fe2ed716ea7cbf65f3876fe7438ace Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Wed, 29 Nov 2023 13:00:31 +0100 Subject: [PATCH 044/126] CMakeLists: change how libcurl is found. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f72df89..ed96a2f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,8 +26,8 @@ if(CORRADE_TARGET_WINDOWS) endif() find_package(Magnum REQUIRED GL Sdl2Application) find_package(MagnumIntegration REQUIRED ImGui) -find_package(CURL REQUIRED HTTPS) if(SAVETOOL_USE_SYSTEM_LIBS) + find_package(CURL REQUIRED HTTPS) find_package(libzip REQUIRED) find_package(efsw REQUIRED) endif() -- 2.39.5 From bf7f6d24f3c06acb6869c4c4e81cc1bb6a998664 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Wed, 29 Nov 2023 13:12:18 +0100 Subject: [PATCH 045/126] Application: adapt to ImGui changes. --- src/Application/Application_MainManager.cpp | 4 ++-- src/Application/Application_MassViewer.cpp | 6 ++++-- src/Application/Application_MassViewer_Armour.cpp | 2 +- src/Application/Application_MassViewer_Frame.cpp | 6 +++--- src/Application/Application_MassViewer_Weapons.cpp | 2 +- src/Application/Application_ProfileManager.cpp | 2 +- src/Application/Application_drawAbout.cpp | 5 +++-- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index e9861c6..0e70234 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -58,7 +58,7 @@ Application::drawManager() { if(ImGui::BeginChild("##ProfileInfo", {ImGui::GetContentRegionAvail().x * 0.60f, 0.0f}, - true, ImGuiWindowFlags_MenuBar)) + ImGuiChildFlags_Border, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Profile information"); @@ -85,7 +85,7 @@ Application::drawManager() { ImGui::SameLine(); if(ImGui::BeginChild("##MASSManager", {0.0f, 0.0f}, - true, ImGuiWindowFlags_MenuBar)) + ImGuiChildFlags_Border, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("M.A.S.S. management"); diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index 6af7887..992a2ac 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -52,7 +52,7 @@ Application::drawMassViewer() { if(ImGui::BeginChild("##MassInfo", {0.0f, 0.0f}, - true, ImGuiWindowFlags_MenuBar)) + ImGuiChildFlags_Border, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginMenuBar()) { if(ImGui::BeginTable("##MassViewerMenuTable", 4)) { @@ -303,7 +303,9 @@ Application::drawCustomStyle(GameObjects::CustomStyle& style) { DCSResult return_value = DCS_Fail; - if(!ImGui::BeginChild("##CustomStyle", {0.0f, 244.0f}, true, ImGuiWindowFlags_MenuBar)) { + if(!ImGui::BeginChild("##CustomStyle", {}, ImGuiChildFlags_Border|ImGuiChildFlags_AutoResizeY, + ImGuiWindowFlags_MenuBar)) + { ImGui::EndChild(); return DCS_Fail; } diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index 769dcc3..98f6184 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -34,7 +34,7 @@ Application::drawArmour() { _currentMass->getBulletLauncherAttachments(); } - if(!ImGui::BeginChild("##ArmourParts", {0.0f, 0.0f}, true)) { + if(!ImGui::BeginChild("##ArmourParts", {}, ImGuiChildFlags_Border)) { ImGui::EndChild(); return; } diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index 445b561..d9a6c22 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -36,8 +36,8 @@ Application::drawFrameInfo() { if(ImGui::BeginChild("##JointSliders", {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), - (ImGui::GetContentRegionAvail().y / 1.75f) - (ImGui::GetStyle().WindowPadding.y / 2.0f)}, - true, ImGuiWindowFlags_MenuBar)) + 0.0f}, + ImGuiChildFlags_Border|ImGuiChildFlags_AutoResizeY, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Joint sliders"); @@ -51,7 +51,7 @@ Application::drawFrameInfo() { if(ImGui::BeginChild("##FrameStyles", {(ImGui::GetContentRegionAvail().x / 2.0f) - (ImGui::GetStyle().WindowPadding.x / 2.0f), 0.0f}, - true, ImGuiWindowFlags_MenuBar)) + ImGuiChildFlags_Border, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Frame styles"); diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 6f56390..98abf30 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -506,7 +506,7 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { } } - if(ImGui::BeginChild("##PartDetails", {0.0f, 0.0f}, true)) { + if(ImGui::BeginChild("##PartDetails", {}, ImGuiChildFlags_Border)) { ImGui::TextUnformatted("Styles:"); for(std::int32_t i = 0; i < 4; i++) { diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index 548a096..601b939 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -305,7 +305,7 @@ Application::drawBackupListPopup() { ImGui::EndTable(); } - ImGui::PushTextWrapPos(ImGui::GetWindowContentRegionWidth()); + ImGui::PushTextWrapPos(ImGui::GetContentRegionAvail().x); ImGui::TextUnformatted("Hover over a company name to see which files are included in the backup."); ImGui::PopTextWrapPos(); diff --git a/src/Application/Application_drawAbout.cpp b/src/Application/Application_drawAbout.cpp index c68472d..73e1d1e 100644 --- a/src/Application/Application_drawAbout.cpp +++ b/src/Application/Application_drawAbout.cpp @@ -86,9 +86,10 @@ Application::drawAbout() { ImGui::Separator(); if(ImGui::CollapsingHeader("Licence")) { - ImGui::TextWrapped("This application is made available under the terms of the GNU General Public License, version 3, the full text of which is available below:"); + ImGui::TextWrapped("This application is made available under the terms of the GNU General Public License," + "version 3, the full text of which is available below:"); - if(ImGui::BeginChild("##GPL", {0.0f, float(windowSize().y()) * 0.3f}, true)) { + if(ImGui::BeginChild("##GPL", {0.0f, float(windowSize().y()) * 0.3f}, ImGuiChildFlags_Border)) { static auto licence = _rs.getRaw("COPYING"); ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); ImGui::TextUnformatted(licence.begin(), licence.end()); -- 2.39.5 From d9755a31fee2c8d003e32c46f9e4fc793884527b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Wed, 29 Nov 2023 13:51:36 +0100 Subject: [PATCH 046/126] Application: update layout in the frame editor. That table for the joint sliders was ugly as fuck. I'm glad to be rid of it. --- .../Application_MassViewer_Frame.cpp | 147 +++++++----------- 1 file changed, 55 insertions(+), 92 deletions(-) diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index d9a6c22..35e3f8b 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -41,6 +41,8 @@ Application::drawFrameInfo() { { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Joint sliders"); + drawHelpMarker("In-game values are multiplied by 100. For example, 0.500 here is equal to 50 in-game.", + static_cast(windowSize().x()) / 4.0f); ImGui::EndMenuBar(); } @@ -67,7 +69,7 @@ Application::drawFrameInfo() { ImGui::SameLine(); - if(ImGui::BeginChild("##EyeFlare", {0.0f, 0.0f}, true, ImGuiWindowFlags_MenuBar)) { + if(ImGui::BeginChild("##EyeFlare", {}, ImGuiChildFlags_Border, ImGuiWindowFlags_MenuBar)) { if(ImGui::BeginMenuBar()) { ImGui::TextUnformatted("Eye flare colour"); drawHelpMarker("Right-click the picker for more options.", 250.0f); @@ -88,98 +90,53 @@ Application::drawJointSliders() { return; } - ImGui::TextWrapped("In-game values are multiplied by 100.\nFor example, 0.500 here is equal to 50 in-game."); + ImGui::BeginGroup(); + drawAlignedText("Neck:"); + drawAlignedText("Body:"); + drawAlignedText("Shoulders:"); + drawAlignedText("Hips:"); + drawAlignedText("Arms:"); + drawAlignedText("Legs:"); + ImGui::EndGroup(); - if(ImGui::BeginTable("##JointSliderTable", 2, ImGuiTableFlags_Borders)) { - ImGui::TableSetupColumn("##SliderLabel", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("##Sliders", ImGuiTableColumnFlags_WidthStretch); + ImGui::SameLine(); - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - drawAlignedText("Neck"); - ImGui::TableSetColumnIndex(1); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##NeckSlider", &_currentMass->jointSliders().neck, 0.0f, 1.0f)) { - _jointsDirty = true; - } - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - drawAlignedText("Body"); - ImGui::TableSetColumnIndex(1); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##BodySlider", &_currentMass->jointSliders().body, 0.0f, 1.0f)) { - _jointsDirty = true; - } - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - drawAlignedText("Shoulders"); - ImGui::TableSetColumnIndex(1); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##ShouldersSlider", &_currentMass->jointSliders().shoulders, 0.0f, 1.0f)) { - _jointsDirty = true; - } - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - drawAlignedText("Hips"); - ImGui::TableSetColumnIndex(1); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##HipsSlider", &_currentMass->jointSliders().hips, 0.0f, 1.0f)) { - _jointsDirty = true; - } - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - drawAlignedText("Arms"); - ImGui::TableSetColumnIndex(1); - ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{2.0f, 1.0f}); - if(ImGui::BeginTable("##UpperLowerArmsLayoutTable", 2)) { - ImGui::TableSetupColumn("##UpperArms", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##LowerArms", ImGuiTableColumnFlags_WidthStretch); - - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##UpperArmsSlider", &_currentMass->jointSliders().upperArms, 0.0f, 1.0f, "Upper: %.3f")) { - _jointsDirty = true; - } - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##LowerArmsSlider", &_currentMass->jointSliders().lowerArms, 0.0f, 1.0f, "Lower: %.3f")) { - _jointsDirty = true; - } - - ImGui::EndTable(); - } - ImGui::PopStyleVar(); - - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - drawAlignedText("Legs"); - ImGui::TableSetColumnIndex(1); - ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, ImVec2{2.0f, 1.0f}); - if(ImGui::BeginTable("##UpperLowerLegsLayoutTable", 2)) { - ImGui::TableSetupColumn("##UpperLegs", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##LowerLegs", ImGuiTableColumnFlags_WidthStretch); - - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##UpperLegsSlider", &_currentMass->jointSliders().upperLegs, 0.0f, 1.0f, "Upper: %.3f")) { - _jointsDirty = true; - } - ImGui::TableNextColumn(); - ImGui::SetNextItemWidth(-1.0f); - if(ImGui::SliderFloat("##LowerLegsSlider", &_currentMass->jointSliders().lowerLegs, 0.0f, 1.0f, "Lower: %.3f")) { - _jointsDirty = true; - } - - ImGui::EndTable(); - } - ImGui::PopStyleVar(); - - ImGui::EndTable(); + ImGui::BeginGroup(); + ImGui::PushItemWidth(-1.0f); + if(ImGui::SliderFloat("##NeckSlider", &_currentMass->jointSliders().neck, 0.0f, 1.0f)) { + _jointsDirty = true; } + if(ImGui::SliderFloat("##BodySlider", &_currentMass->jointSliders().body, 0.0f, 1.0f)) { + _jointsDirty = true; + } + if(ImGui::SliderFloat("##ShouldersSlider", &_currentMass->jointSliders().shoulders, 0.0f, 1.0f)) { + _jointsDirty = true; + } + if(ImGui::SliderFloat("##HipsSlider", &_currentMass->jointSliders().hips, 0.0f, 1.0f)) { + _jointsDirty = true; + } + ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); + if(ImGui::SliderFloat("##UpperArmsSlider", &_currentMass->jointSliders().upperArms, 0.0f, 1.0f, "Upper: %.3f")) { + _jointsDirty = true; + } + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + if(ImGui::SliderFloat("##LowerArmsSlider", &_currentMass->jointSliders().lowerArms, 0.0f, 1.0f, "Lower: %.3f")) { + _jointsDirty = true; + } + ImGui::PopItemWidth(); + ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); + if(ImGui::SliderFloat("##UpperLegsSlider", &_currentMass->jointSliders().upperLegs, 0.0f, 1.0f, "Upper: %.3f")) { + _jointsDirty = true; + } + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + if(ImGui::SliderFloat("##LowerLegsSlider", &_currentMass->jointSliders().lowerLegs, 0.0f, 1.0f, "Lower: %.3f")) { + _jointsDirty = true; + } + ImGui::PopItemWidth(); + ImGui::PopItemWidth(); + ImGui::EndGroup(); if(!_jointsDirty) { ImGui::BeginDisabled(); @@ -218,9 +175,14 @@ Application::drawFrameStyles() { ImGui::PushID(i); - if(ImGui::BeginCombo("##Style", getStyleName(_currentMass->frameStyles()[i], _currentMass->frameCustomStyles()).data())) { + ImGui::PushItemWidth(-1.0f); + if(ImGui::BeginCombo("##Style", + getStyleName(_currentMass->frameStyles()[i], _currentMass->frameCustomStyles()).data())) + { for(const auto& style : GameData::style_names) { - if(ImGui::Selectable(getStyleName(style.first, _currentMass->frameCustomStyles()).data(), _currentMass->frameStyles()[i] == style.first)) { + if(ImGui::Selectable(getStyleName(style.first, _currentMass->frameCustomStyles()).data(), + _currentMass->frameStyles()[i] == style.first)) + { _currentMass->frameStyles()[i] = style.first; _stylesDirty = true; } @@ -228,6 +190,7 @@ Application::drawFrameStyles() { ImGui::EndCombo(); } + ImGui::PopItemWidth(); ImGui::PopID(); } -- 2.39.5 From 132c46da89f483f3a922178ceebb9122ca104949 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 4 Dec 2023 12:03:33 +0100 Subject: [PATCH 047/126] Application: remove a separator in the weapons tab. --- src/Application/Application_MassViewer_Weapons.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 98abf30..722b407 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -158,8 +158,6 @@ Application::drawWeapons() { ImGui::EndGroup(); - ImGui::SameLine(); - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); ImGui::SameLine(); if(!_currentWeapon) { -- 2.39.5 From ca7b71fb3669969a128f0917591cda4c1ed29c4b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 4 Dec 2023 13:44:57 +0100 Subject: [PATCH 048/126] Application: tweak decal editor layout. --- src/Application/Application_MassViewer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index 992a2ac..db74921 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -468,6 +468,7 @@ Application::drawDecalEditor(GameObjects::Decal& decal) { ImGui::SameLine(); ImGui::BeginGroup(); + ImGui::PushItemWidth(-1.0f); ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); ImGui::DragFloat("##PosX", &decal.position.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); ImGui::PopItemWidth(); @@ -497,6 +498,7 @@ Application::drawDecalEditor(GameObjects::Decal& decal) { ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); ImGui::DragFloat("##VZ", &decal.vAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); ImGui::PopItemWidth(); + ImGui::PopItemWidth(); ImGui::EndGroup(); } -- 2.39.5 From 570134ced07e5fbb00c6eb3d213e1a8486bb4e64 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 4 Dec 2023 15:24:05 +0100 Subject: [PATCH 049/126] Application: fix link to MBST's Git repo. --- src/Application/Application_drawAbout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Application/Application_drawAbout.cpp b/src/Application/Application_drawAbout.cpp index 73e1d1e..98e858e 100644 --- a/src/Application/Application_drawAbout.cpp +++ b/src/Application/Application_drawAbout.cpp @@ -72,7 +72,7 @@ Application::drawAbout() { if(ImGui::Button("Open in browser")) { openUri(website); } - auto repo = "https://williamjcm.ovh/git/williamjcm/MassBuilderSaveTool"; + auto repo = "https://git.williamjcm.ovh/williamjcm/MassBuilderSaveTool"; drawAlignedText(ICON_FA_GIT_ALT " %s", repo); ImGui::SameLine(); if(ImGui::Button("Copy to clipboard")) { -- 2.39.5 From 7ce726f933432aae5f17f37f446675e034b5d21a Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 4 Dec 2023 15:25:02 +0100 Subject: [PATCH 050/126] Application: redo the whole armour tab. --- src/Application/Application.h | 4 +- src/Application/Application_MassViewer.cpp | 8 + .../Application_MassViewer_Armour.cpp | 501 ++++++++++-------- 3 files changed, 280 insertions(+), 233 deletions(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index 2f30b0e..71141b1 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -137,6 +137,7 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawEyeColourPicker(); void drawCustomFrameStyles(); void drawArmour(); + void drawBLAttachment(); void drawCustomArmourStyles(); void drawWeapons(); void drawWeaponCategory(Containers::StringView name, Containers::ArrayView weapons_view, @@ -276,9 +277,10 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe bool _bLaunchersDirty = false; bool _eLaunchersDirty = false; + Containers::Optional _selectedArmourSlot{Containers::NullOpt}; Containers::StaticArray<38, std::int32_t> _selectedArmourDecals{ValueInit}; Containers::StaticArray<38, std::int32_t> _selectedArmourAccessories{ValueInit}; - std::int32_t _selectedBLPlacement = 0; + std::uint32_t _selectedBLPlacement = 0; std::int32_t _selectedWeaponPart = 0; std::int32_t _selectedWeaponDecal = 0; std::int32_t _selectedWeaponAccessory = 0; diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index db74921..d4c86c0 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -88,6 +88,7 @@ Application::drawMassViewer() { _jointsDirty = false; _stylesDirty = false; _eyeFlareDirty = false; + _selectedArmourSlot = Containers::NullOpt; _selectedArmourDecals = Containers::StaticArray<38, std::int32_t>{ValueInit}; _selectedArmourAccessories = Containers::StaticArray<38, std::int32_t>{ValueInit}; _selectedBLPlacement = 0; @@ -126,6 +127,13 @@ Application::drawMassViewer() { ImGui::EndTabItem(); } + if(_currentMass->bulletLauncherAttachmentStyle() != GameObjects::BulletLauncherAttachmentStyle::NotFound && + ImGui::BeginTabItem("Bullet launcher attachment")) + { + drawBLAttachment(); + ImGui::EndTabItem(); + } + if(ImGui::BeginTabItem("Custom armour styles")) { drawCustomArmourStyles(); ImGui::EndTabItem(); diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index 98f6184..9ee33f5 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -29,63 +29,77 @@ Application::drawArmour() { return; } - if(ImGui::Button(ICON_FA_UNDO_ALT " Reset all")) { - _currentMass->getArmourParts(); - _currentMass->getBulletLauncherAttachments(); - } - - if(!ImGui::BeginChild("##ArmourParts", {}, ImGuiChildFlags_Border)) { - ImGui::EndChild(); - return; - } - - static Containers::StringView slot_labels[] = { + constexpr static Containers::StringView slot_labels[] = { #define c(enumerator, strenum, name) name, #include "../Maps/ArmourSlots.hpp" #undef c }; - for(std::uint32_t i = 0; i < _currentMass->armourParts().size(); i++) { - ImGui::PushID(int(i)); + auto labels_view = arrayView(slot_labels); - auto& part = _currentMass->armourParts()[i]; + const static float footer_height_to_reserve = ImGui::GetFrameHeightWithSpacing(); - static char header[129] = {'\0'}; + ImGui::BeginGroup(); - std::memset(header, '\0', 129); + if(ImGui::BeginTable("##SlotsTable", 1, + ImGuiTableFlags_ScrollY|ImGuiTableFlags_BordersOuter|ImGuiTableFlags_BordersInnerH, + {ImGui::GetContentRegionAvail().x * 0.15f, -footer_height_to_reserve})) + { + ImGui::TableSetupColumn("##Slots", ImGuiTableColumnFlags_WidthStretch); + + for(std::size_t i = 0; i < labels_view.size(); i++) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + if(ImGui::Selectable(labels_view[i].data(), _selectedArmourSlot && (*_selectedArmourSlot) == i, + ImGuiSelectableFlags_SpanAvailWidth)) + { + _selectedArmourSlot = i; + } + } + + ImGui::EndTable(); + } + + if(ImGui::Button(ICON_FA_UNDO_ALT " Reset all")) { + _currentMass->getArmourParts(); + } + + ImGui::EndGroup(); + + ImGui::SameLine(); + + if(!_selectedArmourSlot) { + ImGui::TextUnformatted("No selected armour slot."); + return; + } + + auto& part = _currentMass->armourParts()[*_selectedArmourSlot]; + + ImGui::BeginGroup(); + + if(ImGui::BeginChild("##ArmourEditor", {0.0f, -footer_height_to_reserve})) { + + ImGui::SeparatorText("Part"); if(GameData::armour_sets.find(part.id) != GameData::armour_sets.cend()) { - std::snprintf(header, 128, "%s: %s###%u", - slot_labels[std::uint32_t(part.slot)].data(), - GameData::armour_sets.at(part.id).name.data(), - std::uint32_t(part.slot)); + ImGui::Text("Set name: %s", GameData::armour_sets.at(part.id).name.data()); } else { - std::snprintf(header, 128, "%s: %i###%u", - slot_labels[std::uint32_t(part.slot)].data(), - part.id, - std::uint32_t(part.slot)); + ImGui::Text("Set ID: %u", part.id); } - if(ImGui::CollapsingHeader(header)) { - ImGui::BeginGroup(); + ImGui::SameLine(); - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x * 0.491f); + if(ImGui::SmallButton("Change")) { + ImGui::OpenPopup("##ArmourPartPopup"); + } + if(ImGui::BeginPopup("##ArmourPartPopup")) { if(ImGui::BeginListBox("##ChangePart")) { - if(std::strncmp("Neck", slot_labels[std::uint32_t(part.slot)].data(), 4) != 0) { - for(auto& set : GameData::armour_sets) { - if(ImGui::Selectable(set.second.name.data(), set.first == part.id, ImGuiSelectableFlags_SpanAvailWidth)) { - part.id = set.first; - } - } - } - else { - for(auto& set : GameData::armour_sets) { - if(!set.second.neck_compatible) { - continue; - } - - if(ImGui::Selectable(set.second.name.data(), set.first == part.id, ImGuiSelectableFlags_SpanAvailWidth)) { + for(auto& set : GameData::armour_sets) { + if(part.slot != GameObjects::ArmourPart::Slot::Neck || set.second.neck_compatible) { + if(ImGui::Selectable(set.second.name.data(), set.first == part.id, + ImGuiSelectableFlags_SpanAvailWidth)) + { part.id = set.first; } } @@ -93,208 +107,231 @@ Application::drawArmour() { ImGui::EndListBox(); } - ImGui::EndGroup(); - - ImGui::SameLine(); - - ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); - - ImGui::SameLine(); - - ImGui::BeginGroup(); - - ImGui::TextUnformatted("Styles:"); - - for(std::int32_t j = 0; j < 4; j++) { - drawAlignedText("Slot %d:", j + 1); - - ImGui::SameLine(); - - ImGui::PushID(j); - - ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 2.0f); - if(ImGui::BeginCombo("##Style", getStyleName(part.styles[j], _currentMass->armourCustomStyles()).data())) { - for(const auto& style : GameData::style_names) { - if(ImGui::Selectable(getStyleName(style.first, _currentMass->armourCustomStyles()).data(), part.styles[j] == style.first)) { - part.styles[j] = style.first; - } - } - - ImGui::EndCombo(); - } - - ImGui::PopID(); - } - - ImGui::EndGroup(); - - ImGui::Separator(); - - ImGui::PushID("Decal"); - - drawAlignedText("Showing/editing decal"); - for(std::uint32_t j = 0; j < part.decals.size(); j++) { - ImGui::SameLine(); - ImGui::RadioButton(std::to_string(j + 1).c_str(), &_selectedArmourDecals[i], int(j)); - } - - drawDecalEditor(part.decals[_selectedArmourDecals[i]]); - - ImGui::PopID(); - - if(!part.accessories.isEmpty()) { - ImGui::Separator(); - - ImGui::PushID("Accessory"); - - drawAlignedText("Showing/editing accessory"); - for(std::uint32_t j = 0; j < part.accessories.size(); j++) { - ImGui::SameLine(); - ImGui::RadioButton(std::string{char(65 + j)}.c_str(), &_selectedArmourAccessories[i], int(j)); - } - - drawAccessoryEditor(part.accessories[_selectedArmourAccessories[i]], _currentMass->armourCustomStyles()); - - ImGui::PopID(); - } - - ImGui::Separator(); - - if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) { - _modifiedBySaveTool = true; - if(!_currentMass->writeArmourPart(part.slot)) { - _modifiedBySaveTool = false; - _queue.addToast(Toast::Type::Error, _currentMass->lastError()); - } - } + ImGui::EndPopup(); } - ImGui::PopID(); + ImGui::SeparatorText("Styles"); + + for(std::int32_t i = 0; i < 4; i++) { + drawAlignedText("Slot %d:", i + 1); + + ImGui::SameLine(); + + ImGui::PushID(i); + if(ImGui::BeginCombo("##Style", + getStyleName(part.styles[i], _currentMass->armourCustomStyles()).data())) + { + for(const auto& style : GameData::style_names) { + if(ImGui::Selectable(getStyleName(style.first, _currentMass->armourCustomStyles()).data(), + part.styles[i] == style.first)) + { + part.styles[i] = style.first; + } + } + + ImGui::EndCombo(); + } + ImGui::PopID(); + } + + ImGui::SeparatorText("Decals"); + + constexpr static float selectable_width = 25.0f; + + drawAlignedText("Showing/editing decal:"); + ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f}); + for(std::uint32_t i = 0; i < part.decals.size(); i++) { + ImGui::SameLine(); + if(ImGui::Selectable(std::to_string(i + 1).c_str(), _selectedArmourDecals[*_selectedArmourSlot] == int(i), + ImGuiSelectableFlags_None, {selectable_width, 0.0f})) + { + _selectedArmourDecals[*_selectedArmourSlot] = int(i); + } + if(i != part.decals.size() - 1) { + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + } + } + ImGui::PopStyleVar(); + drawDecalEditor(part.decals[_selectedArmourDecals[*_selectedArmourSlot]]); + + if(!part.accessories.isEmpty()) { + ImGui::SeparatorText("Accessories"); + + drawAlignedText("Showing/editing accessory:"); + ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f}); + for(std::uint32_t i = 0; i < part.accessories.size(); i++) { + ImGui::SameLine(); + if(ImGui::Selectable((std::string{} + char(i + 65)).c_str(), + _selectedArmourAccessories[*_selectedArmourSlot] == int(i), + ImGuiSelectableFlags_None, {selectable_width, 0.0f})) + { + _selectedArmourAccessories[*_selectedArmourSlot] = int(i); + } + if(i != part.accessories.size() - 1) { + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + } + } + ImGui::PopStyleVar(); + drawAccessoryEditor(part.accessories[_selectedArmourAccessories[*_selectedArmourSlot]], + _currentMass->armourCustomStyles()); + } } - if(_currentMass->bulletLauncherAttachmentStyle() != GameObjects::BulletLauncherAttachmentStyle::NotFound && - ImGui::CollapsingHeader("Bullet launcher placement")) - { - drawAlignedText("Attachment style:"_s); - ImGui::SameLine(); - ImGui::RadioButton("Active one", - _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOne); - ImGui::SameLine(); - ImGui::RadioButton("Active one per slot", - _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot); - ImGui::SameLine(); - ImGui::RadioButton("All equipped", - _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::AllEquipped); - - ImGui::Separator(); - - drawAlignedText("Launcher slot:"); - ImGui::SameLine(); - ImGui::RadioButton("1", &_selectedBLPlacement, 0); - ImGui::SameLine(); - ImGui::RadioButton("2", &_selectedBLPlacement, 1); - ImGui::SameLine(); - ImGui::RadioButton("3", &_selectedBLPlacement, 2); - ImGui::SameLine(); - ImGui::RadioButton("4", &_selectedBLPlacement, 3); - - auto& placement = _currentMass->bulletLauncherAttachments()[_selectedBLPlacement]; - - static const Containers::StringView socket_labels[] = { - #define c(enumerator, enumstr, name) name, - #include "../Maps/BulletLauncherSockets.hpp" - #undef c - }; - - drawAlignedText("Socket:"); - ImGui::SameLine(); - if(ImGui::BeginCombo("##Socket", socket_labels[std::uint32_t(placement.socket)].data())) { - for(std::uint32_t i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) { - if(ImGui::Selectable(socket_labels[i].data(), i == std::uint32_t(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) { - placement.socket = static_cast(i); - } - } - ImGui::EndCombo(); - } - - if(placement.socket != GameObjects::BulletLauncherAttachment::Socket::Auto) { - ImGui::BeginGroup(); - drawAlignedText("Relative position:"); - drawAlignedText("Offset position:"); - drawAlignedText("Relative rotation:"); - drawAlignedText("Offset rotation:"); - drawAlignedText("Scale:"); - ImGui::EndGroup(); - - ImGui::SameLine(); - - ImGui::BeginGroup(); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##RelPosX", &placement.relativeLocation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RelPosY", &placement.relativeLocation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RelPosZ", &placement.relativeLocation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); - ImGui::PopItemWidth(); - - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##OffPosX", &placement.offsetLocation.x(), -500.0f, +500.0f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##OffPosY", &placement.offsetLocation.y(), -500.0f, +500.0f, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##OffPosZ", &placement.offsetLocation.z(), -500.0f, +500.0f, "Z: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(); - drawHelpMarker("+/-500.0 = +/-250 in-game"); - - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##RotX", &placement.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RotY", &placement.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RotZ", &placement.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f"); - ImGui::PopItemWidth(); - - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##RotOffsetZ", &placement.offsetRotation.z(), -180.0f, +180.0f, "Roll: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##RotOffsetX", &placement.offsetRotation.x(), -30.0f, +30.0f, "Pitch: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##RotOffsetY", &placement.offsetRotation.y(), -30.0f, +30.0f, "Yaw: %.3f"); - ImGui::PopItemWidth(); - - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##ScaleX", &placement.relativeScale.x(), 0.5f, 1.5f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##ScaleY", &placement.relativeScale.y(), 0.5f, 1.5f, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##ScaleZ", &placement.relativeScale.z(), 0.5f, 1.5f, "Z: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(); - drawHelpMarker("0.5 = 50 in-game\n1.5 = 150 in-game"); - ImGui::EndGroup(); - } + ImGui::EndChild(); + if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) { _modifiedBySaveTool = true; - if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); }) && - !_currentMass->writeBulletLauncherAttachments()) - { + if(!_currentMass->writeArmourPart(part.slot)) { _modifiedBySaveTool = false; _queue.addToast(Toast::Type::Error, _currentMass->lastError()); } } - ImGui::EndChild(); + ImGui::EndGroup(); +} + +void +Application::drawBLAttachment() { + if(!_currentMass || _currentMass->state() != GameObjects::Mass::State::Valid) { + return; + } + + drawAlignedText("Attachment style:"_s); + ImGui::SameLine(); + if(ImGui::RadioButton("Active one", + _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOne)) + { + _currentMass->bulletLauncherAttachmentStyle() = GameObjects::BulletLauncherAttachmentStyle::ActiveOne; + } + ImGui::SameLine(); + if(ImGui::RadioButton("Active one per slot", + _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot)) + { + _currentMass->bulletLauncherAttachmentStyle() = GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot; + } + ImGui::SameLine(); + if(ImGui::RadioButton("All equipped", + _currentMass->bulletLauncherAttachmentStyle() == GameObjects::BulletLauncherAttachmentStyle::AllEquipped)) + { + _currentMass->bulletLauncherAttachmentStyle() = GameObjects::BulletLauncherAttachmentStyle::ActiveOnePerSlot; + } + + ImGui::Separator(); + + constexpr static float selectable_width = 25.0f; + drawAlignedText("Launcher slot:"); + ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, {0.5f, 0.0f}); + for(auto i = 0u; i < _currentMass->bulletLauncherAttachments().size(); i++) { + ImGui::SameLine(); + if(ImGui::Selectable(std::to_string(i).c_str(), _selectedBLPlacement == i, ImGuiSelectableFlags_None, + {selectable_width, 0.0f})) + { + _selectedBLPlacement = i; + } + if(i != _currentMass->bulletLauncherAttachments().size() - 1) { + ImGui::SameLine(); + ImGui::SeparatorEx(ImGuiSeparatorFlags_Vertical); + } + } + ImGui::PopStyleVar(); + + auto& placement = _currentMass->bulletLauncherAttachments()[_selectedBLPlacement]; + + static const Containers::StringView socket_labels[] = { + #define c(enumerator, enumstr, name) name, + #include "../Maps/BulletLauncherSockets.hpp" + #undef c + }; + + drawAlignedText("Socket:"); + ImGui::SameLine(); + if(ImGui::BeginCombo("##Socket", socket_labels[std::uint32_t(placement.socket)].data())) { + for(std::uint32_t i = 0; i < (sizeof(socket_labels) / sizeof(socket_labels[0])); i++) { + if(ImGui::Selectable(socket_labels[i].data(), i == std::uint32_t(placement.socket), ImGuiSelectableFlags_SpanAvailWidth)) { + placement.socket = static_cast(i); + } + } + ImGui::EndCombo(); + } + + if(placement.socket != GameObjects::BulletLauncherAttachment::Socket::Auto) { + ImGui::BeginGroup(); + drawAlignedText("Relative position:"); + drawAlignedText("Offset position:"); + drawAlignedText("Relative rotation:"); + drawAlignedText("Offset rotation:"); + drawAlignedText("Scale:"); + ImGui::EndGroup(); + + ImGui::SameLine(); + + ImGui::BeginGroup(); + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::DragFloat("##RelPosX", &placement.relativeLocation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragFloat("##RelPosY", &placement.relativeLocation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragFloat("##RelPosZ", &placement.relativeLocation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); + ImGui::PopItemWidth(); + + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::SliderFloat("##OffPosX", &placement.offsetLocation.x(), -500.0f, +500.0f, "X: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##OffPosY", &placement.offsetLocation.y(), -500.0f, +500.0f, "Y: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##OffPosZ", &placement.offsetLocation.z(), -500.0f, +500.0f, "Z: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(); + drawHelpMarker("+/-500.0 = +/-250 in-game"); + + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::DragFloat("##RotX", &placement.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragFloat("##RotY", &placement.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragFloat("##RotZ", &placement.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f"); + ImGui::PopItemWidth(); + + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::SliderFloat("##RotOffsetZ", &placement.offsetRotation.z(), -180.0f, +180.0f, "Roll: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##RotOffsetX", &placement.offsetRotation.x(), -30.0f, +30.0f, "Pitch: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##RotOffsetY", &placement.offsetRotation.y(), -30.0f, +30.0f, "Yaw: %.3f"); + ImGui::PopItemWidth(); + + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::SliderFloat("##ScaleX", &placement.relativeScale.x(), 0.5f, 1.5f, "X: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##ScaleY", &placement.relativeScale.y(), 0.5f, 1.5f, "Y: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##ScaleZ", &placement.relativeScale.z(), 0.5f, 1.5f, "Z: %.3f"); + ImGui::PopItemWidth(); + ImGui::SameLine(); + drawHelpMarker("0.5 = 50 in-game\n1.5 = 150 in-game"); + ImGui::EndGroup(); + } + + _modifiedBySaveTool = true; + if(drawUnsafeWidget([]{ return ImGui::Button(ICON_FA_SAVE " Save"); })) { + _modifiedBySaveTool = true; + if(!_currentMass->writeBulletLauncherAttachments()) { + _modifiedBySaveTool = false; + _queue.addToast(Toast::Type::Error, _currentMass->lastError()); + } + } } void -- 2.39.5 From 22f5fc947c0aaba19292ef617fa483a2ea578dd4 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 8 Feb 2024 11:08:14 +0100 Subject: [PATCH 051/126] Application: use iterators for TextUnformatted calls. Corrade's string views aren't guaranteed to be null-terminated, though most of them come from strings, which _are_ null-terminated. Still, safety first. --- src/Application/Application.cpp | 2 +- src/Application/Application_MainManager.cpp | 7 ++++--- src/Application/Application_MassViewer.cpp | 2 +- src/Application/Application_MassViewer_Weapons.cpp | 4 ++-- src/Application/Application_ProfileManager.cpp | 4 ++-- src/Application/Application_drawAbout.cpp | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index ff5efea..c5a25bc 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -421,7 +421,7 @@ Application::drawTooltip(Containers::StringView text, float wrap_pos) { if(wrap_pos > 0.0f) { ImGui::PushTextWrapPos(wrap_pos); } - ImGui::TextUnformatted(text.data()); + ImGui::TextUnformatted(text.cbegin(), text.cend()); if(wrap_pos > 0.0f) { ImGui::PopTextWrapPos(); } diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index 0e70234..7fc52b5 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -360,7 +360,7 @@ Application::drawMaterialRow(Containers::StringView name, std::int32_t tier, Gam ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); ImGui::TableSetColumnIndex(1); - ImGui::TextUnformatted(name.data()); + ImGui::TextUnformatted(name.cbegin(), name.cend()); ImGui::TableSetColumnIndex(2); ImGui::Text("%i", _currentProfile->material(id)); if(conf().cheatMode()) { @@ -387,7 +387,7 @@ Application::drawUnavailableMaterialRow(Containers::StringView name, std::int32_ ImGui::TableSetColumnIndex(0); ImGui::Text("T%i", tier); ImGui::TableSetColumnIndex(1); - ImGui::TextUnformatted(name.begin(), name.end()); + ImGui::TextUnformatted(name.cbegin(), name.cend()); ImGui::TableSetColumnIndex(2); ImGui::TextDisabled("Unavailable as of game version " SAVETOOL_SUPPORTED_GAME_VERSION); } @@ -480,7 +480,8 @@ Application::drawMassManager() { ImGui::TextDisabled(""); break; case GameObjects::Mass::State::Valid: - ImGui::TextUnformatted(_massManager->hangar(i).name().data()); + ImGui::TextUnformatted(_massManager->hangar(i).name().cbegin(), + _massManager->hangar(i).name().cend()); break; } diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index d4c86c0..d1c6c86 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -319,7 +319,7 @@ Application::drawCustomStyle(GameObjects::CustomStyle& style) { } if(ImGui::BeginMenuBar()) { - ImGui::TextUnformatted(style.name.data()); + ImGui::TextUnformatted(style.name.cbegin(), style.name.cend()); static Containers::StaticArray<33, char> name_buf{ValueInit}; if(ImGui::SmallButton(ICON_FA_EDIT " Rename")) { diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 722b407..014ee91 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -257,7 +257,7 @@ Application::drawWeaponCategory(Containers::StringView name, Containers::ArrayVi { ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableNextColumn(); - ImGui::TextUnformatted(name.data()); + ImGui::TextUnformatted(name.cbegin(), name.cend()); ImGui::PushID(payload_type.data()); @@ -458,7 +458,7 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { } if(map->find(part.id) != map->cend()) { - ImGui::TextUnformatted(map->at(part.id).data()); + ImGui::TextUnformatted(map->at(part.id).cbegin(), map->at(part.id).cend()); } else if(part.id == -1) { ImGui::TextUnformatted(""); diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index 601b939..a8f4030 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -266,11 +266,11 @@ Application::drawBackupListPopup() { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - ImGui::TextUnformatted(backup.company.data()); + ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); if(ImGui::IsItemHovered()) { ImGui::BeginTooltip(); for(const auto& file : backup.includedFiles) { - ImGui::TextUnformatted(file.data()); + ImGui::TextUnformatted(file.cbegin()); } ImGui::EndTooltip(); } diff --git a/src/Application/Application_drawAbout.cpp b/src/Application/Application_drawAbout.cpp index 98e858e..ab52c74 100644 --- a/src/Application/Application_drawAbout.cpp +++ b/src/Application/Application_drawAbout.cpp @@ -92,7 +92,7 @@ Application::drawAbout() { if(ImGui::BeginChild("##GPL", {0.0f, float(windowSize().y()) * 0.3f}, ImGuiChildFlags_Border)) { static auto licence = _rs.getRaw("COPYING"); ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[1]); - ImGui::TextUnformatted(licence.begin(), licence.end()); + ImGui::TextUnformatted(licence.cbegin(), licence.cend()); ImGui::PopFont(); } ImGui::EndChild(); -- 2.39.5 From ca050b0e4863ce6fbb643e26c9fa997f5cdd5cdd Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 19:27:22 +0100 Subject: [PATCH 052/126] Update Corrade, Magnum, ImGui. --- third-party/corrade | 2 +- third-party/imgui | 2 +- third-party/magnum | 2 +- third-party/magnum-integration | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/third-party/corrade b/third-party/corrade index 4922edf..295bbba 160000 --- a/third-party/corrade +++ b/third-party/corrade @@ -1 +1 @@ -Subproject commit 4922edf269ce77efe073f6b750a34892e1f3c30d +Subproject commit 295bbba1f49887da060465f88b8501965f6acd7d diff --git a/third-party/imgui b/third-party/imgui index 7965494..3c435c0 160000 --- a/third-party/imgui +++ b/third-party/imgui @@ -1 +1 @@ -Subproject commit 7965494ff323c8a3232ac1233a08b984e3c981ae +Subproject commit 3c435c029788cc26c52e835e2feb262a3057addc diff --git a/third-party/magnum b/third-party/magnum index b91b0b2..7d0a821 160000 --- a/third-party/magnum +++ b/third-party/magnum @@ -1 +1 @@ -Subproject commit b91b0b24cde81a4eb9029cb2202b3a652c9bd0e9 +Subproject commit 7d0a8215d38284f7b7ae041cfbb19d410e5988a6 diff --git a/third-party/magnum-integration b/third-party/magnum-integration index bb8a4a8..f01593f 160000 --- a/third-party/magnum-integration +++ b/third-party/magnum-integration @@ -1 +1 @@ -Subproject commit bb8a4a870f217fc9ac15ff0ddc145974be49a5e7 +Subproject commit f01593fc94556bff23a848ac71187c56e034b6d9 -- 2.39.5 From 3a3b5bfdff3d84fb307b6f92ed77afe79dbfabb2 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 19:27:44 +0100 Subject: [PATCH 053/126] GameData: change the style name map's, well, name. --- src/Application/Application_MassViewer.cpp | 6 ++-- .../Application_MassViewer_Armour.cpp | 2 +- .../Application_MassViewer_Frame.cpp | 2 +- .../Application_MassViewer_Weapons.cpp | 2 +- src/Maps/StyleNames.h | 36 +------------------ 5 files changed, 7 insertions(+), 41 deletions(-) diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index d1c6c86..192ce5e 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -672,7 +672,7 @@ Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers:: ImGui::BeginGroup(); ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); if(ImGui::BeginCombo("##Style1", getStyleName(accessory.styles[0], style_view).data())) { - for(const auto& style : GameData::style_names) { + for(const auto& style : GameData::builtin_style_names) { if(ImGui::Selectable(getStyleName(style.first, style_view).data(), accessory.styles[0] == style.first)) { accessory.styles[0] = style.first; } @@ -683,7 +683,7 @@ Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers:: ImGui::PopItemWidth(); ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); if(ImGui::BeginCombo("##Style2", getStyleName(accessory.styles[1], style_view).data())) { - for(const auto& style : GameData::style_names) { + for(const auto& style : GameData::builtin_style_names) { if(ImGui::Selectable(getStyleName(style.first, style_view).data(), accessory.styles[1] == style.first)) { accessory.styles[1] = style.first; } @@ -762,7 +762,7 @@ Application::getStyleName(std::int32_t id, Containers::ArrayViewglobalStyles()[id - 50].name; } else { - return GameData::style_names.at(id); + return GameData::builtin_style_names.at(id); } } diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index 9ee33f5..21916bb 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -121,7 +121,7 @@ Application::drawArmour() { if(ImGui::BeginCombo("##Style", getStyleName(part.styles[i], _currentMass->armourCustomStyles()).data())) { - for(const auto& style : GameData::style_names) { + for(const auto& style : GameData::builtin_style_names) { if(ImGui::Selectable(getStyleName(style.first, _currentMass->armourCustomStyles()).data(), part.styles[i] == style.first)) { diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index 35e3f8b..0674791 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -179,7 +179,7 @@ Application::drawFrameStyles() { if(ImGui::BeginCombo("##Style", getStyleName(_currentMass->frameStyles()[i], _currentMass->frameCustomStyles()).data())) { - for(const auto& style : GameData::style_names) { + for(const auto& style : GameData::builtin_style_names) { if(ImGui::Selectable(getStyleName(style.first, _currentMass->frameCustomStyles()).data(), _currentMass->frameStyles()[i] == style.first)) { diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 014ee91..a46f08d 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -515,7 +515,7 @@ Application::drawWeaponEditor(GameObjects::Weapon& weapon) { ImGui::PushID(i); if(ImGui::BeginCombo("##Style", getStyleName(part.styles[i], weapon.customStyles).data())) { - for(const auto& style: GameData::style_names) { + for(const auto& style: GameData::builtin_style_names) { if(ImGui::Selectable(getStyleName(style.first, weapon.customStyles).data(), part.styles[i] == style.first)) { part.styles[i] = style.first; diff --git a/src/Maps/StyleNames.h b/src/Maps/StyleNames.h index e977b3b..575f63f 100644 --- a/src/Maps/StyleNames.h +++ b/src/Maps/StyleNames.h @@ -27,43 +27,9 @@ using namespace Containers::Literals; namespace mbst { namespace GameData { -extern const std::map style_names +extern const std::map builtin_style_names #ifdef STYLENAMES_DEFINITION { - {0, "Custom Style 1"_s}, - {1, "Custom Style 2"_s}, - {2, "Custom Style 3"_s}, - {3, "Custom Style 4"_s}, - {4, "Custom Style 5"_s}, - {5, "Custom Style 6"_s}, - {6, "Custom Style 7"_s}, - {7, "Custom Style 8"_s}, - {8, "Custom Style 9"_s}, - {9, "Custom Style 10"_s}, - {10, "Custom Style 11"_s}, - {11, "Custom Style 12"_s}, - {12, "Custom Style 13"_s}, - {13, "Custom Style 14"_s}, - {14, "Custom Style 15"_s}, - {15, "Custom Style 16"_s}, - - {50, "Global Style 1"_s}, - {51, "Global Style 2"_s}, - {52, "Global Style 3"_s}, - {53, "Global Style 4"_s}, - {54, "Global Style 5"_s}, - {55, "Global Style 6"_s}, - {56, "Global Style 7"_s}, - {57, "Global Style 8"_s}, - {58, "Global Style 9"_s}, - {59, "Global Style 10"_s}, - {60, "Global Style 11"_s}, - {61, "Global Style 12"_s}, - {62, "Global Style 13"_s}, - {63, "Global Style 14"_s}, - {64, "Global Style 15"_s}, - {65, "Global Style 16"_s}, - {100, "Iron"_s}, {101, "Silver"_s}, {102, "Gold"_s}, -- 2.39.5 From e156196b98e432136adeeba07f35cee3c3115b27 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 20:25:32 +0100 Subject: [PATCH 054/126] Update copyright year. Now's a good time as any, I guess. --- CMakeLists.txt | 2 +- src/Application/Application.cpp | 2 +- src/Application/Application.h | 2 +- src/Application/Application_FileWatcher.cpp | 2 +- src/Application/Application_Initialisation.cpp | 2 +- src/Application/Application_MainManager.cpp | 2 +- src/Application/Application_MassViewer.cpp | 2 +- src/Application/Application_MassViewer_Armour.cpp | 2 +- src/Application/Application_MassViewer_Frame.cpp | 2 +- src/Application/Application_MassViewer_Weapons.cpp | 2 +- src/Application/Application_ProfileManager.cpp | 2 +- src/Application/Application_UpdateChecker.cpp | 2 +- src/Application/Application_drawAbout.cpp | 2 +- src/Application/Application_drawMainMenu.cpp | 2 +- src/CMakeLists.txt | 2 +- src/Configuration/Configuration.cpp | 2 +- src/Configuration/Configuration.h | 2 +- src/Gvas/BinaryReader.cpp | 2 +- src/Gvas/BinaryReader.h | 2 +- src/Gvas/BinaryWriter.cpp | 2 +- src/Gvas/BinaryWriter.h | 2 +- src/Gvas/CMakeLists.txt | 2 +- src/Gvas/Debug.cpp | 2 +- src/Gvas/Debug.h | 2 +- src/Gvas/File.cpp | 2 +- src/Gvas/File.h | 2 +- src/Gvas/Gvas.h | 2 +- src/Gvas/PropertySerialiser.cpp | 2 +- src/Gvas/PropertySerialiser.h | 2 +- src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h | 2 +- src/Gvas/Serialisers/AbstractUnrealProperty.h | 2 +- src/Gvas/Serialisers/AbstractUnrealStruct.h | 2 +- src/Gvas/Serialisers/ArrayProperty.cpp | 2 +- src/Gvas/Serialisers/ArrayProperty.h | 2 +- src/Gvas/Serialisers/BoolProperty.cpp | 2 +- src/Gvas/Serialisers/BoolProperty.h | 2 +- src/Gvas/Serialisers/ByteProperty.cpp | 2 +- src/Gvas/Serialisers/ByteProperty.h | 2 +- src/Gvas/Serialisers/ColourProperty.cpp | 2 +- src/Gvas/Serialisers/ColourProperty.h | 2 +- src/Gvas/Serialisers/DateTimeProperty.cpp | 2 +- src/Gvas/Serialisers/DateTimeProperty.h | 2 +- src/Gvas/Serialisers/EnumProperty.cpp | 2 +- src/Gvas/Serialisers/EnumProperty.h | 2 +- src/Gvas/Serialisers/FloatProperty.cpp | 2 +- src/Gvas/Serialisers/FloatProperty.h | 2 +- src/Gvas/Serialisers/GuidProperty.cpp | 2 +- src/Gvas/Serialisers/GuidProperty.h | 2 +- src/Gvas/Serialisers/IntProperty.cpp | 2 +- src/Gvas/Serialisers/IntProperty.h | 2 +- src/Gvas/Serialisers/MapProperty.cpp | 2 +- src/Gvas/Serialisers/MapProperty.h | 2 +- src/Gvas/Serialisers/ResourceProperty.cpp | 2 +- src/Gvas/Serialisers/ResourceProperty.h | 2 +- src/Gvas/Serialisers/RotatorProperty.cpp | 2 +- src/Gvas/Serialisers/RotatorProperty.h | 2 +- src/Gvas/Serialisers/Serialisers.h | 2 +- src/Gvas/Serialisers/SetProperty.cpp | 2 +- src/Gvas/Serialisers/SetProperty.h | 2 +- src/Gvas/Serialisers/StringProperty.cpp | 2 +- src/Gvas/Serialisers/StringProperty.h | 2 +- src/Gvas/Serialisers/Struct.cpp | 2 +- src/Gvas/Serialisers/Struct.h | 2 +- src/Gvas/Serialisers/TextProperty.cpp | 2 +- src/Gvas/Serialisers/TextProperty.h | 2 +- src/Gvas/Serialisers/UnrealProperty.h | 2 +- src/Gvas/Serialisers/Vector2DProperty.cpp | 2 +- src/Gvas/Serialisers/Vector2DProperty.h | 2 +- src/Gvas/Serialisers/VectorProperty.cpp | 2 +- src/Gvas/Serialisers/VectorProperty.h | 2 +- src/Gvas/Types/ArrayProperty.h | 2 +- src/Gvas/Types/BoolProperty.h | 2 +- src/Gvas/Types/ByteProperty.h | 2 +- src/Gvas/Types/ColourStructProperty.h | 2 +- src/Gvas/Types/DateTimeStructProperty.h | 2 +- src/Gvas/Types/EnumProperty.h | 2 +- src/Gvas/Types/FloatProperty.h | 2 +- src/Gvas/Types/GenericStructProperty.h | 2 +- src/Gvas/Types/GuidStructProperty.h | 2 +- src/Gvas/Types/IntProperty.h | 2 +- src/Gvas/Types/MapProperty.h | 2 +- src/Gvas/Types/NoneProperty.h | 2 +- src/Gvas/Types/ResourceItemValue.h | 2 +- src/Gvas/Types/RotatorStructProperty.h | 2 +- src/Gvas/Types/SetProperty.h | 2 +- src/Gvas/Types/StringProperty.h | 2 +- src/Gvas/Types/StructProperty.h | 2 +- src/Gvas/Types/TextProperty.h | 2 +- src/Gvas/Types/Types.h | 2 +- src/Gvas/Types/UnrealProperty.h | 2 +- src/Gvas/Types/UnrealPropertyBase.h | 2 +- src/Gvas/Types/Vector2DStructProperty.h | 2 +- src/Gvas/Types/VectorStructProperty.h | 2 +- src/Logger/CMakeLists.txt | 2 +- src/Logger/EntryType.h | 2 +- src/Logger/Logger.cpp | 2 +- src/Logger/Logger.h | 2 +- src/Logger/MagnumLogBuffer.cpp | 2 +- src/Logger/MagnumLogBuffer.h | 2 +- src/Maps/Accessories.h | 2 +- src/Maps/ArmourSets.h | 2 +- src/Maps/ArmourSlots.hpp | 2 +- src/Maps/BulletLauncherAttachmentStyles.hpp | 2 +- src/Maps/BulletLauncherSockets.hpp | 2 +- src/Maps/DamageTypes.hpp | 2 +- src/Maps/EffectColourModes.hpp | 2 +- src/Maps/LastMissionId.h | 2 +- src/Maps/StoryProgress.h | 2 +- src/Maps/StyleNames.h | 2 +- src/Maps/WeaponParts.h | 2 +- src/Maps/WeaponTypes.hpp | 2 +- src/Mass/Accessory.h | 2 +- src/Mass/ArmourPart.h | 2 +- src/Mass/BulletLauncherAttachment.h | 2 +- src/Mass/CustomStyle.h | 2 +- src/Mass/Decal.h | 2 +- src/Mass/Joints.h | 2 +- src/Mass/Mass.cpp | 2 +- src/Mass/Mass.h | 2 +- src/Mass/Mass_Armour.cpp | 2 +- src/Mass/Mass_DecalsAccessories.cpp | 2 +- src/Mass/Mass_Frame.cpp | 2 +- src/Mass/Mass_Styles.cpp | 2 +- src/Mass/Mass_Weapons.cpp | 2 +- src/Mass/Weapon.cpp | 2 +- src/Mass/Weapon.h | 2 +- src/Mass/WeaponPart.h | 2 +- src/MassManager/MassManager.cpp | 2 +- src/MassManager/MassManager.h | 2 +- src/Profile/Profile.cpp | 2 +- src/Profile/Profile.h | 2 +- src/Profile/ResourceIDs.h | 2 +- src/ProfileManager/ProfileManager.cpp | 2 +- src/ProfileManager/ProfileManager.h | 2 +- src/ToastQueue/ToastQueue.cpp | 2 +- src/ToastQueue/ToastQueue.h | 2 +- src/UpdateChecker/UpdateChecker.cpp | 2 +- src/UpdateChecker/UpdateChecker.h | 2 +- src/Utilities/Crc32.cpp | 2 +- src/Utilities/Crc32.h | 2 +- src/Version/Version.cpp | 2 +- src/Version/Version.h | 2 +- src/main.cpp | 2 +- src/resource.rc | 2 +- 144 files changed, 144 insertions(+), 144 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59945a2..282abff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2022 Guillaume Jacquemin +# Copyright (C) 2021-2024 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index c5a25bc..c066d29 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application.h b/src/Application/Application.h index 71141b1..bb3190a 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_FileWatcher.cpp b/src/Application/Application_FileWatcher.cpp index f99f40b..5dfdf8d 100644 --- a/src/Application/Application_FileWatcher.cpp +++ b/src/Application/Application_FileWatcher.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 606f7cc..87621ce 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index 7fc52b5..e3fb5e7 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index 192ce5e..34d13a8 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index 21916bb..5579f96 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index 0674791..347374d 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index a46f08d..96b3c9f 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index a8f4030..5f77c59 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_UpdateChecker.cpp b/src/Application/Application_UpdateChecker.cpp index 6fe63c1..828c7a6 100644 --- a/src/Application/Application_UpdateChecker.cpp +++ b/src/Application/Application_UpdateChecker.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_drawAbout.cpp b/src/Application/Application_drawAbout.cpp index ab52c74..c8ef16c 100644 --- a/src/Application/Application_drawAbout.cpp +++ b/src/Application/Application_drawAbout.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Application/Application_drawMainMenu.cpp b/src/Application/Application_drawMainMenu.cpp index 290e8cd..de66c4b 100644 --- a/src/Application/Application_drawMainMenu.cpp +++ b/src/Application/Application_drawMainMenu.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ed96a2f..7ce39ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2023 Guillaume Jacquemin +# Copyright (C) 2021-2024 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index 038b5c8..70d4255 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index c3be643..dcf4c46 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/BinaryReader.cpp b/src/Gvas/BinaryReader.cpp index 91e69c8..bc876fe 100644 --- a/src/Gvas/BinaryReader.cpp +++ b/src/Gvas/BinaryReader.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/BinaryReader.h b/src/Gvas/BinaryReader.h index d6c9d36..4fc52b9 100644 --- a/src/Gvas/BinaryReader.h +++ b/src/Gvas/BinaryReader.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/BinaryWriter.cpp b/src/Gvas/BinaryWriter.cpp index 05a04e0..1b3d904 100644 --- a/src/Gvas/BinaryWriter.cpp +++ b/src/Gvas/BinaryWriter.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/BinaryWriter.h b/src/Gvas/BinaryWriter.h index 7dfceba..9018a9b 100644 --- a/src/Gvas/BinaryWriter.h +++ b/src/Gvas/BinaryWriter.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/CMakeLists.txt b/src/Gvas/CMakeLists.txt index c635c3c..5f16a0b 100644 --- a/src/Gvas/CMakeLists.txt +++ b/src/Gvas/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2023 Guillaume Jacquemin +# Copyright (C) 2021-2024 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Debug.cpp b/src/Gvas/Debug.cpp index 56f2141..8afbb74 100644 --- a/src/Gvas/Debug.cpp +++ b/src/Gvas/Debug.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Debug.h b/src/Gvas/Debug.h index 55dacd2..f26c87b 100644 --- a/src/Gvas/Debug.h +++ b/src/Gvas/Debug.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/File.cpp b/src/Gvas/File.cpp index c9b9d24..7e9b0aa 100644 --- a/src/Gvas/File.cpp +++ b/src/Gvas/File.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/File.h b/src/Gvas/File.h index 0af071c..117252b 100644 --- a/src/Gvas/File.h +++ b/src/Gvas/File.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Gvas.h b/src/Gvas/Gvas.h index fad929c..0d52b13 100644 --- a/src/Gvas/Gvas.h +++ b/src/Gvas/Gvas.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/PropertySerialiser.cpp b/src/Gvas/PropertySerialiser.cpp index 2aa5c10..e60cfae 100644 --- a/src/Gvas/PropertySerialiser.cpp +++ b/src/Gvas/PropertySerialiser.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/PropertySerialiser.h b/src/Gvas/PropertySerialiser.h index 79889d9..4989642 100644 --- a/src/Gvas/PropertySerialiser.h +++ b/src/Gvas/PropertySerialiser.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h index 8d7a390..a4cefb6 100644 --- a/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h +++ b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/AbstractUnrealProperty.h b/src/Gvas/Serialisers/AbstractUnrealProperty.h index 11c8359..f0945f2 100644 --- a/src/Gvas/Serialisers/AbstractUnrealProperty.h +++ b/src/Gvas/Serialisers/AbstractUnrealProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/AbstractUnrealStruct.h b/src/Gvas/Serialisers/AbstractUnrealStruct.h index e08dfc9..1232e21 100644 --- a/src/Gvas/Serialisers/AbstractUnrealStruct.h +++ b/src/Gvas/Serialisers/AbstractUnrealStruct.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ArrayProperty.cpp b/src/Gvas/Serialisers/ArrayProperty.cpp index 83829ae..d1305ad 100644 --- a/src/Gvas/Serialisers/ArrayProperty.cpp +++ b/src/Gvas/Serialisers/ArrayProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ArrayProperty.h b/src/Gvas/Serialisers/ArrayProperty.h index 6f50b95..078a79c 100644 --- a/src/Gvas/Serialisers/ArrayProperty.h +++ b/src/Gvas/Serialisers/ArrayProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/BoolProperty.cpp b/src/Gvas/Serialisers/BoolProperty.cpp index c67e6ec..0d831f5 100644 --- a/src/Gvas/Serialisers/BoolProperty.cpp +++ b/src/Gvas/Serialisers/BoolProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/BoolProperty.h b/src/Gvas/Serialisers/BoolProperty.h index 58171e4..9af5fab 100644 --- a/src/Gvas/Serialisers/BoolProperty.h +++ b/src/Gvas/Serialisers/BoolProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ByteProperty.cpp b/src/Gvas/Serialisers/ByteProperty.cpp index 1463798..7f92233 100644 --- a/src/Gvas/Serialisers/ByteProperty.cpp +++ b/src/Gvas/Serialisers/ByteProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ByteProperty.h b/src/Gvas/Serialisers/ByteProperty.h index adb4201..fccbad0 100644 --- a/src/Gvas/Serialisers/ByteProperty.h +++ b/src/Gvas/Serialisers/ByteProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ColourProperty.cpp b/src/Gvas/Serialisers/ColourProperty.cpp index 1af0ea1..4d5a7b0 100644 --- a/src/Gvas/Serialisers/ColourProperty.cpp +++ b/src/Gvas/Serialisers/ColourProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ColourProperty.h b/src/Gvas/Serialisers/ColourProperty.h index 173c6f2..6d5f5a7 100644 --- a/src/Gvas/Serialisers/ColourProperty.h +++ b/src/Gvas/Serialisers/ColourProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/DateTimeProperty.cpp b/src/Gvas/Serialisers/DateTimeProperty.cpp index 1be9685..8eb2ed8 100644 --- a/src/Gvas/Serialisers/DateTimeProperty.cpp +++ b/src/Gvas/Serialisers/DateTimeProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/DateTimeProperty.h b/src/Gvas/Serialisers/DateTimeProperty.h index ca604a2..d96c86c 100644 --- a/src/Gvas/Serialisers/DateTimeProperty.h +++ b/src/Gvas/Serialisers/DateTimeProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/EnumProperty.cpp b/src/Gvas/Serialisers/EnumProperty.cpp index 4e8125a..dbb133e 100644 --- a/src/Gvas/Serialisers/EnumProperty.cpp +++ b/src/Gvas/Serialisers/EnumProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/EnumProperty.h b/src/Gvas/Serialisers/EnumProperty.h index be1ade7..86ebd8f 100644 --- a/src/Gvas/Serialisers/EnumProperty.h +++ b/src/Gvas/Serialisers/EnumProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/FloatProperty.cpp b/src/Gvas/Serialisers/FloatProperty.cpp index e3cf14c..0833533 100644 --- a/src/Gvas/Serialisers/FloatProperty.cpp +++ b/src/Gvas/Serialisers/FloatProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/FloatProperty.h b/src/Gvas/Serialisers/FloatProperty.h index bde9188..752c194 100644 --- a/src/Gvas/Serialisers/FloatProperty.h +++ b/src/Gvas/Serialisers/FloatProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/GuidProperty.cpp b/src/Gvas/Serialisers/GuidProperty.cpp index ff173b8..9b8ccc0 100644 --- a/src/Gvas/Serialisers/GuidProperty.cpp +++ b/src/Gvas/Serialisers/GuidProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/GuidProperty.h b/src/Gvas/Serialisers/GuidProperty.h index 8de587c..0fe5378 100644 --- a/src/Gvas/Serialisers/GuidProperty.h +++ b/src/Gvas/Serialisers/GuidProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/IntProperty.cpp b/src/Gvas/Serialisers/IntProperty.cpp index 94f51d7..156118f 100644 --- a/src/Gvas/Serialisers/IntProperty.cpp +++ b/src/Gvas/Serialisers/IntProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/IntProperty.h b/src/Gvas/Serialisers/IntProperty.h index 777d625..9f8108d 100644 --- a/src/Gvas/Serialisers/IntProperty.h +++ b/src/Gvas/Serialisers/IntProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/MapProperty.cpp b/src/Gvas/Serialisers/MapProperty.cpp index 7893447..992e5d7 100644 --- a/src/Gvas/Serialisers/MapProperty.cpp +++ b/src/Gvas/Serialisers/MapProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/MapProperty.h b/src/Gvas/Serialisers/MapProperty.h index f992653..7bf2231 100644 --- a/src/Gvas/Serialisers/MapProperty.h +++ b/src/Gvas/Serialisers/MapProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ResourceProperty.cpp b/src/Gvas/Serialisers/ResourceProperty.cpp index da63c1e..2564fe1 100644 --- a/src/Gvas/Serialisers/ResourceProperty.cpp +++ b/src/Gvas/Serialisers/ResourceProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/ResourceProperty.h b/src/Gvas/Serialisers/ResourceProperty.h index db97155..7f933a5 100644 --- a/src/Gvas/Serialisers/ResourceProperty.h +++ b/src/Gvas/Serialisers/ResourceProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/RotatorProperty.cpp b/src/Gvas/Serialisers/RotatorProperty.cpp index 66ce58e..d468e20 100644 --- a/src/Gvas/Serialisers/RotatorProperty.cpp +++ b/src/Gvas/Serialisers/RotatorProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/RotatorProperty.h b/src/Gvas/Serialisers/RotatorProperty.h index a2df613..6eb7f1c 100644 --- a/src/Gvas/Serialisers/RotatorProperty.h +++ b/src/Gvas/Serialisers/RotatorProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/Serialisers.h b/src/Gvas/Serialisers/Serialisers.h index 182a7d7..8c8470c 100644 --- a/src/Gvas/Serialisers/Serialisers.h +++ b/src/Gvas/Serialisers/Serialisers.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/SetProperty.cpp b/src/Gvas/Serialisers/SetProperty.cpp index 5237483..61eb199 100644 --- a/src/Gvas/Serialisers/SetProperty.cpp +++ b/src/Gvas/Serialisers/SetProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/SetProperty.h b/src/Gvas/Serialisers/SetProperty.h index ca2629e..d95a39c 100644 --- a/src/Gvas/Serialisers/SetProperty.h +++ b/src/Gvas/Serialisers/SetProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/StringProperty.cpp b/src/Gvas/Serialisers/StringProperty.cpp index e3fee8e..b329628 100644 --- a/src/Gvas/Serialisers/StringProperty.cpp +++ b/src/Gvas/Serialisers/StringProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/StringProperty.h b/src/Gvas/Serialisers/StringProperty.h index f66fd98..cc783da 100644 --- a/src/Gvas/Serialisers/StringProperty.h +++ b/src/Gvas/Serialisers/StringProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/Struct.cpp b/src/Gvas/Serialisers/Struct.cpp index 3602d66..65b5074 100644 --- a/src/Gvas/Serialisers/Struct.cpp +++ b/src/Gvas/Serialisers/Struct.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/Struct.h b/src/Gvas/Serialisers/Struct.h index c26740c..19931f2 100644 --- a/src/Gvas/Serialisers/Struct.h +++ b/src/Gvas/Serialisers/Struct.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/TextProperty.cpp b/src/Gvas/Serialisers/TextProperty.cpp index 4850cd0..3b51846 100644 --- a/src/Gvas/Serialisers/TextProperty.cpp +++ b/src/Gvas/Serialisers/TextProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/TextProperty.h b/src/Gvas/Serialisers/TextProperty.h index 496c955..3d47cbe 100644 --- a/src/Gvas/Serialisers/TextProperty.h +++ b/src/Gvas/Serialisers/TextProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/UnrealProperty.h b/src/Gvas/Serialisers/UnrealProperty.h index 4ba6b24..507dde8 100644 --- a/src/Gvas/Serialisers/UnrealProperty.h +++ b/src/Gvas/Serialisers/UnrealProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/Vector2DProperty.cpp b/src/Gvas/Serialisers/Vector2DProperty.cpp index 40f69eb..f58fde0 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.cpp +++ b/src/Gvas/Serialisers/Vector2DProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/Vector2DProperty.h b/src/Gvas/Serialisers/Vector2DProperty.h index daee73d..4789d6b 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.h +++ b/src/Gvas/Serialisers/Vector2DProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/VectorProperty.cpp b/src/Gvas/Serialisers/VectorProperty.cpp index 2dc84db..7c8294f 100644 --- a/src/Gvas/Serialisers/VectorProperty.cpp +++ b/src/Gvas/Serialisers/VectorProperty.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Serialisers/VectorProperty.h b/src/Gvas/Serialisers/VectorProperty.h index d0af522..e24881f 100644 --- a/src/Gvas/Serialisers/VectorProperty.h +++ b/src/Gvas/Serialisers/VectorProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/ArrayProperty.h b/src/Gvas/Types/ArrayProperty.h index 65d73d6..2453443 100644 --- a/src/Gvas/Types/ArrayProperty.h +++ b/src/Gvas/Types/ArrayProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/BoolProperty.h b/src/Gvas/Types/BoolProperty.h index eda8b72..b32c888 100644 --- a/src/Gvas/Types/BoolProperty.h +++ b/src/Gvas/Types/BoolProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/ByteProperty.h b/src/Gvas/Types/ByteProperty.h index cc9065a..ec95ac4 100644 --- a/src/Gvas/Types/ByteProperty.h +++ b/src/Gvas/Types/ByteProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/ColourStructProperty.h b/src/Gvas/Types/ColourStructProperty.h index cc69b1d..f614db4 100644 --- a/src/Gvas/Types/ColourStructProperty.h +++ b/src/Gvas/Types/ColourStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/DateTimeStructProperty.h b/src/Gvas/Types/DateTimeStructProperty.h index a917055..b20604d 100644 --- a/src/Gvas/Types/DateTimeStructProperty.h +++ b/src/Gvas/Types/DateTimeStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/EnumProperty.h b/src/Gvas/Types/EnumProperty.h index 834cf8f..e042578 100644 --- a/src/Gvas/Types/EnumProperty.h +++ b/src/Gvas/Types/EnumProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/FloatProperty.h b/src/Gvas/Types/FloatProperty.h index 7d9ea3f..433d7d8 100644 --- a/src/Gvas/Types/FloatProperty.h +++ b/src/Gvas/Types/FloatProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/GenericStructProperty.h b/src/Gvas/Types/GenericStructProperty.h index 409d601..deea124 100644 --- a/src/Gvas/Types/GenericStructProperty.h +++ b/src/Gvas/Types/GenericStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/GuidStructProperty.h b/src/Gvas/Types/GuidStructProperty.h index 1b53b56..e822273 100644 --- a/src/Gvas/Types/GuidStructProperty.h +++ b/src/Gvas/Types/GuidStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/IntProperty.h b/src/Gvas/Types/IntProperty.h index c966397..6ca3de3 100644 --- a/src/Gvas/Types/IntProperty.h +++ b/src/Gvas/Types/IntProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/MapProperty.h b/src/Gvas/Types/MapProperty.h index 44f8ec8..0d8575a 100644 --- a/src/Gvas/Types/MapProperty.h +++ b/src/Gvas/Types/MapProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/NoneProperty.h b/src/Gvas/Types/NoneProperty.h index 4d8dfdd..e8e339c 100644 --- a/src/Gvas/Types/NoneProperty.h +++ b/src/Gvas/Types/NoneProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/ResourceItemValue.h b/src/Gvas/Types/ResourceItemValue.h index a6f0e63..5ae9683 100644 --- a/src/Gvas/Types/ResourceItemValue.h +++ b/src/Gvas/Types/ResourceItemValue.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/RotatorStructProperty.h b/src/Gvas/Types/RotatorStructProperty.h index 5579a33..ad2d676 100644 --- a/src/Gvas/Types/RotatorStructProperty.h +++ b/src/Gvas/Types/RotatorStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/SetProperty.h b/src/Gvas/Types/SetProperty.h index deffd22..dac31d1 100644 --- a/src/Gvas/Types/SetProperty.h +++ b/src/Gvas/Types/SetProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/StringProperty.h b/src/Gvas/Types/StringProperty.h index cfc4ebe..d29f7cb 100644 --- a/src/Gvas/Types/StringProperty.h +++ b/src/Gvas/Types/StringProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/StructProperty.h b/src/Gvas/Types/StructProperty.h index 541f0db..bcb48a8 100644 --- a/src/Gvas/Types/StructProperty.h +++ b/src/Gvas/Types/StructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/TextProperty.h b/src/Gvas/Types/TextProperty.h index 7392dfe..15a4432 100644 --- a/src/Gvas/Types/TextProperty.h +++ b/src/Gvas/Types/TextProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/Types.h b/src/Gvas/Types/Types.h index 8ebe58a..584f8c6 100644 --- a/src/Gvas/Types/Types.h +++ b/src/Gvas/Types/Types.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/UnrealProperty.h b/src/Gvas/Types/UnrealProperty.h index 6f9fe39..ce1fd3e 100644 --- a/src/Gvas/Types/UnrealProperty.h +++ b/src/Gvas/Types/UnrealProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/UnrealPropertyBase.h b/src/Gvas/Types/UnrealPropertyBase.h index 01ca885..2cf2883 100644 --- a/src/Gvas/Types/UnrealPropertyBase.h +++ b/src/Gvas/Types/UnrealPropertyBase.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/Vector2DStructProperty.h b/src/Gvas/Types/Vector2DStructProperty.h index 67f1127..3ad8338 100644 --- a/src/Gvas/Types/Vector2DStructProperty.h +++ b/src/Gvas/Types/Vector2DStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Gvas/Types/VectorStructProperty.h b/src/Gvas/Types/VectorStructProperty.h index c7e277d..1960d17 100644 --- a/src/Gvas/Types/VectorStructProperty.h +++ b/src/Gvas/Types/VectorStructProperty.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/CMakeLists.txt b/src/Logger/CMakeLists.txt index 2f4611e..8ce4672 100644 --- a/src/Logger/CMakeLists.txt +++ b/src/Logger/CMakeLists.txt @@ -1,5 +1,5 @@ # MassBuilderSaveTool -# Copyright (C) 2021-2023 Guillaume Jacquemin +# Copyright (C) 2021-2024 Guillaume Jacquemin # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/src/Logger/EntryType.h b/src/Logger/EntryType.h index 2fd79b9..1a8af03 100644 --- a/src/Logger/EntryType.h +++ b/src/Logger/EntryType.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index b550f99..b3d9f03 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index cbe309d..e75dbfe 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/MagnumLogBuffer.cpp b/src/Logger/MagnumLogBuffer.cpp index 82f3d4a..7f2f0e8 100644 --- a/src/Logger/MagnumLogBuffer.cpp +++ b/src/Logger/MagnumLogBuffer.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Logger/MagnumLogBuffer.h b/src/Logger/MagnumLogBuffer.h index da45b04..60872d7 100644 --- a/src/Logger/MagnumLogBuffer.h +++ b/src/Logger/MagnumLogBuffer.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/Accessories.h b/src/Maps/Accessories.h index 8f8b7b4..7ac7529 100644 --- a/src/Maps/Accessories.h +++ b/src/Maps/Accessories.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/ArmourSets.h b/src/Maps/ArmourSets.h index 6aeb01b..85c1762 100644 --- a/src/Maps/ArmourSets.h +++ b/src/Maps/ArmourSets.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/ArmourSlots.hpp b/src/Maps/ArmourSlots.hpp index 0db50e7..46fbabb 100644 --- a/src/Maps/ArmourSlots.hpp +++ b/src/Maps/ArmourSlots.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/BulletLauncherAttachmentStyles.hpp b/src/Maps/BulletLauncherAttachmentStyles.hpp index 20cb257..95d9d44 100644 --- a/src/Maps/BulletLauncherAttachmentStyles.hpp +++ b/src/Maps/BulletLauncherAttachmentStyles.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/BulletLauncherSockets.hpp b/src/Maps/BulletLauncherSockets.hpp index 50114ec..c6819f6 100644 --- a/src/Maps/BulletLauncherSockets.hpp +++ b/src/Maps/BulletLauncherSockets.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/DamageTypes.hpp b/src/Maps/DamageTypes.hpp index f80064e..1022a5d 100644 --- a/src/Maps/DamageTypes.hpp +++ b/src/Maps/DamageTypes.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/EffectColourModes.hpp b/src/Maps/EffectColourModes.hpp index f5fb64d..13b37e6 100644 --- a/src/Maps/EffectColourModes.hpp +++ b/src/Maps/EffectColourModes.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/LastMissionId.h b/src/Maps/LastMissionId.h index f535ca1..3f041c8 100644 --- a/src/Maps/LastMissionId.h +++ b/src/Maps/LastMissionId.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/StoryProgress.h b/src/Maps/StoryProgress.h index e5f4938..d620c53 100644 --- a/src/Maps/StoryProgress.h +++ b/src/Maps/StoryProgress.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/StyleNames.h b/src/Maps/StyleNames.h index 575f63f..3dbe5b8 100644 --- a/src/Maps/StyleNames.h +++ b/src/Maps/StyleNames.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/WeaponParts.h b/src/Maps/WeaponParts.h index f8f49ae..e0fb8d8 100644 --- a/src/Maps/WeaponParts.h +++ b/src/Maps/WeaponParts.h @@ -1,6 +1,6 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Maps/WeaponTypes.hpp b/src/Maps/WeaponTypes.hpp index 878846a..9a4e048 100644 --- a/src/Maps/WeaponTypes.hpp +++ b/src/Maps/WeaponTypes.hpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Accessory.h b/src/Mass/Accessory.h index c72600a..6779d2e 100644 --- a/src/Mass/Accessory.h +++ b/src/Mass/Accessory.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/ArmourPart.h b/src/Mass/ArmourPart.h index e4314a4..1b8076d 100644 --- a/src/Mass/ArmourPart.h +++ b/src/Mass/ArmourPart.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/BulletLauncherAttachment.h b/src/Mass/BulletLauncherAttachment.h index b111064..7f9b58b 100644 --- a/src/Mass/BulletLauncherAttachment.h +++ b/src/Mass/BulletLauncherAttachment.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/CustomStyle.h b/src/Mass/CustomStyle.h index bfdcdd4..b041f8c 100644 --- a/src/Mass/CustomStyle.h +++ b/src/Mass/CustomStyle.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Decal.h b/src/Mass/Decal.h index 4c057b5..f071791 100644 --- a/src/Mass/Decal.h +++ b/src/Mass/Decal.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Joints.h b/src/Mass/Joints.h index ce30800..e731e91 100644 --- a/src/Mass/Joints.h +++ b/src/Mass/Joints.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass.cpp b/src/Mass/Mass.cpp index 901f820..9e6f35f 100644 --- a/src/Mass/Mass.cpp +++ b/src/Mass/Mass.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index ec1b419..4696347 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 796a1e9..720026a 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_DecalsAccessories.cpp b/src/Mass/Mass_DecalsAccessories.cpp index 91fcc71..fe68000 100644 --- a/src/Mass/Mass_DecalsAccessories.cpp +++ b/src/Mass/Mass_DecalsAccessories.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index 1c44096..58df0d7 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Styles.cpp b/src/Mass/Mass_Styles.cpp index 48a3f94..9db7c05 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/Mass/Mass_Styles.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index 11a5ca6..01f6f96 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Weapon.cpp b/src/Mass/Weapon.cpp index a89e936..9f3b230 100644 --- a/src/Mass/Weapon.cpp +++ b/src/Mass/Weapon.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/Weapon.h b/src/Mass/Weapon.h index c8a44a8..68c99dc 100644 --- a/src/Mass/Weapon.h +++ b/src/Mass/Weapon.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Mass/WeaponPart.h b/src/Mass/WeaponPart.h index 2340baf..595754b 100644 --- a/src/Mass/WeaponPart.h +++ b/src/Mass/WeaponPart.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/MassManager/MassManager.cpp b/src/MassManager/MassManager.cpp index 7753e00..fb3a84a 100644 --- a/src/MassManager/MassManager.cpp +++ b/src/MassManager/MassManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/MassManager/MassManager.h b/src/MassManager/MassManager.h index 708e42e..4b36dcb 100644 --- a/src/MassManager/MassManager.h +++ b/src/MassManager/MassManager.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index bc2fb3a..d770ffd 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Profile/Profile.h b/src/Profile/Profile.h index ef299e6..54d04c2 100644 --- a/src/Profile/Profile.h +++ b/src/Profile/Profile.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Profile/ResourceIDs.h b/src/Profile/ResourceIDs.h index 37f4b7f..d070355 100644 --- a/src/Profile/ResourceIDs.h +++ b/src/Profile/ResourceIDs.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index 5037234..53b89c6 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ProfileManager/ProfileManager.h b/src/ProfileManager/ProfileManager.h index c6dff6b..99eaab7 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/ProfileManager/ProfileManager.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ToastQueue/ToastQueue.cpp b/src/ToastQueue/ToastQueue.cpp index 19f1ad9..06d610a 100644 --- a/src/ToastQueue/ToastQueue.cpp +++ b/src/ToastQueue/ToastQueue.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/ToastQueue/ToastQueue.h b/src/ToastQueue/ToastQueue.h index 1d175e7..0a0e222 100644 --- a/src/ToastQueue/ToastQueue.h +++ b/src/ToastQueue/ToastQueue.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UpdateChecker/UpdateChecker.cpp b/src/UpdateChecker/UpdateChecker.cpp index e4b3225..f65d807 100644 --- a/src/UpdateChecker/UpdateChecker.cpp +++ b/src/UpdateChecker/UpdateChecker.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/UpdateChecker/UpdateChecker.h b/src/UpdateChecker/UpdateChecker.h index 2e567d0..5da13dc 100644 --- a/src/UpdateChecker/UpdateChecker.h +++ b/src/UpdateChecker/UpdateChecker.h @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Utilities/Crc32.cpp b/src/Utilities/Crc32.cpp index 66b6d8b..a4417aa 100644 --- a/src/Utilities/Crc32.cpp +++ b/src/Utilities/Crc32.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Utilities/Crc32.h b/src/Utilities/Crc32.h index a2f7af9..d3dc1cf 100644 --- a/src/Utilities/Crc32.h +++ b/src/Utilities/Crc32.h @@ -1,7 +1,7 @@ #pragma once // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Version/Version.cpp b/src/Version/Version.cpp index 88016f7..9b9d0d0 100644 --- a/src/Version/Version.cpp +++ b/src/Version/Version.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/Version/Version.h b/src/Version/Version.h index 71e2acb..e89af93 100644 --- a/src/Version/Version.h +++ b/src/Version/Version.h @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/main.cpp b/src/main.cpp index 85eb88e..3415679 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by diff --git a/src/resource.rc b/src/resource.rc index 1adeb1e..1658ac8 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -1,5 +1,5 @@ // MassBuilderSaveTool -// Copyright (C) 2021-2023 Guillaume Jacquemin +// Copyright (C) 2021-2024 Guillaume Jacquemin // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by -- 2.39.5 From 3bc750436fac877f42ce2b8fd16faafcaddf9ac8 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 20:55:05 +0100 Subject: [PATCH 055/126] Logger,Gvas: reintegrate into main project. Separate libraries made things a bit messy, to be honest. --- src/CMakeLists.txt | 93 +++++++++++++++++++++++++++++++--- src/Gvas/CMakeLists.txt | 102 -------------------------------------- src/Logger/CMakeLists.txt | 28 ----------- 3 files changed, 85 insertions(+), 138 deletions(-) delete mode 100644 src/Gvas/CMakeLists.txt delete mode 100644 src/Logger/CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7ce39ed..cce246b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,8 +36,89 @@ set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) corrade_add_resource(Assets assets.conf) -add_subdirectory(Logger EXCLUDE_FROM_ALL) -add_subdirectory(Gvas EXCLUDE_FROM_ALL) +set(Logger_SOURCES + Logger/Logger.h + Logger/Logger.cpp + Logger/EntryType.h + Logger/MagnumLogBuffer.h + Logger/MagnumLogBuffer.cpp +) + +set(Gvas_SOURCES + Gvas/Serialisers/Serialisers.h + Gvas/Serialisers/AbstractUnrealCollectionProperty.h + Gvas/Serialisers/AbstractUnrealProperty.h + Gvas/Serialisers/AbstractUnrealStruct.h + Gvas/Serialisers/ArrayProperty.h + Gvas/Serialisers/ArrayProperty.cpp + Gvas/Serialisers/BoolProperty.h + Gvas/Serialisers/BoolProperty.cpp + Gvas/Serialisers/ByteProperty.h + Gvas/Serialisers/ByteProperty.cpp + Gvas/Serialisers/ColourProperty.h + Gvas/Serialisers/ColourProperty.cpp + Gvas/Serialisers/DateTimeProperty.h + Gvas/Serialisers/DateTimeProperty.cpp + Gvas/Serialisers/EnumProperty.h + Gvas/Serialisers/EnumProperty.cpp + Gvas/Serialisers/FloatProperty.h + Gvas/Serialisers/FloatProperty.cpp + Gvas/Serialisers/GuidProperty.h + Gvas/Serialisers/GuidProperty.cpp + Gvas/Serialisers/IntProperty.h + Gvas/Serialisers/IntProperty.cpp + Gvas/Serialisers/MapProperty.h + Gvas/Serialisers/MapProperty.cpp + Gvas/Serialisers/ResourceProperty.h + Gvas/Serialisers/ResourceProperty.cpp + Gvas/Serialisers/RotatorProperty.h + Gvas/Serialisers/RotatorProperty.cpp + Gvas/Serialisers/StringProperty.h + Gvas/Serialisers/StringProperty.cpp + Gvas/Serialisers/SetProperty.h + Gvas/Serialisers/SetProperty.cpp + Gvas/Serialisers/Struct.h + Gvas/Serialisers/Struct.cpp + Gvas/Serialisers/TextProperty.h + Gvas/Serialisers/TextProperty.cpp + Gvas/Serialisers/UnrealProperty.h + Gvas/Serialisers/VectorProperty.h + Gvas/Serialisers/VectorProperty.cpp + Gvas/Serialisers/Vector2DProperty.h + Gvas/Serialisers/Vector2DProperty.cpp + + Gvas/Types/Types.h + Gvas/Types/ArrayProperty.h + Gvas/Types/BoolProperty.h + Gvas/Types/ByteProperty.h + Gvas/Types/ColourStructProperty.h + Gvas/Types/DateTimeStructProperty.h + Gvas/Types/EnumProperty.h + Gvas/Types/FloatProperty.h + Gvas/Types/GenericStructProperty.h + Gvas/Types/GuidStructProperty.h + Gvas/Types/IntProperty.h + Gvas/Types/MapProperty.h + Gvas/Types/NoneProperty.h + Gvas/Types/RotatorStructProperty.h + Gvas/Types/SetProperty.h + Gvas/Types/StringProperty.h + Gvas/Types/StructProperty.h + Gvas/Types/ResourceItemValue.h + Gvas/Types/TextProperty.h + Gvas/Types/UnrealProperty.h + Gvas/Types/UnrealPropertyBase.h + Gvas/Types/Vector2DStructProperty.h + Gvas/Types/VectorStructProperty.h + + Gvas/Gvas.h + Gvas/Debug.h + Gvas/Debug.cpp + Gvas/File.h + Gvas/File.cpp + Gvas/PropertySerialiser.h + Gvas/PropertySerialiser.cpp +) if(CORRADE_TARGET_WINDOWS) set(SAVETOOL_RC_FILE resource.rc) @@ -107,6 +188,8 @@ add_executable(MassBuilderSaveTool Version/Version.cpp FontAwesome/IconsFontAwesome5.h FontAwesome/IconsFontAwesome5Brands.h + ${Logger_SOURCES} + ${Gvas_SOURCES} ${SAVETOOL_RC_FILE} ${Assets} ) @@ -115,10 +198,6 @@ if(CORRADE_TARGET_WINDOWS) set_target_properties(${PROJECT_NAME} PROPERTIES WIN32_EXECUTABLE $) endif() -if(CMAKE_BUILD_TYPE STREQUAL Debug) - target_compile_definitions(Logger PRIVATE SAVETOOL_DEBUG_BUILD) - target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_DEBUG_BUILD) -endif() target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_VERSION_STRING="${SAVETOOL_PROJECT_VERSION}" SAVETOOL_VERSION_MAJOR=1 @@ -146,8 +225,6 @@ target_link_libraries(MassBuilderSaveTool PRIVATE Magnum::GL Magnum::Sdl2Application MagnumIntegration::ImGui - Logger - Gvas CURL::libcurl_static ) diff --git a/src/Gvas/CMakeLists.txt b/src/Gvas/CMakeLists.txt deleted file mode 100644 index 5f16a0b..0000000 --- a/src/Gvas/CMakeLists.txt +++ /dev/null @@ -1,102 +0,0 @@ -# MassBuilderSaveTool -# Copyright (C) 2021-2024 Guillaume Jacquemin -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -add_library(Gvas STATIC EXCLUDE_FROM_ALL - Serialisers/Serialisers.h - Serialisers/AbstractUnrealCollectionProperty.h - Serialisers/AbstractUnrealProperty.h - Serialisers/AbstractUnrealStruct.h - Serialisers/ArrayProperty.h - Serialisers/ArrayProperty.cpp - Serialisers/BoolProperty.h - Serialisers/BoolProperty.cpp - Serialisers/ByteProperty.h - Serialisers/ByteProperty.cpp - Serialisers/ColourProperty.h - Serialisers/ColourProperty.cpp - Serialisers/DateTimeProperty.h - Serialisers/DateTimeProperty.cpp - Serialisers/EnumProperty.h - Serialisers/EnumProperty.cpp - Serialisers/FloatProperty.h - Serialisers/FloatProperty.cpp - Serialisers/GuidProperty.h - Serialisers/GuidProperty.cpp - Serialisers/IntProperty.h - Serialisers/IntProperty.cpp - Serialisers/MapProperty.h - Serialisers/MapProperty.cpp - Serialisers/ResourceProperty.h - Serialisers/ResourceProperty.cpp - Serialisers/RotatorProperty.h - Serialisers/RotatorProperty.cpp - Serialisers/StringProperty.h - Serialisers/StringProperty.cpp - Serialisers/SetProperty.h - Serialisers/SetProperty.cpp - Serialisers/Struct.h - Serialisers/Struct.cpp - Serialisers/TextProperty.h - Serialisers/TextProperty.cpp - Serialisers/UnrealProperty.h - Serialisers/VectorProperty.h - Serialisers/VectorProperty.cpp - Serialisers/Vector2DProperty.h - Serialisers/Vector2DProperty.cpp - - Types/Types.h - Types/ArrayProperty.h - Types/BoolProperty.h - Types/ByteProperty.h - Types/ColourStructProperty.h - Types/DateTimeStructProperty.h - Types/EnumProperty.h - Types/FloatProperty.h - Types/GenericStructProperty.h - Types/GuidStructProperty.h - Types/IntProperty.h - Types/MapProperty.h - Types/NoneProperty.h - Types/RotatorStructProperty.h - Types/SetProperty.h - Types/StringProperty.h - Types/StructProperty.h - Types/ResourceItemValue.h - Types/TextProperty.h - Types/UnrealProperty.h - Types/UnrealPropertyBase.h - Types/Vector2DStructProperty.h - Types/VectorStructProperty.h - - Gvas.h - Debug.h - Debug.cpp - File.h - File.cpp - BinaryReader.h - BinaryReader.cpp - BinaryWriter.h - BinaryWriter.cpp - PropertySerialiser.h - PropertySerialiser.cpp -) - -target_link_libraries(Gvas PRIVATE - Corrade::Containers - Corrade::Utility - Magnum::Magnum - Logger -) diff --git a/src/Logger/CMakeLists.txt b/src/Logger/CMakeLists.txt deleted file mode 100644 index 8ce4672..0000000 --- a/src/Logger/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# MassBuilderSaveTool -# Copyright (C) 2021-2024 Guillaume Jacquemin -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -add_library(Logger STATIC EXCLUDE_FROM_ALL - Logger.h - Logger.cpp - EntryType.h - MagnumLogBuffer.h - MagnumLogBuffer.cpp -) - -target_link_libraries(Logger PRIVATE - Corrade::Utility - Magnum::Magnum -) -- 2.39.5 From 3c79f39046eb93863782664affc28beb8d33e252 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 21:18:17 +0100 Subject: [PATCH 056/126] Gvas: separate Binary{Reader,Writer}. The functionality has been moved to BinaryIo::{Reader,Writer} to prepare for exporting build parts. --- src/BinaryIo/BinaryIo.h | 24 ++++++++++ .../BinaryReader.cpp => BinaryIo/Reader.cpp} | 46 +++++++++--------- .../BinaryReader.h => BinaryIo/Reader.h} | 14 ++++-- .../BinaryWriter.cpp => BinaryIo/Writer.cpp} | 48 +++++++++---------- .../BinaryWriter.h => BinaryIo/Writer.h} | 16 +++---- src/CMakeLists.txt | 9 ++++ src/Gvas/File.cpp | 8 ++-- src/Gvas/Gvas.h | 2 - src/Gvas/PropertySerialiser.cpp | 21 ++++---- src/Gvas/PropertySerialiser.h | 18 +++---- .../AbstractUnrealCollectionProperty.h | 6 ++- src/Gvas/Serialisers/AbstractUnrealProperty.h | 8 ++-- src/Gvas/Serialisers/AbstractUnrealStruct.h | 5 +- src/Gvas/Serialisers/ArrayProperty.cpp | 10 ++-- src/Gvas/Serialisers/ArrayProperty.h | 6 +-- src/Gvas/Serialisers/BoolProperty.cpp | 8 ++-- src/Gvas/Serialisers/BoolProperty.h | 4 +- src/Gvas/Serialisers/ByteProperty.cpp | 8 ++-- src/Gvas/Serialisers/ByteProperty.h | 4 +- src/Gvas/Serialisers/ColourProperty.cpp | 8 ++-- src/Gvas/Serialisers/ColourProperty.h | 6 +-- src/Gvas/Serialisers/DateTimeProperty.cpp | 8 ++-- src/Gvas/Serialisers/DateTimeProperty.h | 6 +-- src/Gvas/Serialisers/EnumProperty.cpp | 8 ++-- src/Gvas/Serialisers/EnumProperty.h | 4 +- src/Gvas/Serialisers/FloatProperty.cpp | 8 ++-- src/Gvas/Serialisers/FloatProperty.h | 4 +- src/Gvas/Serialisers/GuidProperty.cpp | 10 ++-- src/Gvas/Serialisers/GuidProperty.h | 6 +-- src/Gvas/Serialisers/IntProperty.cpp | 10 ++-- src/Gvas/Serialisers/IntProperty.h | 6 +-- src/Gvas/Serialisers/MapProperty.cpp | 10 ++-- src/Gvas/Serialisers/MapProperty.h | 6 +-- src/Gvas/Serialisers/ResourceProperty.cpp | 9 ++-- src/Gvas/Serialisers/ResourceProperty.h | 6 +-- src/Gvas/Serialisers/RotatorProperty.cpp | 11 +++-- src/Gvas/Serialisers/RotatorProperty.h | 6 +-- src/Gvas/Serialisers/SetProperty.cpp | 10 ++-- src/Gvas/Serialisers/SetProperty.h | 6 +-- src/Gvas/Serialisers/StringProperty.cpp | 8 ++-- src/Gvas/Serialisers/StringProperty.h | 4 +- src/Gvas/Serialisers/Struct.cpp | 16 +++---- src/Gvas/Serialisers/Struct.h | 12 ++--- src/Gvas/Serialisers/TextProperty.cpp | 10 ++-- src/Gvas/Serialisers/TextProperty.h | 6 +-- src/Gvas/Serialisers/UnrealProperty.h | 10 ++-- src/Gvas/Serialisers/Vector2DProperty.cpp | 12 +++-- src/Gvas/Serialisers/Vector2DProperty.h | 6 +-- src/Gvas/Serialisers/VectorProperty.cpp | 11 +++-- src/Gvas/Serialisers/VectorProperty.h | 6 +-- 50 files changed, 280 insertions(+), 234 deletions(-) create mode 100644 src/BinaryIo/BinaryIo.h rename src/{Gvas/BinaryReader.cpp => BinaryIo/Reader.cpp} (73%) rename src/{Gvas/BinaryReader.h => BinaryIo/Reader.h} (87%) rename src/{Gvas/BinaryWriter.cpp => BinaryIo/Writer.cpp} (75%) rename src/{Gvas/BinaryWriter.h => BinaryIo/Writer.h} (90%) diff --git a/src/BinaryIo/BinaryIo.h b/src/BinaryIo/BinaryIo.h new file mode 100644 index 0000000..8cc09a6 --- /dev/null +++ b/src/BinaryIo/BinaryIo.h @@ -0,0 +1,24 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +namespace BinaryIo { + +class Reader; +class Writer; + +} diff --git a/src/Gvas/BinaryReader.cpp b/src/BinaryIo/Reader.cpp similarity index 73% rename from src/Gvas/BinaryReader.cpp rename to src/BinaryIo/Reader.cpp index bc876fe..c00edfc 100644 --- a/src/Gvas/BinaryReader.cpp +++ b/src/BinaryIo/Reader.cpp @@ -21,11 +21,11 @@ #include "../Logger/Logger.h" -#include "BinaryReader.h" +#include "Reader.h" -namespace Gvas { +namespace BinaryIo { -BinaryReader::BinaryReader(Containers::StringView filename) { +Reader::Reader(Containers::StringView filename) { _file = std::fopen(filename.data(), "rb"); if(!_file) { @@ -33,93 +33,93 @@ BinaryReader::BinaryReader(Containers::StringView filename) { } } -BinaryReader::~BinaryReader() { +Reader::~Reader() { closeFile(); } bool -BinaryReader::open() { +Reader::open() { return _file; } bool -BinaryReader::eof() { +Reader::eof() { return std::feof(_file) != 0; } std::int64_t -BinaryReader::position() { +Reader::position() { return _ftelli64(_file); } bool -BinaryReader::seek(std::int64_t position) { +Reader::seek(std::int64_t position) { return _fseeki64(_file, position, SEEK_SET) == 0; } void -BinaryReader::closeFile() { +Reader::closeFile() { std::fclose(_file); _file = nullptr; } bool -BinaryReader::readChar(char& value) { +Reader::readChar(char& value) { return std::fread(&value, sizeof(char), 1, _file) == 1; } bool -BinaryReader::readInt8(std::int8_t& value) { +Reader::readInt8(std::int8_t& value) { return std::fread(&value, sizeof(std::int8_t), 1, _file) == 1; } bool -BinaryReader::readUint8(std::uint8_t& value) { +Reader::readUint8(std::uint8_t& value) { return std::fread(&value, sizeof(std::uint8_t), 1, _file) == 1; } bool -BinaryReader::readInt16(std::int16_t& value) { +Reader::readInt16(std::int16_t& value) { return std::fread(&value, sizeof(std::int16_t), 1, _file) == 1; } bool -BinaryReader::readUint16(std::uint16_t& value) { +Reader::readUint16(std::uint16_t& value) { return std::fread(&value, sizeof(std::uint16_t), 1, _file) == 1; } bool -BinaryReader::readInt32(std::int32_t& value) { +Reader::readInt32(std::int32_t& value) { return std::fread(&value, sizeof(std::int32_t), 1, _file) == 1; } bool -BinaryReader::readUint32(std::uint32_t& value) { +Reader::readUint32(std::uint32_t& value) { return std::fread(&value, sizeof(std::uint32_t), 1, _file) == 1; } bool -BinaryReader::readInt64(std::int64_t& value) { +Reader::readInt64(std::int64_t& value) { return std::fread(&value, sizeof(std::int64_t), 1, _file) == 1; } bool -BinaryReader::readUint64(std::uint64_t& value) { +Reader::readUint64(std::uint64_t& value) { return std::fread(&value, sizeof(std::uint64_t), 1, _file) == 1; } bool -BinaryReader::readFloat(float& value) { +Reader::readFloat(float& value) { return std::fread(&value, sizeof(float), 1, _file) == 1; } bool -BinaryReader::readDouble(double& value) { +Reader::readDouble(double& value) { return std::fread(&value, sizeof(double), 1, _file) == 1; } bool -BinaryReader::readArray(Containers::Array& array, std::size_t count) { +Reader::readArray(Containers::Array& array, std::size_t count) { if(array.size() < count) { array = Containers::Array{ValueInit, count}; } @@ -128,7 +128,7 @@ BinaryReader::readArray(Containers::Array& array, std::size_t count) { } bool -BinaryReader::readUEString(Containers::String& str) { +Reader::readUEString(Containers::String& str) { std::uint32_t length = 0; if(!readUint32(length) || length == 0) { return false; @@ -140,7 +140,7 @@ BinaryReader::readUEString(Containers::String& str) { } std::int32_t -BinaryReader::peekChar() { +Reader::peekChar() { std::int32_t c; c = std::fgetc(_file); std::ungetc(c, _file); diff --git a/src/Gvas/BinaryReader.h b/src/BinaryIo/Reader.h similarity index 87% rename from src/Gvas/BinaryReader.h rename to src/BinaryIo/Reader.h index 4fc52b9..794470f 100644 --- a/src/Gvas/BinaryReader.h +++ b/src/BinaryIo/Reader.h @@ -25,12 +25,18 @@ using namespace Corrade; -namespace Gvas { +namespace BinaryIo { -class BinaryReader { +class Reader { public: - explicit BinaryReader(Containers::StringView filename); - ~BinaryReader(); + explicit Reader(Containers::StringView filename); + ~Reader(); + + Reader(const Reader& other) = delete; + Reader& operator=(const Reader& other) = delete; + + Reader(Reader&& other) = default; + Reader& operator=(Reader&& other) = default; bool open(); bool eof(); diff --git a/src/Gvas/BinaryWriter.cpp b/src/BinaryIo/Writer.cpp similarity index 75% rename from src/Gvas/BinaryWriter.cpp rename to src/BinaryIo/Writer.cpp index 1b3d904..4a0bb5d 100644 --- a/src/Gvas/BinaryWriter.cpp +++ b/src/BinaryIo/Writer.cpp @@ -18,52 +18,52 @@ #include "../Logger/Logger.h" -#include "BinaryWriter.h" +#include "Writer.h" using namespace Containers::Literals; -namespace Gvas { +namespace BinaryIo { -BinaryWriter::BinaryWriter(Containers::StringView filename) { +Writer::Writer(Containers::StringView filename) { _file = std::fopen(filename.data(), "wb"); if(!_file) { LOG_ERROR_FORMAT("Couldn't open {} for reading: {}", filename, std::strerror(errno)); } } -BinaryWriter::~BinaryWriter() { +Writer::~Writer() { closeFile(); } bool -BinaryWriter::open() { +Writer::open() { return _file; } void -BinaryWriter::closeFile() { +Writer::closeFile() { std::fflush(_file); std::fclose(_file); _file = nullptr; } std::int64_t -BinaryWriter::position() { +Writer::position() { return _ftelli64(_file); } Containers::ArrayView -BinaryWriter::array() const { +Writer::array() const { return _data; } std::size_t -BinaryWriter::arrayPosition() const { +Writer::arrayPosition() const { return _index; } bool -BinaryWriter::flushToFile() { +Writer::flushToFile() { bool ret = writeArray(_data); std::fflush(_file); _data = Containers::Array{}; @@ -72,62 +72,62 @@ BinaryWriter::flushToFile() { } bool -BinaryWriter::writeChar(char value) { +Writer::writeChar(char value) { return std::fwrite(&value, sizeof(char), 1, _file) == 1; } bool -BinaryWriter::writeInt8(std::int8_t value) { +Writer::writeInt8(std::int8_t value) { return std::fwrite(&value, sizeof(std::int8_t), 1, _file) == 1; } bool -BinaryWriter::writeUint8(std::uint8_t value) { +Writer::writeUint8(std::uint8_t value) { return std::fwrite(&value, sizeof(std::uint8_t), 1, _file) == 1; } bool -BinaryWriter::writeInt16(std::int16_t value) { +Writer::writeInt16(std::int16_t value) { return std::fwrite(&value, sizeof(std::int16_t), 1, _file) == 1; } bool -BinaryWriter::writeUint16(std::uint16_t value) { +Writer::writeUint16(std::uint16_t value) { return std::fwrite(&value, sizeof(std::uint16_t), 1, _file) == 1; } bool -BinaryWriter::writeInt32(std::int32_t value) { +Writer::writeInt32(std::int32_t value) { return std::fwrite(&value, sizeof(std::int32_t), 1, _file) == 1; } bool -BinaryWriter::writeUint32(std::uint32_t value) { +Writer::writeUint32(std::uint32_t value) { return std::fwrite(&value, sizeof(std::uint32_t), 1, _file) == 1; } bool -BinaryWriter::writeInt64(std::int64_t value) { +Writer::writeInt64(std::int64_t value) { return std::fwrite(&value, sizeof(std::int64_t), 1, _file) == 1; } bool -BinaryWriter::writeUint64(std::uint64_t value) { +Writer::writeUint64(std::uint64_t value) { return std::fwrite(&value, sizeof(std::uint64_t), 1, _file) == 1; } bool -BinaryWriter::writeFloat(float value) { +Writer::writeFloat(float value) { return std::fwrite(&value, sizeof(float), 1, _file) == 1; } bool -BinaryWriter::writeDouble(double value) { +Writer::writeDouble(double value) { return std::fwrite(&value, sizeof(double), 1, _file) == 1; } bool -BinaryWriter::writeArray(Containers::ArrayView array) { +Writer::writeArray(Containers::ArrayView array) { if(array.isEmpty()) { return false; } @@ -136,7 +136,7 @@ BinaryWriter::writeArray(Containers::ArrayView array) { } bool -BinaryWriter::writeUEString(Containers::StringView str) { +Writer::writeUEString(Containers::StringView str) { if(str.size() > UINT32_MAX) { LOG_ERROR_FORMAT("String is too big. Expected size() < UINT32_MAX, got {} instead.", str.size()); return false; @@ -154,7 +154,7 @@ BinaryWriter::writeUEString(Containers::StringView str) { } std::size_t -BinaryWriter::writeUEStringToArray(Containers::StringView value) { +Writer::writeUEStringToArray(Containers::StringView value) { return writeValueToArray(std::uint32_t(value.size()) + 1u) + writeDataToArray(Containers::ArrayView{value}) + writeValueToArray('\0'); diff --git a/src/Gvas/BinaryWriter.h b/src/BinaryIo/Writer.h similarity index 90% rename from src/Gvas/BinaryWriter.h rename to src/BinaryIo/Writer.h index 9018a9b..763622e 100644 --- a/src/Gvas/BinaryWriter.h +++ b/src/BinaryIo/Writer.h @@ -26,18 +26,18 @@ using namespace Corrade; -namespace Gvas { +namespace BinaryIo { -class BinaryWriter { +class Writer { public: - explicit BinaryWriter(Containers::StringView filename); - ~BinaryWriter(); + explicit Writer(Containers::StringView filename); + ~Writer(); - BinaryWriter(const BinaryWriter& other) = delete; - BinaryWriter& operator=(const BinaryWriter& other) = delete; + Writer(const Writer& other) = delete; + Writer& operator=(const Writer& other) = delete; - BinaryWriter(BinaryWriter&& other) = default; - BinaryWriter& operator=(BinaryWriter&& other) = default; + Writer(Writer&& other) = default; + Writer& operator=(Writer&& other) = default; bool open(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cce246b..67291af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -44,6 +44,14 @@ set(Logger_SOURCES Logger/MagnumLogBuffer.cpp ) +set(BinaryIo_SOURCES + BinaryIo/BinaryIo.h + BinaryIo/Reader.h + BinaryIo/Reader.cpp + BinaryIo/Writer.h + BinaryIo/Writer.cpp +) + set(Gvas_SOURCES Gvas/Serialisers/Serialisers.h Gvas/Serialisers/AbstractUnrealCollectionProperty.h @@ -189,6 +197,7 @@ add_executable(MassBuilderSaveTool FontAwesome/IconsFontAwesome5.h FontAwesome/IconsFontAwesome5Brands.h ${Logger_SOURCES} + ${BinaryIo_SOURCES} ${Gvas_SOURCES} ${SAVETOOL_RC_FILE} ${Assets} diff --git a/src/Gvas/File.cpp b/src/Gvas/File.cpp index 7e9b0aa..1146d8b 100644 --- a/src/Gvas/File.cpp +++ b/src/Gvas/File.cpp @@ -19,8 +19,8 @@ #include "../Logger/Logger.h" -#include "BinaryReader.h" -#include "BinaryWriter.h" +#include "../BinaryIo/Reader.h" +#include "../BinaryIo/Writer.h" #include "File.h" @@ -87,7 +87,7 @@ File::saveToFile() { return false; } - BinaryWriter writer{_filepath + ".tmp"_s}; + BinaryIo::Writer writer{_filepath + ".tmp"_s}; if(!writer.open()) { _lastError = "Couldn't open the file for saving."_s; @@ -175,7 +175,7 @@ File::loadData() { return; } - BinaryReader reader{_filepath}; + BinaryIo::Reader reader{_filepath}; if(!reader.open()) { _lastError = _filepath + " couldn't be opened."_s; diff --git a/src/Gvas/Gvas.h b/src/Gvas/Gvas.h index 0d52b13..cec8a20 100644 --- a/src/Gvas/Gvas.h +++ b/src/Gvas/Gvas.h @@ -18,8 +18,6 @@ namespace Gvas { -class BinaryReader; -class BinaryWriter; class File; class PropertySerialiser; diff --git a/src/Gvas/PropertySerialiser.cpp b/src/Gvas/PropertySerialiser.cpp index e60cfae..81c590f 100644 --- a/src/Gvas/PropertySerialiser.cpp +++ b/src/Gvas/PropertySerialiser.cpp @@ -39,8 +39,8 @@ #include "Types/NoneProperty.h" -#include "BinaryReader.h" -#include "BinaryWriter.h" +#include "../BinaryIo/Reader.h" +#include "../BinaryIo/Writer.h" #include "PropertySerialiser.h" @@ -76,7 +76,7 @@ PropertySerialiser::instance() { } Types::UnrealPropertyBase::ptr -PropertySerialiser::read(BinaryReader& reader) { +PropertySerialiser::read(BinaryIo::Reader& reader) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; } @@ -104,7 +104,7 @@ PropertySerialiser::read(BinaryReader& reader) { } Types::UnrealPropertyBase::ptr -PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, +PropertySerialiser::readItem(BinaryIo::Reader& reader, Containers::String type, std::size_t value_length, Containers::String name) { if(reader.peekChar() < 0 || reader.eof()) { @@ -115,7 +115,7 @@ PropertySerialiser::readItem(BinaryReader& reader, Containers::String type, std: } Containers::Array -PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) { +PropertySerialiser::readSet(BinaryIo::Reader& reader, Containers::StringView item_type, std::uint32_t count) { if(reader.peekChar() < 0 || reader.eof()) { return nullptr; } @@ -160,7 +160,7 @@ PropertySerialiser::readSet(BinaryReader& reader, Containers::StringView item_ty Types::UnrealPropertyBase::ptr PropertySerialiser::deserialise(Containers::String name, Containers::String type, std::size_t value_length, - BinaryReader& reader) + BinaryIo::Reader& reader) { Types::UnrealPropertyBase::ptr prop; auto serialiser = getSerialiser(type); @@ -183,7 +183,7 @@ PropertySerialiser::deserialise(Containers::String name, Containers::String type } bool PropertySerialiser::serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer) + std::size_t& bytes_written, BinaryIo::Writer& writer) { auto serialiser = getSerialiser(item_type); if(!serialiser) { @@ -193,7 +193,7 @@ bool PropertySerialiser::serialise(Types::UnrealPropertyBase::ptr& prop, Contain } bool -PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer) { +PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); return true; @@ -218,7 +218,7 @@ PropertySerialiser::write(Types::UnrealPropertyBase::ptr& prop, std::size_t& byt bool PropertySerialiser::writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer) + std::size_t& bytes_written, BinaryIo::Writer& writer) { if(prop->name == "None" && prop->propertyType == "NoneProperty" && dynamic_cast(prop.get())) { bytes_written += writer.writeUEStringToArray(*prop->name); @@ -229,7 +229,8 @@ PropertySerialiser::writeItem(Types::UnrealPropertyBase::ptr& prop, Containers:: } bool PropertySerialiser::writeSet(Containers::ArrayView props, - Containers::StringView item_type, std::size_t& bytes_written, BinaryWriter& writer) + Containers::StringView item_type, std::size_t& bytes_written, + BinaryIo::Writer& writer) { auto serialiser = getCollectionSerialiser(item_type); if(serialiser) { diff --git a/src/Gvas/PropertySerialiser.h b/src/Gvas/PropertySerialiser.h index 4989642..99b3cd6 100644 --- a/src/Gvas/PropertySerialiser.h +++ b/src/Gvas/PropertySerialiser.h @@ -25,7 +25,7 @@ #include "Types/UnrealPropertyBase.h" -#include "Gvas.h" +#include "../BinaryIo/BinaryIo.h" using namespace Corrade; @@ -35,21 +35,21 @@ class PropertySerialiser { public: static auto instance() -> PropertySerialiser&; - auto read(BinaryReader& reader) -> Types::UnrealPropertyBase::ptr; - auto readItem(BinaryReader& reader, Containers::String type, std::size_t value_length, Containers::String name) + auto read(BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr; + auto readItem(BinaryIo::Reader& reader, Containers::String type, std::size_t value_length, Containers::String name) -> Types::UnrealPropertyBase::ptr; - auto readSet(BinaryReader& reader, Containers::StringView item_type, std::uint32_t count) + auto readSet(BinaryIo::Reader& reader, Containers::StringView item_type, std::uint32_t count) -> Containers::Array; auto deserialise(Containers::String name, Containers::String type, std::size_t value_length, - BinaryReader& reader) -> Types::UnrealPropertyBase::ptr; + BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr; bool serialise(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer); - bool write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer); + std::size_t& bytes_written, BinaryIo::Writer& writer); + bool write(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer); bool writeItem(Types::UnrealPropertyBase::ptr& prop, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer); + std::size_t& bytes_written, BinaryIo::Writer& writer); bool writeSet(Containers::ArrayView props, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer); + std::size_t& bytes_written, BinaryIo::Writer& writer); private: PropertySerialiser(); diff --git a/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h index a4cefb6..db440d6 100644 --- a/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h +++ b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h @@ -22,6 +22,7 @@ #include #include "../Gvas.h" +#include "../../BinaryIo/BinaryIo.h" #include "../Types/UnrealPropertyBase.h" using namespace Corrade; @@ -41,11 +42,12 @@ class AbstractUnrealCollectionProperty { virtual auto types() -> StringArrayView = 0; virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) + std::uint32_t count, BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> PropertyArray = 0; virtual bool serialise(PropertyArrayView props, Containers::StringView item_type, - std::size_t& bytes_written, BinaryWriter& writer, PropertySerialiser& serialiser) = 0; + std::size_t& bytes_written, BinaryIo::Writer& writer, + PropertySerialiser& serialiser) = 0; }; }} diff --git a/src/Gvas/Serialisers/AbstractUnrealProperty.h b/src/Gvas/Serialisers/AbstractUnrealProperty.h index f0945f2..061e95c 100644 --- a/src/Gvas/Serialisers/AbstractUnrealProperty.h +++ b/src/Gvas/Serialisers/AbstractUnrealProperty.h @@ -21,11 +21,11 @@ #include #include "../Gvas.h" +#include "../../BinaryIo/BinaryIo.h" #include "../Types/UnrealPropertyBase.h" using namespace Corrade; - namespace Gvas { namespace Serialisers { using StringArrayView = Containers::ArrayView; @@ -39,11 +39,11 @@ class AbstractUnrealProperty { virtual auto types() -> StringArrayView = 0; virtual auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr = 0; - virtual bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) = 0; + virtual bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0; }; }} diff --git a/src/Gvas/Serialisers/AbstractUnrealStruct.h b/src/Gvas/Serialisers/AbstractUnrealStruct.h index 1232e21..715c2e7 100644 --- a/src/Gvas/Serialisers/AbstractUnrealStruct.h +++ b/src/Gvas/Serialisers/AbstractUnrealStruct.h @@ -22,6 +22,7 @@ #include #include "../Gvas.h" +#include "../../BinaryIo/BinaryIo.h" #include "../Types/UnrealPropertyBase.h" using namespace Corrade; @@ -36,9 +37,9 @@ class AbstractUnrealStruct { virtual bool supportsType(Containers::StringView type) = 0; - virtual auto deserialise(BinaryReader& reader) -> Types::UnrealPropertyBase::ptr = 0; + virtual auto deserialise(BinaryIo::Reader& reader) -> Types::UnrealPropertyBase::ptr = 0; - virtual bool serialise(Types::UnrealPropertyBase::ptr& structProp, BinaryWriter& writer, + virtual bool serialise(Types::UnrealPropertyBase::ptr& structProp, BinaryIo::Writer& writer, std::size_t& bytes_written) = 0; }; diff --git a/src/Gvas/Serialisers/ArrayProperty.cpp b/src/Gvas/Serialisers/ArrayProperty.cpp index d1305ad..a6e2047 100644 --- a/src/Gvas/Serialisers/ArrayProperty.cpp +++ b/src/Gvas/Serialisers/ArrayProperty.cpp @@ -16,8 +16,8 @@ #include -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../PropertySerialiser.h" #include "../../Logger/Logger.h" @@ -27,7 +27,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -55,8 +55,8 @@ ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::Stri } bool -ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto array_prop = dynamic_cast(prop.get()); if(!array_prop) { diff --git a/src/Gvas/Serialisers/ArrayProperty.h b/src/Gvas/Serialisers/ArrayProperty.h index 078a79c..2ed6f56 100644 --- a/src/Gvas/Serialisers/ArrayProperty.h +++ b/src/Gvas/Serialisers/ArrayProperty.h @@ -32,10 +32,10 @@ class ArrayProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/BoolProperty.cpp b/src/Gvas/Serialisers/BoolProperty.cpp index 0d831f5..3f38495 100644 --- a/src/Gvas/Serialisers/BoolProperty.cpp +++ b/src/Gvas/Serialisers/BoolProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "BoolProperty.h" @@ -31,7 +31,7 @@ BoolProperty::types() { Types::UnrealPropertyBase::ptr BoolProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { if(value_length != 0) { LOG_ERROR_FORMAT("Invalid value length for bool property {}. Expected 0, got {} instead.", name, value_length); @@ -56,7 +56,7 @@ BoolProperty::deserialise(Containers::StringView name, Containers::StringView ty } bool -BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, +BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto bool_prop = dynamic_cast(prop.get()); diff --git a/src/Gvas/Serialisers/BoolProperty.h b/src/Gvas/Serialisers/BoolProperty.h index 9af5fab..b36a66d 100644 --- a/src/Gvas/Serialisers/BoolProperty.h +++ b/src/Gvas/Serialisers/BoolProperty.h @@ -34,10 +34,10 @@ class BoolProperty : public AbstractUnrealProperty { auto types() -> StringArrayView override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/Gvas/Serialisers/ByteProperty.cpp b/src/Gvas/Serialisers/ByteProperty.cpp index 7f92233..ca0a104 100644 --- a/src/Gvas/Serialisers/ByteProperty.cpp +++ b/src/Gvas/Serialisers/ByteProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "ByteProperty.h" @@ -31,7 +31,7 @@ ByteProperty::types() { Types::UnrealPropertyBase::ptr ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -68,7 +68,7 @@ ByteProperty::deserialise(Containers::StringView name, Containers::StringView ty } bool -ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, +ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto byte_prop = dynamic_cast(prop.get()); diff --git a/src/Gvas/Serialisers/ByteProperty.h b/src/Gvas/Serialisers/ByteProperty.h index fccbad0..f5e97c4 100644 --- a/src/Gvas/Serialisers/ByteProperty.h +++ b/src/Gvas/Serialisers/ByteProperty.h @@ -32,10 +32,10 @@ class ByteProperty : public AbstractUnrealProperty { auto types() -> StringArrayView override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/Gvas/Serialisers/ColourProperty.cpp b/src/Gvas/Serialisers/ColourProperty.cpp index 4d5a7b0..fd39617 100644 --- a/src/Gvas/Serialisers/ColourProperty.cpp +++ b/src/Gvas/Serialisers/ColourProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "ColourProperty.h" @@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -40,7 +40,7 @@ ColourProperty::deserialiseProperty(Containers::StringView name, Containers::Str bool ColourProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto colour_prop = dynamic_cast(prop.get()); if(!colour_prop) { diff --git a/src/Gvas/Serialisers/ColourProperty.h b/src/Gvas/Serialisers/ColourProperty.h index 6d5f5a7..b86061c 100644 --- a/src/Gvas/Serialisers/ColourProperty.h +++ b/src/Gvas/Serialisers/ColourProperty.h @@ -32,10 +32,10 @@ class ColourProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/DateTimeProperty.cpp b/src/Gvas/Serialisers/DateTimeProperty.cpp index 8eb2ed8..1a4caf3 100644 --- a/src/Gvas/Serialisers/DateTimeProperty.cpp +++ b/src/Gvas/Serialisers/DateTimeProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "DateTimeProperty.h" @@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) + std::size_t value_length, BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -38,7 +38,7 @@ DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::S bool DateTimeProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto dt_prop = dynamic_cast(prop.get()); if(!dt_prop) { diff --git a/src/Gvas/Serialisers/DateTimeProperty.h b/src/Gvas/Serialisers/DateTimeProperty.h index d96c86c..6d7822e 100644 --- a/src/Gvas/Serialisers/DateTimeProperty.h +++ b/src/Gvas/Serialisers/DateTimeProperty.h @@ -30,10 +30,10 @@ class DateTimeProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/EnumProperty.cpp b/src/Gvas/Serialisers/EnumProperty.cpp index dbb133e..c475cf4 100644 --- a/src/Gvas/Serialisers/EnumProperty.cpp +++ b/src/Gvas/Serialisers/EnumProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "EnumProperty.h" @@ -31,7 +31,7 @@ EnumProperty::types() { Types::UnrealPropertyBase::ptr EnumProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -55,7 +55,7 @@ EnumProperty::deserialise(Containers::StringView name, Containers::StringView ty } bool -EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, +EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto enum_prop = dynamic_cast(prop.get()); diff --git a/src/Gvas/Serialisers/EnumProperty.h b/src/Gvas/Serialisers/EnumProperty.h index 86ebd8f..3ed25f9 100644 --- a/src/Gvas/Serialisers/EnumProperty.h +++ b/src/Gvas/Serialisers/EnumProperty.h @@ -32,10 +32,10 @@ class EnumProperty : public AbstractUnrealProperty { auto types() -> StringArrayView override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/Gvas/Serialisers/FloatProperty.cpp b/src/Gvas/Serialisers/FloatProperty.cpp index 0833533..84ee2b1 100644 --- a/src/Gvas/Serialisers/FloatProperty.cpp +++ b/src/Gvas/Serialisers/FloatProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "FloatProperty.h" @@ -31,7 +31,7 @@ FloatProperty::types() { Types::UnrealPropertyBase::ptr FloatProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -50,7 +50,7 @@ FloatProperty::deserialise(Containers::StringView name, Containers::StringView t } bool -FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, +FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto float_prop = dynamic_cast(prop.get()); diff --git a/src/Gvas/Serialisers/FloatProperty.h b/src/Gvas/Serialisers/FloatProperty.h index 752c194..2a94b10 100644 --- a/src/Gvas/Serialisers/FloatProperty.h +++ b/src/Gvas/Serialisers/FloatProperty.h @@ -32,10 +32,10 @@ class FloatProperty : public AbstractUnrealProperty { auto types() -> StringArrayView override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/Gvas/Serialisers/GuidProperty.cpp b/src/Gvas/Serialisers/GuidProperty.cpp index 9b8ccc0..8d1f04b 100644 --- a/src/Gvas/Serialisers/GuidProperty.cpp +++ b/src/Gvas/Serialisers/GuidProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "GuidProperty.h" @@ -26,7 +26,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -39,8 +39,8 @@ GuidProperty::deserialiseProperty(Containers::StringView name, Containers::Strin } bool -GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto guid_prop = dynamic_cast(prop.get()); if(!guid_prop) { diff --git a/src/Gvas/Serialisers/GuidProperty.h b/src/Gvas/Serialisers/GuidProperty.h index 0fe5378..a704a9f 100644 --- a/src/Gvas/Serialisers/GuidProperty.h +++ b/src/Gvas/Serialisers/GuidProperty.h @@ -30,10 +30,10 @@ class GuidProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/IntProperty.cpp b/src/Gvas/Serialisers/IntProperty.cpp index 156118f..f4b24ea 100644 --- a/src/Gvas/Serialisers/IntProperty.cpp +++ b/src/Gvas/Serialisers/IntProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "IntProperty.h" @@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -55,8 +55,8 @@ IntProperty::deserialiseProperty(Containers::StringView name, Containers::String } bool -IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto int_prop = dynamic_cast(prop.get()); if(!int_prop) { diff --git a/src/Gvas/Serialisers/IntProperty.h b/src/Gvas/Serialisers/IntProperty.h index 9f8108d..7b9002b 100644 --- a/src/Gvas/Serialisers/IntProperty.h +++ b/src/Gvas/Serialisers/IntProperty.h @@ -30,10 +30,10 @@ class IntProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/MapProperty.cpp b/src/Gvas/Serialisers/MapProperty.cpp index 992e5d7..4fbb216 100644 --- a/src/Gvas/Serialisers/MapProperty.cpp +++ b/src/Gvas/Serialisers/MapProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../PropertySerialiser.h" #include "../Types/NoneProperty.h" #include "../../Logger/Logger.h" @@ -28,7 +28,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -110,8 +110,8 @@ MapProperty::deserialiseProperty(Containers::StringView name, Containers::String } bool -MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto map_prop = dynamic_cast(prop.get()); if(!map_prop) { diff --git a/src/Gvas/Serialisers/MapProperty.h b/src/Gvas/Serialisers/MapProperty.h index 7bf2231..efd6553 100644 --- a/src/Gvas/Serialisers/MapProperty.h +++ b/src/Gvas/Serialisers/MapProperty.h @@ -30,10 +30,10 @@ class MapProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/ResourceProperty.cpp b/src/Gvas/Serialisers/ResourceProperty.cpp index 2564fe1..58f9403 100644 --- a/src/Gvas/Serialisers/ResourceProperty.cpp +++ b/src/Gvas/Serialisers/ResourceProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../PropertySerialiser.h" #include "../Types/IntProperty.h" #include "../Types/NoneProperty.h" @@ -29,7 +29,8 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) + std::size_t value_length, BinaryIo::Reader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -81,7 +82,7 @@ ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::S bool ResourceProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto res_prop = dynamic_cast(prop.get()); if(!res_prop) { diff --git a/src/Gvas/Serialisers/ResourceProperty.h b/src/Gvas/Serialisers/ResourceProperty.h index 7f933a5..351a5bd 100644 --- a/src/Gvas/Serialisers/ResourceProperty.h +++ b/src/Gvas/Serialisers/ResourceProperty.h @@ -30,10 +30,10 @@ class ResourceProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/RotatorProperty.cpp b/src/Gvas/Serialisers/RotatorProperty.cpp index d468e20..c3759a2 100644 --- a/src/Gvas/Serialisers/RotatorProperty.cpp +++ b/src/Gvas/Serialisers/RotatorProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "RotatorProperty.h" @@ -24,7 +24,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -38,7 +38,7 @@ RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::St bool RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto rotator = dynamic_cast(prop.get()); if(!rotator) { @@ -46,7 +46,8 @@ RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::si return false; } - bytes_written += writer.writeValueToArray(rotator->x) + writer.writeValueToArray(rotator->y) + + bytes_written += writer.writeValueToArray(rotator->x) + + writer.writeValueToArray(rotator->y) + writer.writeValueToArray(rotator->z); return true; diff --git a/src/Gvas/Serialisers/RotatorProperty.h b/src/Gvas/Serialisers/RotatorProperty.h index 6eb7f1c..63fdb4e 100644 --- a/src/Gvas/Serialisers/RotatorProperty.h +++ b/src/Gvas/Serialisers/RotatorProperty.h @@ -30,10 +30,10 @@ class RotatorProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/SetProperty.cpp b/src/Gvas/Serialisers/SetProperty.cpp index 61eb199..d6ffd4b 100644 --- a/src/Gvas/Serialisers/SetProperty.cpp +++ b/src/Gvas/Serialisers/SetProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../PropertySerialiser.h" #include "../../Logger/Logger.h" @@ -25,7 +25,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -59,8 +59,8 @@ SetProperty::deserialiseProperty(Containers::StringView name, Containers::String } bool -SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto set_prop = dynamic_cast(prop.get()); if(!set_prop) { diff --git a/src/Gvas/Serialisers/SetProperty.h b/src/Gvas/Serialisers/SetProperty.h index d95a39c..5291d9f 100644 --- a/src/Gvas/Serialisers/SetProperty.h +++ b/src/Gvas/Serialisers/SetProperty.h @@ -30,10 +30,10 @@ class SetProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/StringProperty.cpp b/src/Gvas/Serialisers/StringProperty.cpp index b329628..0dbe810 100644 --- a/src/Gvas/Serialisers/StringProperty.cpp +++ b/src/Gvas/Serialisers/StringProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "StringProperty.h" @@ -33,7 +33,7 @@ StringProperty::types() { Types::UnrealPropertyBase::ptr StringProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(type); @@ -56,7 +56,7 @@ StringProperty::deserialise(Containers::StringView name, Containers::StringView } bool -StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, +StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto str_prop = dynamic_cast(prop.get()); diff --git a/src/Gvas/Serialisers/StringProperty.h b/src/Gvas/Serialisers/StringProperty.h index cc783da..ceba34b 100644 --- a/src/Gvas/Serialisers/StringProperty.h +++ b/src/Gvas/Serialisers/StringProperty.h @@ -32,10 +32,10 @@ class StringProperty : public AbstractUnrealProperty { auto types() -> StringArrayView override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; diff --git a/src/Gvas/Serialisers/Struct.cpp b/src/Gvas/Serialisers/Struct.cpp index 65b5074..e73ac8a 100644 --- a/src/Gvas/Serialisers/Struct.cpp +++ b/src/Gvas/Serialisers/Struct.cpp @@ -16,8 +16,8 @@ #include -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../PropertySerialiser.h" #include "../Types/GenericStructProperty.h" #include "../Types/NoneProperty.h" @@ -36,7 +36,7 @@ Struct::types() { PropertyArray Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) + std::uint32_t count, BinaryIo::Reader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -89,7 +89,7 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st Types::UnrealPropertyBase::ptr Struct::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { Containers::String item_type; if(!reader.readUEString(item_type)) { @@ -127,7 +127,7 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st bool Struct::serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { bytes_written += writer.writeUEStringToArray(*(props.front()->name)); bytes_written += writer.writeUEStringToArray(item_type); @@ -170,7 +170,7 @@ Struct::serialise(PropertyArrayView props, Containers::StringView item_type, std } bool -Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, +Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto struct_prop = dynamic_cast(prop.get()); @@ -198,7 +198,7 @@ Struct::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_writt Types::StructProperty::ptr Struct::readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { static_cast(value_length); @@ -223,7 +223,7 @@ Struct::readStructValue(Containers::StringView name, Containers::StringView type } bool -Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, +Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto struct_prop = dynamic_cast(prop); diff --git a/src/Gvas/Serialisers/Struct.h b/src/Gvas/Serialisers/Struct.h index 19931f2..18bd2b3 100644 --- a/src/Gvas/Serialisers/Struct.h +++ b/src/Gvas/Serialisers/Struct.h @@ -34,21 +34,21 @@ class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionPro auto types() -> StringArrayView override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - std::uint32_t count, BinaryReader& reader, PropertySerialiser& serialiser) + std::uint32_t count, BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> PropertyArray override; auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; bool serialise(PropertyArrayView props, Containers::StringView item_type, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) override; - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; private: auto readStructValue(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) -> Types::StructProperty::ptr; - bool writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryWriter& writer, + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::StructProperty::ptr; + bool writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser); }; diff --git a/src/Gvas/Serialisers/TextProperty.cpp b/src/Gvas/Serialisers/TextProperty.cpp index 3b51846..7525958 100644 --- a/src/Gvas/Serialisers/TextProperty.cpp +++ b/src/Gvas/Serialisers/TextProperty.cpp @@ -18,8 +18,8 @@ #include "../../Logger/Logger.h" -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "TextProperty.h" @@ -27,7 +27,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -73,8 +73,8 @@ TextProperty::deserialiseProperty(Containers::StringView name, Containers::Strin } bool -TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) +TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto text_prop = dynamic_cast(prop.get()); if(!text_prop) { diff --git a/src/Gvas/Serialisers/TextProperty.h b/src/Gvas/Serialisers/TextProperty.h index 3d47cbe..804743f 100644 --- a/src/Gvas/Serialisers/TextProperty.h +++ b/src/Gvas/Serialisers/TextProperty.h @@ -30,10 +30,10 @@ class TextProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/UnrealProperty.h b/src/Gvas/Serialisers/UnrealProperty.h index 507dde8..208a00f 100644 --- a/src/Gvas/Serialisers/UnrealProperty.h +++ b/src/Gvas/Serialisers/UnrealProperty.h @@ -52,13 +52,13 @@ class UnrealProperty : public AbstractUnrealProperty { } auto deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override { return deserialiseProperty(name, type, value_length, reader, serialiser); } - bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, + bool serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryIo::Writer& writer, PropertySerialiser& serialiser) override { return serialiseProperty(prop, bytes_written, writer, serialiser); @@ -66,11 +66,11 @@ class UnrealProperty : public AbstractUnrealProperty { private: virtual auto deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) - -> Types::UnrealPropertyBase::ptr = 0; + std::size_t value_length, BinaryIo::Reader& reader, + PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr = 0; virtual bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) = 0; + BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0; }; }} diff --git a/src/Gvas/Serialisers/Vector2DProperty.cpp b/src/Gvas/Serialisers/Vector2DProperty.cpp index f58fde0..e1eea29 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.cpp +++ b/src/Gvas/Serialisers/Vector2DProperty.cpp @@ -14,8 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "../../Logger/Logger.h" #include "Vector2DProperty.h" @@ -24,7 +24,8 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, - std::size_t value_length, BinaryReader& reader, PropertySerialiser& serialiser) + std::size_t value_length, BinaryIo::Reader& reader, + PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -38,7 +39,7 @@ Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::S bool Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto vector = dynamic_cast(prop.get()); if(!vector) { @@ -46,7 +47,8 @@ Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s return false; } - bytes_written += writer.writeValueToArray(vector->x) + writer.writeValueToArray(vector->y); + bytes_written += writer.writeValueToArray(vector->x) + + writer.writeValueToArray(vector->y); return true; } diff --git a/src/Gvas/Serialisers/Vector2DProperty.h b/src/Gvas/Serialisers/Vector2DProperty.h index 4789d6b..eb1935a 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.h +++ b/src/Gvas/Serialisers/Vector2DProperty.h @@ -30,10 +30,10 @@ class Vector2DProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} diff --git a/src/Gvas/Serialisers/VectorProperty.cpp b/src/Gvas/Serialisers/VectorProperty.cpp index 7c8294f..964097c 100644 --- a/src/Gvas/Serialisers/VectorProperty.cpp +++ b/src/Gvas/Serialisers/VectorProperty.cpp @@ -16,8 +16,8 @@ #include "../../Logger/Logger.h" -#include "../BinaryReader.h" -#include "../BinaryWriter.h" +#include "../../BinaryIo/Reader.h" +#include "../../BinaryIo/Writer.h" #include "VectorProperty.h" @@ -25,7 +25,7 @@ namespace Gvas { namespace Serialisers { Types::UnrealPropertyBase::ptr VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -39,7 +39,7 @@ VectorProperty::deserialiseProperty(Containers::StringView name, Containers::Str bool VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, - BinaryWriter& writer, PropertySerialiser& serialiser) + BinaryIo::Writer& writer, PropertySerialiser& serialiser) { auto vector = dynamic_cast(prop.get()); if(!vector) { @@ -47,7 +47,8 @@ VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz return false; } - bytes_written += writer.writeValueToArray(vector->x) + writer.writeValueToArray(vector->y) + + bytes_written += writer.writeValueToArray(vector->x) + + writer.writeValueToArray(vector->y) + writer.writeValueToArray(vector->z); return true; diff --git a/src/Gvas/Serialisers/VectorProperty.h b/src/Gvas/Serialisers/VectorProperty.h index e24881f..94ce181 100644 --- a/src/Gvas/Serialisers/VectorProperty.h +++ b/src/Gvas/Serialisers/VectorProperty.h @@ -30,10 +30,10 @@ class VectorProperty : public UnrealProperty { private: auto deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryReader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) -> Types::UnrealPropertyBase::ptr override; - bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, BinaryWriter& writer, - PropertySerialiser& serialiser) override; + bool serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes_written, + BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; }} -- 2.39.5 From f68dee939e198386990c858fe6c6a79d676b2d92 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 21:20:11 +0100 Subject: [PATCH 057/126] Gvas: improve a loop to avoid a useless move. --- src/Gvas/File.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Gvas/File.cpp b/src/Gvas/File.cpp index 1146d8b..a4fb2b1 100644 --- a/src/Gvas/File.cpp +++ b/src/Gvas/File.cpp @@ -227,9 +227,7 @@ File::loadData() { _customFormatData = Containers::Array{custom_format_data_size}; - for(std::uint32_t i = 0; i < custom_format_data_size; i++) { - CustomFormatDataEntry entry; - + for(auto& entry : _customFormatData) { if(!reader.readStaticArray(entry.id) || !reader.readInt32(entry.value)) { @@ -237,8 +235,6 @@ File::loadData() { LOG_ERROR(_lastError); return; } - - _customFormatData[i] = std::move(entry); } if(!reader.readUEString(_saveType)) { -- 2.39.5 From ba3769404d52c32ec4514b615ae3f2ad9c453577 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 8 Mar 2024 21:53:12 +0100 Subject: [PATCH 058/126] Configuration: update formatting. --- src/Configuration/Configuration.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index 70d4255..bb9b182 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -158,11 +158,13 @@ Configuration::setSkipDisclaimer(bool mode) { _conf.save(); } -bool Configuration::isRunningInWine() const { +bool +Configuration::isRunningInWine() const { return _isRunningInWine; } -void Configuration::setRunningInWine(bool wine) { +void +Configuration::setRunningInWine(bool wine) { _isRunningInWine = wine; } -- 2.39.5 From 43420d2277c73f075669c55bdb4dd062d2f806d3 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 9 Mar 2024 17:38:52 +0100 Subject: [PATCH 059/126] main: improve an error message. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 3415679..b31da04 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,7 +48,7 @@ int main(int argc, char** argv) { if(!locale.hasSuffix(".utf8") && !locale.hasSuffix(".65001")) { SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", - "Your system doesn't support UTF-8.", nullptr); + "Your system doesn't support the UTF-8 codepage.", nullptr); return EXIT_FAILURE; } -- 2.39.5 From efc3fe0dc73427d917f8d164b3a0d3051c86ca96 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 9 Mar 2024 18:09:27 +0100 Subject: [PATCH 060/126] Application: move folder management to Configuration. Also, add new folders for the upcoming weapon/armour/style export/import mechanism. --- src/Application/Application.cpp | 14 --- src/Application/Application.h | 14 --- .../Application_Initialisation.cpp | 112 +----------------- src/Application/Application_MainManager.cpp | 2 +- src/Application/Application_drawMainMenu.cpp | 32 +++-- src/Configuration/Configuration.cpp | 101 ++++++++++++++++ src/Configuration/Configuration.h | 22 ++++ src/main.cpp | 7 ++ 8 files changed, 157 insertions(+), 147 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index c066d29..b868c93 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -103,20 +103,6 @@ Application::Application(const Arguments& arguments): initialiseGui(); - if(!initialiseToolDirectories()) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", - _lastError.data(), window()); - exit(EXIT_FAILURE); - return; - } - - if(!findGameDataDirectory()) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error initialising the app", - _lastError.data(), window()); - exit(EXIT_FAILURE); - return; - } - checkGameState(); _gameCheckTimerId = SDL_AddTimer(2000, [](std::uint32_t interval, void* param)->std::uint32_t{ diff --git a/src/Application/Application.h b/src/Application/Application.h index bb3190a..c997776 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -102,8 +102,6 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void initialiseConfiguration(); void initialiseGui(); void initialiseManager(); - bool initialiseToolDirectories(); - bool findGameDataDirectory(); void initialiseMassManager(); void initialiseFileWatcher(); @@ -230,18 +228,6 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe Containers::String _lastError; - Containers::String _gameDataDir; - Containers::String _configDir; - Containers::String _saveDir; - Containers::String _screenshotsDir; - - Containers::String _backupsDir; - Containers::String _stagingDir; - //Containers::String _armouryDir; - //Containers::String _armoursDir; - //Containers::String _weaponsDir; - //Containers::String _stylesDir; - enum class GameState : std::uint8_t { Unknown, NotRunning, Running } _gameState{GameState::Unknown}; diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 87621ce..31f68e8 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -14,15 +14,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include -#include -#include - #include #include -#include - #include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../FontAwesome/IconsFontAwesome5Brands.h" @@ -115,7 +109,7 @@ Application::initialiseManager() { SDL_zero(event); event.type = _initEventId; - _profileManager.emplace(_saveDir, _backupsDir); + _profileManager.emplace(conf().directories().gameSaves, conf().directories().backups); if(!_profileManager->ready()) { event.user.code = ProfileManagerFailure; SDL_PushEvent(&event); @@ -126,115 +120,19 @@ Application::initialiseManager() { SDL_PushEvent(&event); } -auto -Application::initialiseToolDirectories() -> bool { - LOG_INFO("Initialising Save Tool directories."); - - _backupsDir = Utility::Path::join(Utility::Path::split(*Utility::Path::executableLocation()).first(), "backups"); - _stagingDir = Utility::Path::join(Utility::Path::split(*Utility::Path::executableLocation()).first(), "staging"); - //_armouryDir = Utility::Directory::join(Utility::Directory::path(Utility::Directory::executableLocation()), "armoury"); - //_armoursDir = Utility::Directory::join(_armouryDir, "armours"); - //_weaponsDir = Utility::Directory::join(_armouryDir, "weapons"); - //_stylesDir = Utility::Directory::join(_armouryDir, "styles"); - - if(!Utility::Path::exists(_backupsDir)) { - LOG_WARNING("Backups directory not found, creating..."); - if(!Utility::Path::make(_backupsDir)) { - LOG_ERROR(_lastError = "Couldn't create the backups directory."); - return false; - } - } - - if(!Utility::Path::exists(_stagingDir)) { - LOG_WARNING("Staging directory not found, creating..."); - if(!Utility::Path::make(_stagingDir)) { - LOG_ERROR(_lastError = "Couldn't create the staging directory."); - return false; - } - } - - //if(!Utility::Directory::exists(_armouryDir)) { - // Utility::Debug{} << "Armoury directory not found, creating..."; - // if(!Utility::Path::make(_armouryDir)) { - // Utility::Error{} << (_lastError = "Couldn't create the armoury directory."); - // return false; - // } - //} - - //if(!Utility::Directory::exists(_armoursDir)) { - // Utility::Debug{} << "Armours directory not found, creating..."; - // if(!Utility::Path::make(_armoursDir)) { - // Utility::Error{} << (_lastError = "Couldn't create the armours directory."); - // return false; - // } - //} - - //if(!Utility::Directory::exists(_weaponsDir)) { - // Utility::Debug{} << "Weapons directory not found, creating..."; - // if(!Utility::Path::make(_weaponsDir)) { - // Utility::Error{} << (_lastError = "Couldn't create the weapons directory."); - // return false; - // } - //} - - //if(!Utility::Directory::exists(_stylesDir)) { - // Utility::Debug{} << "Styles directory not found, creating..."; - // if(!Utility::Path::make(_stylesDir)) { - // Utility::Error{} << (_lastError = "Couldn't create the styles directory."); - // return false; - // } - //} - - return true; -} - -auto -Application::findGameDataDirectory() -> bool { - LOG_INFO("Searching for the game's save directory."); - - wchar_t* localappdata_path = nullptr; - Containers::ScopeGuard guard{localappdata_path, CoTaskMemFree}; - auto result = SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr, &localappdata_path); - if(result != S_OK) - { - char* message_buffer = nullptr; - auto size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - nullptr, result, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), - reinterpret_cast(&message_buffer), 0, nullptr); - String message{message_buffer, size}; - LocalFree(message_buffer); - - _lastError = Utility::format("SHGetKnownFolderPath() failed with error code {}: {}", result, message); - LOG_ERROR(_lastError); - return false; - } - - _gameDataDir = Utility::Path::join(Utility::Path::fromNativeSeparators(Utility::Unicode::narrow(localappdata_path)), "MASS_Builder"_s); - - if(!Utility::Path::exists(_gameDataDir)) { - LOG_ERROR(_lastError = _gameDataDir + " wasn't found. Make sure to play the game at least once."_s); - return false; - } - - _configDir = Utility::Path::join(_gameDataDir, "Saved/Config/WindowsNoEditor"_s); - _saveDir = Utility::Path::join(_gameDataDir, "Saved/SaveGames"_s); - _screenshotsDir = Utility::Path::join(_gameDataDir, "Saved/Screenshots/WindowsNoEditor"_s); - - return true; -} - void Application::initialiseMassManager() { LOG_INFO("Initialising the M.A.S.S. manager."); - _massManager.emplace(_saveDir, _currentProfile->account(), _currentProfile->isDemo(), _stagingDir); + _massManager.emplace(conf().directories().gameSaves, _currentProfile->account(), _currentProfile->isDemo(), + conf().directories().staging); } void Application::initialiseFileWatcher() { LOG_INFO("Initialising the file watcher."); _fileWatcher.emplace(); - _watchIDs[SaveDir] = _fileWatcher->addWatch(_saveDir, this, false); - _watchIDs[StagingDir] = _fileWatcher->addWatch(_stagingDir, this, false); + _watchIDs[SaveDir] = _fileWatcher->addWatch(conf().directories().gameSaves, this, false); + _watchIDs[StagingDir] = _fileWatcher->addWatch(conf().directories().staging, this, false); _fileWatcher->watch(); } diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index e3fb5e7..a5d56cf 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -538,7 +538,7 @@ Application::drawMassManager() { ImGui::TextUnformatted("Staging area"); ImGui::SameLine(); if(ImGui::SmallButton(ICON_FA_FOLDER_OPEN " Open staging folder")) { - openUri(Utility::Path::toNativeSeparators(_stagingDir)); + openUri(Utility::Path::toNativeSeparators(conf().directories().staging)); } for(const auto& pair : _massManager->stagedMasses()) { diff --git a/src/Application/Application_drawMainMenu.cpp b/src/Application/Application_drawMainMenu.cpp index de66c4b..dc7ddb9 100644 --- a/src/Application/Application_drawMainMenu.cpp +++ b/src/Application/Application_drawMainMenu.cpp @@ -31,29 +31,39 @@ Application::drawMainMenu() { } if(ImGui::BeginMenu("Save Tool##SaveToolMenu")) { - if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open game data directory", Utility::Path::exists(_gameDataDir))) { - if(ImGui::MenuItem(ICON_FA_COG " Configuration", nullptr, false, Utility::Path::exists(_configDir))) { - openUri(Utility::Path::toNativeSeparators(_configDir)); + if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open game data directory")) { + if(ImGui::MenuItem(ICON_FA_COG " Configuration", nullptr, false, + Utility::Path::exists(conf().directories().gameConfig))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().gameConfig)); } - if(ImGui::MenuItem(ICON_FA_SAVE " Saves", nullptr, false, Utility::Path::exists(_saveDir))) { - openUri(Utility::Path::toNativeSeparators(_saveDir)); + if(ImGui::MenuItem(ICON_FA_SAVE " Saves", nullptr, false, + Utility::Path::exists(conf().directories().gameSaves))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().gameSaves)); } - if(ImGui::MenuItem(ICON_FA_IMAGE " Screenshots", nullptr, false, Utility::Path::exists(_screenshotsDir))) { - openUri(Utility::Path::toNativeSeparators(_screenshotsDir)); + if(ImGui::MenuItem(ICON_FA_IMAGE " Screenshots", nullptr, false, + Utility::Path::exists(conf().directories().gameScreenshots))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().gameScreenshots)); } ImGui::EndMenu(); } if(ImGui::BeginMenu(ICON_FA_FOLDER_OPEN " Open manager directory")) { - if(ImGui::MenuItem(ICON_FA_FILE_ARCHIVE " Profile backups", nullptr, false, Utility::Path::exists(_backupsDir))) { - openUri(Utility::Path::toNativeSeparators(_backupsDir)); + if(ImGui::MenuItem(ICON_FA_FILE_ARCHIVE " Profile backups", nullptr, false, + Utility::Path::exists(conf().directories().backups))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().backups)); } - if(ImGui::MenuItem(ICON_FA_EXCHANGE_ALT " Staging area", nullptr, false, Utility::Path::exists(_stagingDir))) { - openUri(Utility::Path::toNativeSeparators(_stagingDir)); + if(ImGui::MenuItem(ICON_FA_EXCHANGE_ALT " Staging area", nullptr, false, + Utility::Path::exists(conf().directories().staging))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().staging)); } ImGui::EndMenu(); diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index bb9b182..62a6a62 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -16,7 +16,15 @@ #include #include +#include #include +#include + +#include +#include +#include + +#include "../Logger/Logger.h" #include "Configuration.h" @@ -75,12 +83,100 @@ Configuration::Configuration() { else { _conf.setValue("skip_disclaimer", _skipDisclaimer); } + + LOG_INFO("Searching for the game's save directory."); + wchar_t* localappdata_path = nullptr; + Containers::ScopeGuard guard{localappdata_path, CoTaskMemFree}; + auto result = SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_DEFAULT, nullptr, &localappdata_path); + if(result != S_OK) + { + char* message_buffer = nullptr; + auto size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + nullptr, result, MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), + reinterpret_cast(&message_buffer), 0, nullptr); + String message{message_buffer, size}; + LocalFree(message_buffer); + + _lastError = Utility::format("SHGetKnownFolderPath() failed with error code {}: {}", result, message); + LOG_ERROR(_lastError); + return; + } + + auto game_data_dir = Utility::Path::join( + Utility::Path::fromNativeSeparators(Utility::Unicode::narrow(localappdata_path)), + "MASS_Builder/Saved"_s + ); + if(!Utility::Path::exists(game_data_dir)) { + LOG_ERROR(_lastError = game_data_dir + " wasn't found. Make sure to play the game at least once."_s); + return; + } + + _directories.gameConfig = Utility::Path::join(game_data_dir, "Config/WindowsNoEditor"_s); + _directories.gameSaves = Utility::Path::join(game_data_dir, "SaveGames"_s); + _directories.gameScreenshots = Utility::Path::join(game_data_dir, "Screenshots/WindowsNoEditor"_s); + + LOG_INFO("Initialising Save Tool directories."); + Containers::String executable_location = Utility::Path::split(*Utility::Path::executableLocation()).first(); + _directories.backups = Utility::Path::join(executable_location, "backups"); + _directories.staging = Utility::Path::join(executable_location, "staging"); + auto armoury_dir = Utility::Path::join(executable_location, "armoury"); + _directories.armours = Utility::Path::join(armoury_dir, "armours"); + _directories.weapons = Utility::Path::join(armoury_dir, "weapons"); + _directories.styles = Utility::Path::join(armoury_dir, "styles"); + + if(!Utility::Path::exists(_directories.backups)) { + LOG_WARNING("Backups directory not found, creating..."); + if(!Utility::Path::make(_directories.backups)) { + LOG_ERROR(_lastError = "Couldn't create the backups directory."); + return; + } + } + if(!Utility::Path::exists(_directories.staging)) { + LOG_WARNING("Staging directory not found, creating..."); + if(!Utility::Path::make(_directories.staging)) { + LOG_ERROR(_lastError = "Couldn't create the staging directory."); + return; + } + } + if(!Utility::Path::exists(_directories.armours)) { + LOG_WARNING("Armours directory not found, creating..."); + if(!Utility::Path::make(_directories.armours)) { + LOG_ERROR(_lastError = "Couldn't create the armours directory."); + return; + } + } + if(!Utility::Path::exists(_directories.weapons)) { + LOG_WARNING("Weapons directory not found, creating..."); + if(!Utility::Path::make(_directories.weapons)) { + LOG_ERROR(_lastError = "Couldn't create the weapons directory."); + return; + } + } + if(!Utility::Path::exists(_directories.styles)) { + LOG_WARNING("Styles directory not found, creating..."); + if(!Utility::Path::make(_directories.styles)) { + LOG_ERROR(_lastError = "Couldn't create the styles directory."); + return; + } + } + + _valid = true; } Configuration::~Configuration() { save(); } +bool +Configuration::valid() const { + return _valid; +} + +Containers::StringView +Configuration::lastError() const { + return _lastError; +} + void Configuration::save() { _conf.save(); @@ -168,6 +264,11 @@ Configuration::setRunningInWine(bool wine) { _isRunningInWine = wine; } +Configuration::Directories const& +Configuration::directories() const { + return _directories; +} + Configuration& Configuration::instance() { static Configuration conf{}; diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index dcf4c46..febea45 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -28,6 +28,10 @@ class Configuration { ~Configuration(); + bool valid() const; + + auto lastError() const -> Containers::StringView; + void save(); auto swapInterval() const -> int; @@ -51,11 +55,25 @@ class Configuration { bool isRunningInWine() const; void setRunningInWine(bool wine); + struct Directories { + Containers::String gameSaves; + Containers::String gameConfig; + Containers::String gameScreenshots; + Containers::String backups; + Containers::String staging; + Containers::String armours; + Containers::String weapons; + Containers::String styles; + }; + auto directories() const -> Directories const&; + private: explicit Configuration(); Utility::Configuration _conf; + Containers::String _lastError; + int _swapInterval = 1; float _fpsCap = 60.0f; bool _cheatMode = false; @@ -64,6 +82,10 @@ class Configuration { bool _skipDisclaimer = false; bool _isRunningInWine = false; + + bool _valid = false; + + Directories _directories; }; Configuration& conf(); diff --git a/src/main.cpp b/src/main.cpp index b31da04..14142cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,6 +41,13 @@ int main(int argc, char** argv) { LOG_INFO("Initialising M.A.S.S. Builder Save Tool version " SAVETOOL_VERSION_STRING "."); + if(!mbst::conf().valid()) { + LOG_ERROR_FORMAT("There was an error initialising the app: {}", mbst::conf().lastError()); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", + mbst::conf().lastError().cbegin(), nullptr); + return EXIT_FAILURE; + } + auto str = setlocale(LC_ALL, ".utf-8"); if(str) { Containers::StringView locale{str}; -- 2.39.5 From 0b46403ededb6a9a59572aef99e5a2d4a32e9f05 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 9 Mar 2024 18:36:53 +0100 Subject: [PATCH 061/126] Application: add menu entries for the new folders. --- src/Application/Application_drawMainMenu.cpp | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Application/Application_drawMainMenu.cpp b/src/Application/Application_drawMainMenu.cpp index dc7ddb9..82c661f 100644 --- a/src/Application/Application_drawMainMenu.cpp +++ b/src/Application/Application_drawMainMenu.cpp @@ -66,6 +66,28 @@ Application::drawMainMenu() { openUri(Utility::Path::toNativeSeparators(conf().directories().staging)); } + if(ImGui::BeginMenu(ICON_FA_BOXES " Armoury")) { + if(ImGui::MenuItem(ICON_FA_SHIELD_ALT " Armour parts", nullptr, false, + Utility::Path::exists(conf().directories().armours))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().armours)); + } + + if(ImGui::MenuItem(ICON_FA_ROCKET " Weapons", nullptr, false, + Utility::Path::exists(conf().directories().weapons))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().weapons)); + } + + if(ImGui::MenuItem(ICON_FA_PALETTE " Custom styles", nullptr, false, + Utility::Path::exists(conf().directories().styles))) + { + openUri(Utility::Path::toNativeSeparators(conf().directories().styles)); + } + + ImGui::EndMenu(); + } + ImGui::EndMenu(); } -- 2.39.5 From cd5213a3f9d6297d2d53e7f78619283cd026675e Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 9 Mar 2024 20:24:30 +0100 Subject: [PATCH 062/126] Application: change a menu entry icon. --- src/Application/Application_drawMainMenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Application/Application_drawMainMenu.cpp b/src/Application/Application_drawMainMenu.cpp index 82c661f..957089e 100644 --- a/src/Application/Application_drawMainMenu.cpp +++ b/src/Application/Application_drawMainMenu.cpp @@ -73,7 +73,7 @@ Application::drawMainMenu() { openUri(Utility::Path::toNativeSeparators(conf().directories().armours)); } - if(ImGui::MenuItem(ICON_FA_ROCKET " Weapons", nullptr, false, + if(ImGui::MenuItem(ICON_FA_HAMMER " Weapons", nullptr, false, Utility::Path::exists(conf().directories().weapons))) { openUri(Utility::Path::toNativeSeparators(conf().directories().weapons)); -- 2.39.5 From 387647669f78a0eb80f505b897a9679bc6f5c3dc Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 10 Mar 2024 12:49:02 +0100 Subject: [PATCH 063/126] Application: use ImGui::BeginTooltip() correctly. --- src/Application/Application.cpp | 3 +-- src/Application/Application_ProfileManager.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index b868c93..01764aa 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -402,8 +402,7 @@ Application::drawHelpMarker(Containers::StringView text, float wrap_pos) { void Application::drawTooltip(Containers::StringView text, float wrap_pos) { - if(ImGui::IsItemHovered()){ - ImGui::BeginTooltip(); + if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { if(wrap_pos > 0.0f) { ImGui::PushTextWrapPos(wrap_pos); } diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index 5f77c59..e314ffe 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -267,8 +267,7 @@ Application::drawBackupListPopup() { ImGui::TableSetColumnIndex(0); ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); - if(ImGui::IsItemHovered()) { - ImGui::BeginTooltip(); + if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { for(const auto& file : backup.includedFiles) { ImGui::TextUnformatted(file.cbegin()); } -- 2.39.5 From e9fad7600be0437b28533881e632f0b6632022ef Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 10 Mar 2024 14:03:51 +0100 Subject: [PATCH 064/126] Application: reorganise profile manager UI code. --- src/Application/Application.h | 8 +- .../Application_ProfileManager.cpp | 218 +++++++++--------- 2 files changed, 114 insertions(+), 112 deletions(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index c997776..1c22d37 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -113,9 +113,11 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawInitialisation(); void drawProfileManager(); - auto drawBackupListPopup() -> ImGuiID; - auto drawBackupProfilePopup(std::size_t profile_index) -> ImGuiID; - auto drawDeleteProfilePopup(std::size_t profile_index) -> ImGuiID; + void drawBackupListPopup(); + void drawBackupRestorePopup(std::size_t backup_index); + void drawBackupDeletePopup(std::size_t backup_index); + void drawBackupProfilePopup(std::size_t profile_index); + void drawDeleteProfilePopup(std::size_t profile_index); void drawManager(); bool drawIntEditPopup(int* value_to_edit, int max); diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index e314ffe..29b5e8d 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -40,10 +40,6 @@ Application::drawProfileManager() { ImGui::EndMenuBar(); } - static ImGuiID backup_list_popup_id = drawBackupListPopup(); - static ImGuiID backup_popup_id = drawBackupProfilePopup(profile_index); - static ImGuiID delete_popup_id = drawDeleteProfilePopup(profile_index); - if(ImGui::BeginTable("##ManagerLayout", 2)) { ImGui::TableSetupColumn("##Label", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##Refresh", ImGuiTableColumnFlags_WidthFixed); @@ -63,8 +59,9 @@ Application::drawProfileManager() { ImGui::SameLine(); if(ImGui::SmallButton("Backups")) { _profileManager->refreshBackups(); - ImGui::OpenPopup(backup_list_popup_id); + ImGui::OpenPopup("Backups##BackupsModal"); } + drawBackupListPopup(); ImGui::EndTable(); } @@ -104,15 +101,17 @@ Application::drawProfileManager() { ImGui::TableSetColumnIndex(2); if(ImGui::SmallButton(ICON_FA_FILE_ARCHIVE)) { profile_index = i; - ImGui::OpenPopup(backup_popup_id); + ImGui::OpenPopup("Include builds ?##IncludeBuildsDialog"); } drawTooltip("Backup"); + drawBackupProfilePopup(profile_index); ImGui::SameLine(0.0f, 2.0f); if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_TRASH_ALT)) { profile_index = i; - ImGui::OpenPopup(delete_popup_id); + ImGui::OpenPopup("Confirmation##DeleteProfileConfirmation"); } drawTooltip("Delete"); + drawDeleteProfilePopup(profile_index); ImGui::PopID(); } ImGui::EndTable(); @@ -121,108 +120,20 @@ Application::drawProfileManager() { ImGui::TextUnformatted("Click a profile to manage it."); } - drawBackupListPopup(); - drawBackupProfilePopup(profile_index); - drawDeleteProfilePopup(profile_index); - ImGui::End(); } -ImGuiID +void Application::drawBackupListPopup() { ImGui::SetNextWindowPos(ImVec2{Vector2{windowSize() / 2.0f} / dpiScaling()}, ImGuiCond_Always, center_pivot); if(!ImGui::BeginPopupModal("Backups##BackupsModal", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { - return ImGui::GetID("Backups##BackupsModal"); + return; } static std::size_t backup_index; - if(ImGui::BeginPopupModal("Restore backup", nullptr, - ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) - { - ImGui::PushTextWrapPos(float(windowSize().x()) * 0.40f); - ImGui::Text("Are you sure you want to restore the %s backup from %.4i-%.2i-%.2i %.2i:%.2i:%.2i ? Any existing data will be overwritten.", - _profileManager->backups()[backup_index].company.data(), - _profileManager->backups()[backup_index].timestamp.year, - _profileManager->backups()[backup_index].timestamp.month, - _profileManager->backups()[backup_index].timestamp.day, - _profileManager->backups()[backup_index].timestamp.hour, - _profileManager->backups()[backup_index].timestamp.minute, - _profileManager->backups()[backup_index].timestamp.second); - ImGui::PopTextWrapPos(); - - if(ImGui::BeginTable("##RestoreBackupLayout", 2)) { - ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##YesNo", ImGuiTableColumnFlags_WidthFixed); - - ImGui::TableNextRow(); - - ImGui::TableSetColumnIndex(1); - if(ImGui::Button("Yes")) { - if(!_profileManager->restoreBackup(backup_index)) { - _queue.addToast(Toast::Type::Error, _profileManager->lastError()); - } - if(!_profileManager->refreshProfiles()) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", - _profileManager->lastError().data(), window()); - exit(EXIT_FAILURE); - } - ImGui::CloseCurrentPopup(); - } - ImGui::SameLine(); - if(ImGui::Button("No", ImGui::GetItemRectSize())) { - ImGui::CloseCurrentPopup(); - } - - ImGui::EndTable(); - } - - ImGui::EndPopup(); - } - - if(ImGui::BeginPopupModal("Delete backup", nullptr, - ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) - { - ImGui::PushTextWrapPos(float(windowSize().x()) * 0.40f); - ImGui::Text("Are you sure you want to delete the %s backup from %.4i-%.2i-%.2i %.2i:%.2i:%.2i ? This operation is irreversible.", - _profileManager->backups()[backup_index].company.data(), - _profileManager->backups()[backup_index].timestamp.year, - _profileManager->backups()[backup_index].timestamp.month, - _profileManager->backups()[backup_index].timestamp.day, - _profileManager->backups()[backup_index].timestamp.hour, - _profileManager->backups()[backup_index].timestamp.minute, - _profileManager->backups()[backup_index].timestamp.second); - ImGui::PopTextWrapPos(); - - if(ImGui::BeginTable("##DeleteBackupLayout", 2)) { - ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##YesNo", ImGuiTableColumnFlags_WidthFixed); - - ImGui::TableNextRow(); - - ImGui::TableSetColumnIndex(1); - if(ImGui::Button("Yes")) { - if(!_profileManager->deleteBackup(backup_index)) { - _queue.addToast(Toast::Type::Error, _profileManager->lastError()); - } - ImGui::CloseCurrentPopup(); - } - ImGui::SameLine(); - if(ImGui::Button("No", ImGui::GetItemRectSize())) { - ImGui::CloseCurrentPopup(); - } - - ImGui::EndTable(); - } - - ImGui::EndPopup(); - } - - static ImGuiID restore_backup_popup_id = ImGui::GetID("Restore backup"); - static ImGuiID delete_backup_popup_id = ImGui::GetID("Delete backup"); - if(ImGui::BeginTable("##BackupsLabelLayout", 2)) { ImGui::TableSetupColumn("##Label", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##Refresh", ImGuiTableColumnFlags_WidthFixed); @@ -290,15 +201,17 @@ Application::drawBackupListPopup() { ImGui::PushID(int(i)); if(ImGui::SmallButton(ICON_FA_UNDO)) { backup_index = i; - ImGui::OpenPopup(restore_backup_popup_id); + ImGui::OpenPopup("Restore backup##RestoreBackupModal"); } drawTooltip("Restore"); + drawBackupRestorePopup(backup_index); ImGui::SameLine(0.0f, 2.0f); if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { backup_index = i; - ImGui::OpenPopup(delete_backup_popup_id); + ImGui::OpenPopup("Delete backup##DeleteBackupModal"); } drawTooltip("Delete"); + drawBackupDeletePopup(backup_index); ImGui::PopID(); } ImGui::EndTable(); @@ -323,16 +236,107 @@ Application::drawBackupListPopup() { } ImGui::EndPopup(); - - return 0; } -ImGuiID +void +Application::drawBackupRestorePopup(std::size_t backup_index) { + if(!ImGui::BeginPopupModal("Restore backup##RestoreBackupModal", nullptr, + ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) + { + return; + } + + ImGui::PushTextWrapPos(float(windowSize().x()) * 0.50f); + ImGui::Text("Are you sure you want to restore the %s backup from %.4i-%.2i-%.2i %.2i:%.2i:%.2i ?\n\n" + "Any existing data will be overwritten.", + _profileManager->backups()[backup_index].company.data(), + _profileManager->backups()[backup_index].timestamp.year, + _profileManager->backups()[backup_index].timestamp.month, + _profileManager->backups()[backup_index].timestamp.day, + _profileManager->backups()[backup_index].timestamp.hour, + _profileManager->backups()[backup_index].timestamp.minute, + _profileManager->backups()[backup_index].timestamp.second); + ImGui::PopTextWrapPos(); + + if(ImGui::BeginTable("##RestoreBackupLayout", 2)) { + ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); + ImGui::TableSetupColumn("##YesNo", ImGuiTableColumnFlags_WidthFixed); + + ImGui::TableNextRow(); + + ImGui::TableSetColumnIndex(1); + if(ImGui::Button("Yes")) { + if(!_profileManager->restoreBackup(backup_index)) { + _queue.addToast(Toast::Type::Error, _profileManager->lastError()); + } + if(!_profileManager->refreshProfiles()) { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", + _profileManager->lastError().data(), window()); + exit(EXIT_FAILURE); + } + ImGui::CloseCurrentPopup(); + } + ImGui::SameLine(); + if(ImGui::Button("No", ImGui::GetItemRectSize())) { + ImGui::CloseCurrentPopup(); + } + + ImGui::EndTable(); + } + + ImGui::EndPopup(); +} + +void +Application::drawBackupDeletePopup(std::size_t backup_index) { + if(!ImGui::BeginPopupModal("Delete backup##DeleteBackupModal", nullptr, + ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) + { + return; + } + + ImGui::PushTextWrapPos(float(windowSize().x()) * 0.50f); + ImGui::Text("Are you sure you want to delete the %s backup from %.4i-%.2i-%.2i %.2i:%.2i:%.2i ?\n\n" + "This operation is irreversible.", + _profileManager->backups()[backup_index].company.data(), + _profileManager->backups()[backup_index].timestamp.year, + _profileManager->backups()[backup_index].timestamp.month, + _profileManager->backups()[backup_index].timestamp.day, + _profileManager->backups()[backup_index].timestamp.hour, + _profileManager->backups()[backup_index].timestamp.minute, + _profileManager->backups()[backup_index].timestamp.second); + ImGui::PopTextWrapPos(); + + if(ImGui::BeginTable("##DeleteBackupLayout", 2)) { + ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); + ImGui::TableSetupColumn("##YesNo", ImGuiTableColumnFlags_WidthFixed); + + ImGui::TableNextRow(); + + ImGui::TableSetColumnIndex(1); + if(ImGui::Button("Yes")) { + if(!_profileManager->deleteBackup(backup_index)) { + _queue.addToast(Toast::Type::Error, _profileManager->lastError()); + } + ImGui::CloseCurrentPopup(); + } + ImGui::SameLine(); + if(ImGui::Button("No", ImGui::GetItemRectSize())) { + ImGui::CloseCurrentPopup(); + } + + ImGui::EndTable(); + } + + ImGui::EndPopup(); +} + +void Application::drawBackupProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Include builds ?##IncludeBuildsDialog", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { - return ImGui::GetID("Include builds ?##IncludeBuildsDialog"); + return; } ImGui::TextUnformatted("Should builds be added to the backup ?"); @@ -368,16 +372,14 @@ Application::drawBackupProfilePopup(std::size_t profile_index) { } ImGui::EndPopup(); - - return 0; } -ImGuiID +void Application::drawDeleteProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteProfileConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { - return ImGui::GetID("Confirmation##DeleteProfileConfirmation"); + return; } static bool delete_builds = false; @@ -415,8 +417,6 @@ Application::drawDeleteProfilePopup(std::size_t profile_index) { } ImGui::EndPopup(); - - return 0; } } -- 2.39.5 From 5cb04e7c209ca87a19eea06054559538cf925167 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 10 Mar 2024 15:23:39 +0100 Subject: [PATCH 065/126] Application: slightly improve code style. --- src/Application/Application_MassViewer.cpp | 3 +-- src/Application/Application_MassViewer_Armour.cpp | 3 +-- src/Application/Application_MassViewer_Frame.cpp | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index 34d13a8..ad3d288 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -180,8 +180,7 @@ Application::drawGlobalStyles() { for(std::uint32_t i = 0; i < _currentMass->globalStyles().size(); i++) { ImGui::PushID(int(i)); - DCSResult result; - result = drawCustomStyle(_currentMass->globalStyles()[i]); + auto result = drawCustomStyle(_currentMass->globalStyles()[i]); switch(result) { case DCS_ResetStyle: _currentMass->getGlobalStyles(); diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index 5579f96..21346db 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -349,8 +349,7 @@ Application::drawCustomArmourStyles() { for(std::uint32_t i = 0; i < _currentMass->armourCustomStyles().size(); i++) { ImGui::PushID(int(i)); - DCSResult result; - result = drawCustomStyle(_currentMass->armourCustomStyles()[i]); + auto result = drawCustomStyle(_currentMass->armourCustomStyles()[i]); switch(result) { case DCS_ResetStyle: _currentMass->getArmourCustomStyles(); diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index 347374d..39c2fcb 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -268,8 +268,7 @@ Application::drawCustomFrameStyles() { for(std::uint32_t i = 0; i < _currentMass->frameCustomStyles().size(); i++) { ImGui::PushID(int(i)); - DCSResult result; - result = drawCustomStyle(_currentMass->frameCustomStyles()[i]); + auto result = drawCustomStyle(_currentMass->frameCustomStyles()[i]); switch(result) { case DCS_ResetStyle: _currentMass->getFrameCustomStyles(); -- 2.39.5 From 20f116d832f82ab397ee195c70c6ba408c66ec19 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 11 Mar 2024 22:16:51 +0100 Subject: [PATCH 066/126] Mass: improve formatting slightly. --- src/Mass/Mass_Weapons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index 01f6f96..3527de4 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -356,7 +356,7 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_DUAL_WIELD)->value = weapon.dualWield; switch(weapon.effectColourMode) { - #define c(enumerator, enumstr) case Weapon::EffectColourMode::enumerator: \ + #define c(enumerator, enumstr) case Weapon::EffectColourMode::enumerator: \ weapon_prop->at(MASS_WEAPON_COLOUR_EFX_MODE)->enumValue = enumstr; \ break; #include "../Maps/EffectColourModes.hpp" -- 2.39.5 From d242431d78ed2658074980156f86a297968c157d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 14 Mar 2024 15:09:08 +0100 Subject: [PATCH 067/126] Mass: how did that space get here ? --- src/Mass/Mass.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mass/Mass.h b/src/Mass/Mass.h index 4696347..3c9d921 100644 --- a/src/Mass/Mass.h +++ b/src/Mass/Mass.h @@ -54,7 +54,7 @@ class Mass { Mass(Mass&&) = default; Mass& operator=(Mass&&) = default; - auto lastError() -> Containers::StringView ; + auto lastError() -> Containers::StringView; static auto getNameFromFile(Containers::StringView path) -> Containers::Optional; -- 2.39.5 From c9ac1ad4c81ce326e395b558d4697a400de7372c Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 17 Mar 2024 15:57:31 +0100 Subject: [PATCH 068/126] Utility/Crc32: fix naming. --- src/Utilities/Crc32.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Utilities/Crc32.cpp b/src/Utilities/Crc32.cpp index a4417aa..f293d98 100644 --- a/src/Utilities/Crc32.cpp +++ b/src/Utilities/Crc32.cpp @@ -16,10 +16,10 @@ #include "Crc32.h" -namespace mbst { namespace Crc32 { +namespace mbst { namespace Utilities { std::uint32_t -update(std::uint32_t initial, Containers::ArrayView data) { +crc32(std::uint32_t initial, Containers::ArrayView data) { static const auto table = []{ std::uint32_t polynomial = 0xEDB88320u; Containers::StaticArray<256, std::uint32_t> temp{ValueInit}; -- 2.39.5 From 04e99d49533d0cad64cf8c013103427953730001 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 25 Mar 2024 12:02:12 +0100 Subject: [PATCH 069/126] BinaryIo: fix Reader::readValue(). std::fread() returns how many things it read, not the amount of bytes read. Worst thing is, I got this right everywhere else. --- src/BinaryIo/Reader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BinaryIo/Reader.h b/src/BinaryIo/Reader.h index 794470f..6a00886 100644 --- a/src/BinaryIo/Reader.h +++ b/src/BinaryIo/Reader.h @@ -61,7 +61,7 @@ class Reader { template bool readValue(T& value) { - return fread(&value, sizeof(T), 1, _file) == sizeof(T); + return fread(&value, sizeof(T), 1, _file) == 1; } template -- 2.39.5 From 90a2a9edd95aa2273d1651719000a0f835ac2ee5 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 25 Mar 2024 12:08:35 +0100 Subject: [PATCH 070/126] Add ImportExport, with custom style support. --- src/CMakeLists.txt | 9 ++ src/ImportExport/Export.cpp | 127 ++++++++++++++++++++++++ src/ImportExport/Export.h | 31 ++++++ src/ImportExport/Import.cpp | 186 ++++++++++++++++++++++++++++++++++++ src/ImportExport/Import.h | 31 ++++++ src/ImportExport/Keys.h | 36 +++++++ src/Mass/CustomStyle.h | 9 ++ src/Mass/Mass_Armour.cpp | 4 + src/Mass/Mass_Frame.cpp | 4 + src/Mass/Mass_Styles.cpp | 4 + src/Mass/Mass_Weapons.cpp | 4 + 11 files changed, 445 insertions(+) create mode 100644 src/ImportExport/Export.cpp create mode 100644 src/ImportExport/Export.h create mode 100644 src/ImportExport/Import.cpp create mode 100644 src/ImportExport/Import.h create mode 100644 src/ImportExport/Keys.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 67291af..ef8f1a7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -128,6 +128,14 @@ set(Gvas_SOURCES Gvas/PropertySerialiser.cpp ) +set(ImportExport_SOURCES + ImportExport/Import.h + ImportExport/Import.cpp + ImportExport/Export.h + ImportExport/Export.cpp + ImportExport/Keys.h +) + if(CORRADE_TARGET_WINDOWS) set(SAVETOOL_RC_FILE resource.rc) endif() @@ -199,6 +207,7 @@ add_executable(MassBuilderSaveTool ${Logger_SOURCES} ${BinaryIo_SOURCES} ${Gvas_SOURCES} + ${ImportExport_SOURCES} ${SAVETOOL_RC_FILE} ${Assets} ) diff --git a/src/ImportExport/Export.cpp b/src/ImportExport/Export.cpp new file mode 100644 index 0000000..44d4309 --- /dev/null +++ b/src/ImportExport/Export.cpp @@ -0,0 +1,127 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include + +#include "../Logger/Logger.h" +#include "../BinaryIo/Writer.h" +#include "../Configuration/Configuration.h" +#include "../Utilities/Crc32.h" + +#include "Keys.h" + +#include "Export.h" + +namespace mbst { namespace ImportExport { + +static Containers::String last_export_error; + +Containers::StringView +lastExportError() { + return last_export_error; +} + +bool +exportStyle(Containers::StringView mass_name, mbst::GameObjects::CustomStyle& style) { + Containers::String style_type_str; + switch(style.type) { + case GameObjects::CustomStyle::Type::Unknown: + style_type_str = "Style"; + break; + case GameObjects::CustomStyle::Type::Frame: + style_type_str = "FrameStyle"; + break; + case GameObjects::CustomStyle::Type::Armour: + style_type_str = "ArmourStyle"; + break; + case GameObjects::CustomStyle::Type::Weapon: + style_type_str = "WeaponStyle"; + break; + case GameObjects::CustomStyle::Type::Global: + style_type_str = "GlobalStyle"; + break; + } + + auto filename = Utility::format("{}_{}_{}.style.mbst", mass_name, style_type_str, style.name); + for(auto& c : filename) { + if(c == ' ') { + c = '_'; + } + } + + auto path = Utility::Path::join(conf().directories().styles, filename); + BinaryIo::Writer writer{path}; + + if(!writer.open()) { + last_export_error = path + " couldn't be opened."; + return false; + } + + if(!writer.writeString("MBSTSTYLE")) { + LOG_ERROR(last_export_error = "Couldn't write magic bytes into " + filename); + return false; + } + + writer.writeValueToArray(Keys::CustomStyle::Name); + writer.writeUEStringToArray(style.name); + + writer.writeValueToArray(Keys::CustomStyle::Colour); + writer.writeValueToArray(style.colour); + writer.writeValueToArray(Keys::CustomStyle::Metallic); + writer.writeValueToArray(style.metallic); + writer.writeValueToArray(Keys::CustomStyle::Gloss); + writer.writeValueToArray(style.gloss); + writer.writeValueToArray(Keys::CustomStyle::Glow); + writer.writeValueToArray(style.glow); + + writer.writeValueToArray(Keys::CustomStyle::PatternId); + writer.writeValueToArray(style.patternId); + writer.writeValueToArray(Keys::CustomStyle::PatternOpacity); + writer.writeValueToArray(style.opacity); + writer.writeValueToArray(Keys::CustomStyle::PatternOffset); + writer.writeValueToArray(style.offset); + writer.writeValueToArray(Keys::CustomStyle::PatternRotation); + writer.writeValueToArray(style.rotation); + writer.writeValueToArray(Keys::CustomStyle::PatternScale); + writer.writeValueToArray(style.scale); + + if(!writer.writeUint64(writer.array().size())) { + LOG_ERROR(last_export_error = "Couldn't write data size into " + filename); + writer.closeFile(); + Utility::Path::remove(path); + return false; + } + + auto crc = Utilities::crc32(0, writer.array()); + if(!writer.writeUint32(crc)) { + LOG_ERROR(last_export_error = "Couldn't write CRC32 checksum into " + filename); + writer.closeFile(); + Utility::Path::remove(path); + return false; + } + + if(!writer.flushToFile()) { + LOG_ERROR(last_export_error = "Couldn't write data into " + filename); + writer.closeFile(); + Utility::Path::remove(path); + return false; + } + + return true; +} + +}} diff --git a/src/ImportExport/Export.h b/src/ImportExport/Export.h new file mode 100644 index 0000000..46c00f8 --- /dev/null +++ b/src/ImportExport/Export.h @@ -0,0 +1,31 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "../Mass/CustomStyle.h" + +using namespace Corrade; + +namespace mbst { namespace ImportExport { + +auto lastExportError() -> Containers::StringView; + +bool exportStyle(Containers::StringView mass_name, GameObjects::CustomStyle& style); + +}} diff --git a/src/ImportExport/Import.cpp b/src/ImportExport/Import.cpp new file mode 100644 index 0000000..d07a863 --- /dev/null +++ b/src/ImportExport/Import.cpp @@ -0,0 +1,186 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include +#include +#include +#include + +#include "../BinaryIo/Reader.h" +#include "../Configuration/Configuration.h" +#include "../Logger/Logger.h" +#include "../Utilities/Crc32.h" + +#include "Keys.h" + +#include "Import.h" + +namespace mbst { namespace ImportExport { + +static Containers::String last_import_error; + +Containers::StringView +lastImportError() { + return last_import_error; +} + +Containers::Optional +importStyle(Containers::StringView filename) { + auto path = Utility::Path::join(conf().directories().styles, filename); + if(!Utility::Path::exists(path)) { + LOG_ERROR(last_import_error = path + " doesn't exist."); + return Containers::NullOpt; + } + + BinaryIo::Reader reader{path}; + if(!reader.open()) { + last_import_error = path + " couldn't be opened."; + return Containers::NullOpt; + } + + Containers::Array magic_bytes; + if(!reader.readArray(magic_bytes, 9)) { + LOG_ERROR(last_import_error = "Couldn't read the magic bytes."); + return Containers::NullOpt; + } + + Containers::StringView magic_bytes_view = magic_bytes; + static const auto expected_magic_bytes = "MBSTSTYLE"_s; + if(magic_bytes_view != expected_magic_bytes) { + LOG_ERROR(last_import_error = "Magic bytes are mismatched."); + return Containers::NullOpt; + } + + std::size_t data_size; + if(!reader.readUint64(data_size)) { + LOG_ERROR(last_import_error = "Couldn't read data size."); + return Containers::NullOpt; + } + + std::uint32_t crc; + if(!reader.readUint32(crc)) { + LOG_ERROR(last_import_error = "Couldn't read CRC-32 checksum."); + return Containers::NullOpt; + } + + auto position = reader.position(); + + { + Containers::Array data; + if(!reader.readArray(data, data_size)) { + LOG_ERROR(last_import_error = "Couldn't read data."); + return Containers::NullOpt; + } + + auto computed_crc = Utilities::crc32(0, data); + if(computed_crc != crc) { + LOG_ERROR(last_import_error = Utility::format("CRC-32 checksum doesn't match. " + "Expected {}, got {} instead.", + crc, computed_crc)); + return Containers::NullOpt; + } + } + + if(!reader.seek(position)) { + LOG_ERROR(last_import_error = Utility::format("Couldn't seek to position {}.", position)); + return Containers::NullOpt; + } + + GameObjects::CustomStyle style{}; + + while(!reader.eof()) { + Keys::CustomStyle key; + if(!reader.readValue(key)) { + if(reader.eof()) { + break; + } + LOG_ERROR(last_import_error = "Couldn't read key."); + return Containers::NullOpt; + } + + switch(key) { + case Keys::Name: + if(!reader.readUEString(style.name)) { + LOG_ERROR(last_import_error = "Couldn't read style name."); + return Containers::NullOpt; + } + break; + case Keys::Colour: + if(!reader.readValue(style.colour)) { + LOG_ERROR(last_import_error = "Couldn't read style colour."); + return Containers::NullOpt; + } + break; + case Keys::Metallic: + if(!reader.readFloat(style.metallic)) { + LOG_ERROR(last_import_error = "Couldn't read style metallic."); + return Containers::NullOpt; + } + break; + case Keys::Gloss: + if(!reader.readFloat(style.gloss)) { + LOG_ERROR(last_import_error = "Couldn't read style gloss."); + return Containers::NullOpt; + } + break; + case Keys::Glow: + if(!reader.readValue(style.glow)) { + LOG_ERROR(last_import_error = "Couldn't read style glow."); + return Containers::NullOpt; + } + break; + case Keys::PatternId: + if(!reader.readInt32(style.patternId)) { + LOG_ERROR(last_import_error = "Couldn't read style pattern ID."); + return Containers::NullOpt; + } + break; + case Keys::PatternOpacity: + if(!reader.readFloat(style.opacity)) { + LOG_ERROR(last_import_error = "Couldn't read style pattern opacity."); + return Containers::NullOpt; + } + break; + case Keys::PatternOffset: + if(!reader.readValue(style.offset)) { + LOG_ERROR(last_import_error = "Couldn't read style pattern offset."); + return Containers::NullOpt; + } + break; + case Keys::PatternRotation: + if(!reader.readFloat(style.rotation)) { + LOG_ERROR(last_import_error = "Couldn't read style pattern rotation."); + return Containers::NullOpt; + } + break; + case Keys::PatternScale: + if(!reader.readFloat(style.scale)) { + LOG_ERROR(last_import_error = "Couldn't read style pattern scale."); + return Containers::NullOpt; + } + break; + default: + LOG_ERROR(last_import_error = Utility::format("Unknown key {}.", key)); + return Containers::NullOpt; + } + } + + return Utility::move(style); +} + +}} diff --git a/src/ImportExport/Import.h b/src/ImportExport/Import.h new file mode 100644 index 0000000..184ae07 --- /dev/null +++ b/src/ImportExport/Import.h @@ -0,0 +1,31 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include "../Mass/CustomStyle.h" + +using namespace Corrade; + +namespace mbst { namespace ImportExport { + +auto lastImportError() -> Containers::StringView; + +auto importStyle(Containers::StringView filename) -> Containers::Optional; + +}} diff --git a/src/ImportExport/Keys.h b/src/ImportExport/Keys.h new file mode 100644 index 0000000..0ea1228 --- /dev/null +++ b/src/ImportExport/Keys.h @@ -0,0 +1,36 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +namespace mbst { namespace ImportExport { namespace Keys { + +enum CustomStyle: std::uint8_t { + Name = 0, // type: string + Colour = 1, // type: Magnum::Color4 + Metallic = 2, // type: float + Gloss = 3, // type: float + Glow = 4, // type: bool + PatternId = 5, // type: std::int32_t + PatternOpacity = 6, // type: float + PatternOffset = 7, // type: Magnum::Vector2 + PatternRotation = 8, // type: float + PatternScale = 9, // type: float +}; + +}}} diff --git a/src/Mass/CustomStyle.h b/src/Mass/CustomStyle.h index b041f8c..b7d6ec0 100644 --- a/src/Mass/CustomStyle.h +++ b/src/Mass/CustomStyle.h @@ -39,6 +39,15 @@ struct CustomStyle { Vector2 offset{0.5f}; float rotation = 0.0f; float scale = 0.5f; + + // This is only used to know which style array the current style is located in when exporting a standalone style. + enum class Type: std::uint8_t { + Unknown, + Frame, + Armour, + Weapon, + Global + } type = Type::Unknown; }; }} diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 720026a..8f42da0 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -413,6 +413,10 @@ Mass::getArmourCustomStyles() { } getCustomStyles(_armour.customStyles, armour_styles); + + for(auto& style : _armour.customStyles) { + style.type = CustomStyle::Type::Armour; + } } bool diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index 58df0d7..f897ed9 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -373,6 +373,10 @@ Mass::getFrameCustomStyles() { } getCustomStyles(_frame.customStyles, frame_styles); + + for(auto& style : _frame.customStyles) { + style.type = CustomStyle::Type::Frame; + } } bool diff --git a/src/Mass/Mass_Styles.cpp b/src/Mass/Mass_Styles.cpp index 9db7c05..daa0c8d 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/Mass/Mass_Styles.cpp @@ -57,6 +57,10 @@ Mass::getGlobalStyles() { } getCustomStyles(_globalStyles, global_styles); + + for(auto& style : _globalStyles) { + style.type = CustomStyle::Type::Global; + } } bool diff --git a/src/Mass/Mass_Weapons.cpp b/src/Mass/Mass_Weapons.cpp index 3527de4..ef8f975 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/Mass/Mass_Weapons.cpp @@ -219,6 +219,10 @@ Mass::getWeaponType(Containers::StringView prop_name, Containers::ArrayViewat(MASS_WEAPON_ATTACH)->value; auto& damage_type = weapon_prop->at(MASS_WEAPON_DAMAGE_TYPE)->enumValue; #define c(enumerator, strenum) if(damage_type == (strenum)) { weapon.damageType = Weapon::DamageType::enumerator; } else -- 2.39.5 From fd9f9e5e36e108e2d0f16e779be47c6fe7135134 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 25 Mar 2024 14:34:27 +0100 Subject: [PATCH 071/126] Use Utility::move() instead of std::move(). --- src/Gvas/File.cpp | 10 +++++----- src/Gvas/PropertySerialiser.cpp | 10 +++++----- src/Gvas/Serialisers/ArrayProperty.cpp | 2 +- src/Gvas/Serialisers/MapProperty.cpp | 6 +++--- src/Gvas/Serialisers/SetProperty.cpp | 2 +- src/Gvas/Serialisers/Struct.cpp | 10 +++++----- src/Gvas/Serialisers/TextProperty.cpp | 2 +- src/Gvas/Types/GenericStructProperty.h | 2 +- src/Mass/Mass_Armour.cpp | 2 +- src/Mass/Mass_Frame.cpp | 24 ++++++++++++------------ src/Profile/Profile.cpp | 2 +- src/ProfileManager/ProfileManager.cpp | 4 ++-- src/ToastQueue/ToastQueue.cpp | 2 +- 13 files changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Gvas/File.cpp b/src/Gvas/File.cpp index a4fb2b1..7493f5d 100644 --- a/src/Gvas/File.cpp +++ b/src/Gvas/File.cpp @@ -31,7 +31,7 @@ namespace Gvas { File::File(Containers::String filepath): _propSerialiser{PropertySerialiser::instance()} { - _filepath = std::move(filepath); + _filepath = Utility::move(filepath); loadData(); } @@ -65,9 +65,9 @@ File::saveType() { void File::appendProperty(Types::UnrealPropertyBase::ptr prop) { - auto none_prop = std::move(_properties.back()); - _properties.back() = std::move(prop); - arrayAppend(_properties, std::move(none_prop)); + auto none_prop = Utility::move(_properties.back()); + _properties.back() = Utility::move(prop); + arrayAppend(_properties, Utility::move(none_prop)); } Containers::ArrayView @@ -245,7 +245,7 @@ File::loadData() { Types::UnrealPropertyBase::ptr prop; while((prop = _propSerialiser->read(reader)) != nullptr) { - arrayAppend(_properties, std::move(prop)); + arrayAppend(_properties, Utility::move(prop)); } if(_properties.isEmpty()) { diff --git a/src/Gvas/PropertySerialiser.cpp b/src/Gvas/PropertySerialiser.cpp index 81c590f..c57faad 100644 --- a/src/Gvas/PropertySerialiser.cpp +++ b/src/Gvas/PropertySerialiser.cpp @@ -100,7 +100,7 @@ PropertySerialiser::read(BinaryIo::Reader& reader) { return nullptr; } - return deserialise(std::move(name), std::move(type), value_length, reader); + return deserialise(Utility::move(name), Utility::move(type), value_length, reader); } Types::UnrealPropertyBase::ptr @@ -111,7 +111,7 @@ PropertySerialiser::readItem(BinaryIo::Reader& reader, Containers::String type, return nullptr; } - return deserialise(std::move(name), std::move(type), value_length, reader); + return deserialise(Utility::move(name), Utility::move(type), value_length, reader); } Containers::Array @@ -151,7 +151,7 @@ PropertySerialiser::readSet(BinaryIo::Reader& reader, Containers::StringView ite else { for(std::uint32_t i = 0; i < count; i++) { auto item = readItem(reader, item_type, std::size_t(-1), ""); - arrayAppend(array, std::move(item)); + arrayAppend(array, Utility::move(item)); } } @@ -176,8 +176,8 @@ PropertySerialiser::deserialise(Containers::String name, Containers::String type return nullptr; } - prop->name = std::move(name); - prop->propertyType = std::move(type); + prop->name = Utility::move(name); + prop->propertyType = Utility::move(type); return prop; } diff --git a/src/Gvas/Serialisers/ArrayProperty.cpp b/src/Gvas/Serialisers/ArrayProperty.cpp index a6e2047..0b8a13f 100644 --- a/src/Gvas/Serialisers/ArrayProperty.cpp +++ b/src/Gvas/Serialisers/ArrayProperty.cpp @@ -48,7 +48,7 @@ ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::Stri } auto prop = Containers::pointer(); - prop->itemType = std::move(item_type); + prop->itemType = Utility::move(item_type); prop->items = serialiser.readSet(reader, prop->itemType, item_count); return prop; diff --git a/src/Gvas/Serialisers/MapProperty.cpp b/src/Gvas/Serialisers/MapProperty.cpp index 4fbb216..2925276 100644 --- a/src/Gvas/Serialisers/MapProperty.cpp +++ b/src/Gvas/Serialisers/MapProperty.cpp @@ -83,7 +83,7 @@ MapProperty::deserialiseProperty(Containers::StringView name, Containers::String Types::UnrealPropertyBase::ptr value_item; if(prop->valueType == "StructProperty"_s) { while((value_item = serialiser.read(reader)) != nullptr) { - arrayAppend(pair.values, std::move(value_item)); + arrayAppend(pair.values, Utility::move(value_item)); if(pair.values.back()->name == "None"_s && pair.values.back()->propertyType == "NoneProperty"_s && @@ -98,10 +98,10 @@ MapProperty::deserialiseProperty(Containers::StringView name, Containers::String return nullptr; } - arrayAppend(pair.values, std::move(value_item)); + arrayAppend(pair.values, Utility::move(value_item)); } - arrayAppend(prop->map, std::move(pair)); + arrayAppend(prop->map, Utility::move(pair)); } // End dirty code diff --git a/src/Gvas/Serialisers/SetProperty.cpp b/src/Gvas/Serialisers/SetProperty.cpp index d6ffd4b..dd7220f 100644 --- a/src/Gvas/Serialisers/SetProperty.cpp +++ b/src/Gvas/Serialisers/SetProperty.cpp @@ -52,7 +52,7 @@ SetProperty::deserialiseProperty(Containers::StringView name, Containers::String } auto prop = Containers::pointer(); - prop->itemType = std::move(item_type); + prop->itemType = Utility::move(item_type); prop->items = serialiser.readSet(reader, prop->itemType, item_count); return prop; diff --git a/src/Gvas/Serialisers/Struct.cpp b/src/Gvas/Serialisers/Struct.cpp index e73ac8a..c16cccd 100644 --- a/src/Gvas/Serialisers/Struct.cpp +++ b/src/Gvas/Serialisers/Struct.cpp @@ -60,8 +60,8 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st if(count == 0) { auto prop = Containers::pointer(); - prop->structType = std::move(item_type); - prop->structGuid = std::move(guid); + prop->structType = Utility::move(item_type); + prop->structGuid = guid; } else { for(std::uint32_t i = 0; i < count; i++) { @@ -80,7 +80,7 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st dynamic_cast(prop.get())->structGuid = guid; - arrayAppend(array, std::move(prop)); + arrayAppend(array, Utility::move(prop)); } } @@ -118,7 +118,7 @@ Struct::deserialise(Containers::StringView name, Containers::StringView type, st if(!prop) { prop = readStructValue(name, item_type, value_length, reader, serialiser); if(prop) { - dynamic_cast(prop.get())->structGuid = std::move(guid); + dynamic_cast(prop.get())->structGuid = guid; } } @@ -207,7 +207,7 @@ Struct::readStructValue(Containers::StringView name, Containers::StringView type Types::UnrealPropertyBase::ptr prop; while((prop = serialiser.read(reader)) != nullptr) { - arrayAppend(st_prop->properties, std::move(prop)); + arrayAppend(st_prop->properties, Utility::move(prop)); if(st_prop->properties.back()->name == "None" && st_prop->properties.back()->propertyType == "NoneProperty" && diff --git a/src/Gvas/Serialisers/TextProperty.cpp b/src/Gvas/Serialisers/TextProperty.cpp index 7525958..0d60c11 100644 --- a/src/Gvas/Serialisers/TextProperty.cpp +++ b/src/Gvas/Serialisers/TextProperty.cpp @@ -62,7 +62,7 @@ TextProperty::deserialiseProperty(Containers::StringView name, Containers::Strin return nullptr; } - arrayAppend(prop->data, std::move(str)); + arrayAppend(prop->data, Utility::move(str)); interval = reader.position() - start_position; } while(std::size_t(interval) < value_length); diff --git a/src/Gvas/Types/GenericStructProperty.h b/src/Gvas/Types/GenericStructProperty.h index deea124..67028e9 100644 --- a/src/Gvas/Types/GenericStructProperty.h +++ b/src/Gvas/Types/GenericStructProperty.h @@ -47,7 +47,7 @@ struct GenericStructProperty : public StructProperty { atMove(Containers::StringView name) { for(auto& item : properties) { if(item && item->name == name) { - return Containers::pointerCast(std::move(item)); + return Containers::pointerCast(Utility::move(item)); } } return nullptr; diff --git a/src/Mass/Mass_Armour.cpp b/src/Mass/Mass_Armour.cpp index 8f42da0..34b6f9b 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/Mass/Mass_Armour.cpp @@ -358,7 +358,7 @@ Mass::writeBulletLauncherAttachments() { attach_style_prop->name.emplace(MASS_BL_ATTACHMENT_STYLE); attach_style_prop->enumType = "enuBLAttachmentStyle"_s; Gvas::Types::ByteProperty::ptr prop{attach_style_prop}; - arrayAppend(unit_data->properties, std::move(prop)); + arrayAppend(unit_data->properties, Utility::move(prop)); } auto& attach_style = attach_style_prop->enumValue; diff --git a/src/Mass/Mass_Frame.cpp b/src/Mass/Mass_Frame.cpp index f897ed9..e19f20f 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/Mass/Mass_Frame.cpp @@ -99,7 +99,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_NECK); } length->value = _frame.joints.neck; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_BODY); @@ -109,7 +109,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_BODY); } length->value = _frame.joints.body; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_SHOULDER); @@ -119,7 +119,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_SHOULDER); } length->value = _frame.joints.shoulders; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_ARM_UPPER); @@ -129,7 +129,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_ARM_UPPER); } length->value = _frame.joints.upperArms; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_ARM_LOWER); @@ -139,7 +139,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_ARM_LOWER); } length->value = _frame.joints.lowerArms; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_HIP); @@ -149,7 +149,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_HIP); } length->value = _frame.joints.hips; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_LEG_UPPER); @@ -159,7 +159,7 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_LEG_UPPER); } length->value = _frame.joints.upperLegs; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } length = frame_prop->atMove(MASS_JOINT_LEG_LOWER); @@ -169,14 +169,14 @@ Mass::writeJointSliders() { length->name.emplace(MASS_JOINT_LEG_LOWER); } length->value = _frame.joints.lowerLegs; - arrayAppend(temp, std::move(length)); + arrayAppend(temp, Utility::move(length)); } - arrayAppend(temp, std::move(frame_prop->properties[frame_prop->properties.size() - 3])); - arrayAppend(temp, std::move(frame_prop->properties[frame_prop->properties.size() - 2])); - arrayAppend(temp, std::move(frame_prop->properties[frame_prop->properties.size() - 1])); + arrayAppend(temp, Utility::move(frame_prop->properties[frame_prop->properties.size() - 3])); + arrayAppend(temp, Utility::move(frame_prop->properties[frame_prop->properties.size() - 2])); + arrayAppend(temp, Utility::move(frame_prop->properties[frame_prop->properties.size() - 1])); - frame_prop->properties = std::move(temp); + frame_prop->properties = Utility::move(temp); if(!_mass->saveToFile()) { _lastError = _mass->lastError(); diff --git a/src/Profile/Profile.cpp b/src/Profile/Profile.cpp index d770ffd..cc342e1 100644 --- a/src/Profile/Profile.cpp +++ b/src/Profile/Profile.cpp @@ -285,7 +285,7 @@ Profile::setMaterial(GameData::MaterialID id, std::int32_t amount) { } res_prop->id = id; Gvas::Types::ResourceItemValue::ptr prop{res_prop}; - arrayAppend(mats_prop->items, std::move(prop)); + arrayAppend(mats_prop->items, Utility::move(prop)); } else { res_prop = dynamic_cast(it->get()); diff --git a/src/ProfileManager/ProfileManager.cpp b/src/ProfileManager/ProfileManager.cpp index 53b89c6..e48f7c0 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/ProfileManager/ProfileManager.cpp @@ -87,7 +87,7 @@ ProfileManager::refreshProfiles() { continue; } - arrayAppend(_profiles, std::move(profile)); + arrayAppend(_profiles, Utility::move(profile)); } if(_profiles.isEmpty()) { @@ -298,7 +298,7 @@ ProfileManager::refreshBackups() { arrayAppend(backup.includedFiles, InPlaceInit, zip_get_name(zip, i, ZIP_FL_UNCHANGED)); } - arrayAppend(_backups, std::move(backup)); + arrayAppend(_backups, Utility::move(backup)); } } diff --git a/src/ToastQueue/ToastQueue.cpp b/src/ToastQueue/ToastQueue.cpp index 06d610a..bafc92b 100644 --- a/src/ToastQueue/ToastQueue.cpp +++ b/src/ToastQueue/ToastQueue.cpp @@ -99,7 +99,7 @@ Toast::opacity() { void ToastQueue::addToast(Toast&& toast) { - _toasts.push_back(std::move(toast)); + _toasts.push_back(Utility::move(toast)); } void -- 2.39.5 From 72e71b575a6adffc2b0c82aa86dc79bea6f6dd1a Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 28 Mar 2024 12:23:25 +0100 Subject: [PATCH 072/126] README: mention zlib needs to be installed. It might already be a dependency of other packages installed through the command-line, but better safe than sorry. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef55037..4314677 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ launch `MassBuilderSaveTool-.exe`. 1. Install the 64-bit (`x86_64`) version of [MSYS2](https://www.msys2.org/) in its default path (`C:\msys64`), and update it fully. -2. Run `pacman -S git mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja`. +2. Run `pacman -S git mingw-w64-ucrt-x86_64-toolchain mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-zlib`. 3. In a `URCT64` shell, type `git clone https://github.com/williamjcm/MassBuilderSaveTool`. 4. Type `cd MassBuilderSaveTool && git submodule init && git submodule update && mkdir build && cd build`. 5. Type `cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..` -- 2.39.5 From 0b2796e94b9f3aad1f16cb01903abe907d7bb6da Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 28 Mar 2024 12:50:15 +0100 Subject: [PATCH 073/126] GameData: move headers into a dedicated folder. From now on, Maps will only be for preprocessor-powered multi-directional mapping fuckery. --- src/Application/Application_MainManager.cpp | 4 ++-- src/Application/Application_MassViewer.cpp | 5 +++-- src/Application/Application_MassViewer_Armour.cpp | 5 ++--- src/Application/Application_MassViewer_Frame.cpp | 2 +- src/Application/Application_MassViewer_Weapons.cpp | 4 ++-- src/CMakeLists.txt | 12 ++++++------ src/{Maps => GameData}/Accessories.h | 0 src/{Maps => GameData}/ArmourSets.h | 0 src/{Maps => GameData}/LastMissionId.h | 0 src/{Maps => GameData}/StoryProgress.h | 0 src/{Maps => GameData}/StyleNames.h | 0 src/{Maps => GameData}/WeaponParts.h | 0 12 files changed, 16 insertions(+), 16 deletions(-) rename src/{Maps => GameData}/Accessories.h (100%) rename src/{Maps => GameData}/ArmourSets.h (100%) rename src/{Maps => GameData}/LastMissionId.h (100%) rename src/{Maps => GameData}/StoryProgress.h (100%) rename src/{Maps => GameData}/StyleNames.h (100%) rename src/{Maps => GameData}/WeaponParts.h (100%) diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index a5d56cf..a05770a 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -25,8 +25,8 @@ #include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" -#include "../Maps/LastMissionId.h" -#include "../Maps/StoryProgress.h" +#include "../GameData/LastMissionId.h" +#include "../GameData/StoryProgress.h" #include "Application.h" diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index ad3d288..d17c259 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -21,9 +21,10 @@ #include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" -#include "../Maps/Accessories.h" +#include "../GameData/Accessories.h" #define STYLENAMES_DEFINITION -#include "../Maps/StyleNames.h" +#include "../GameData/StyleNames.h" +#include "../ImportExport/Export.h" #include "Application.h" diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index 21346db..cc323d8 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -15,9 +15,8 @@ // along with this program. If not, see . #include "../FontAwesome/IconsFontAwesome5.h" - -#include "../Maps/ArmourSets.h" -#include "../Maps/StyleNames.h" +#include "../GameData/ArmourSets.h" +#include "../GameData/StyleNames.h" #include "Application.h" diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index 39c2fcb..49d4a71 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -15,7 +15,7 @@ // along with this program. If not, see . #include "../FontAwesome/IconsFontAwesome5.h" -#include "../Maps/StyleNames.h" +#include "../GameData/StyleNames.h" #include "Application.h" diff --git a/src/Application/Application_MassViewer_Weapons.cpp b/src/Application/Application_MassViewer_Weapons.cpp index 96b3c9f..7865a0e 100644 --- a/src/Application/Application_MassViewer_Weapons.cpp +++ b/src/Application/Application_MassViewer_Weapons.cpp @@ -16,8 +16,8 @@ #include "../FontAwesome/IconsFontAwesome5.h" -#include "../Maps/StyleNames.h" -#include "../Maps/WeaponParts.h" +#include "../GameData/StyleNames.h" +#include "../GameData/WeaponParts.h" #include "Application.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ef8f1a7..d7a2d76 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -157,6 +157,12 @@ add_executable(MassBuilderSaveTool Application/Application_UpdateChecker.cpp Configuration/Configuration.h Configuration/Configuration.cpp + GameData/Accessories.h + GameData/ArmourSets.h + GameData/LastMissionId.h + GameData/StoryProgress.h + GameData/StyleNames.h + GameData/WeaponParts.h ProfileManager/ProfileManager.h ProfileManager/ProfileManager.cpp Profile/Profile.h @@ -182,17 +188,11 @@ add_executable(MassBuilderSaveTool Mass/Weapon.h Mass/Weapon.cpp Mass/WeaponPart.h - Maps/Accessories.h - Maps/ArmourSets.h Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherSockets.hpp Maps/DamageTypes.hpp Maps/EffectColourModes.hpp - Maps/LastMissionId.h - Maps/StoryProgress.h - Maps/StyleNames.h - Maps/WeaponParts.h Maps/WeaponTypes.hpp ToastQueue/ToastQueue.h ToastQueue/ToastQueue.cpp diff --git a/src/Maps/Accessories.h b/src/GameData/Accessories.h similarity index 100% rename from src/Maps/Accessories.h rename to src/GameData/Accessories.h diff --git a/src/Maps/ArmourSets.h b/src/GameData/ArmourSets.h similarity index 100% rename from src/Maps/ArmourSets.h rename to src/GameData/ArmourSets.h diff --git a/src/Maps/LastMissionId.h b/src/GameData/LastMissionId.h similarity index 100% rename from src/Maps/LastMissionId.h rename to src/GameData/LastMissionId.h diff --git a/src/Maps/StoryProgress.h b/src/GameData/StoryProgress.h similarity index 100% rename from src/Maps/StoryProgress.h rename to src/GameData/StoryProgress.h diff --git a/src/Maps/StyleNames.h b/src/GameData/StyleNames.h similarity index 100% rename from src/Maps/StyleNames.h rename to src/GameData/StyleNames.h diff --git a/src/Maps/WeaponParts.h b/src/GameData/WeaponParts.h similarity index 100% rename from src/Maps/WeaponParts.h rename to src/GameData/WeaponParts.h -- 2.39.5 From 29b6e579566d7e01d9aa3d245929205514106cb6 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 28 Mar 2024 13:15:47 +0100 Subject: [PATCH 074/126] GameObjects: move files into a dedicated folder. --- src/CMakeLists.txt | 42 +++++++++---------- src/{Profile => GameData}/ResourceIDs.h | 0 src/{Mass => GameObjects}/Accessory.h | 0 src/{Mass => GameObjects}/ArmourPart.h | 0 .../BulletLauncherAttachment.h | 0 src/{Mass => GameObjects}/CustomStyle.h | 0 src/{Mass => GameObjects}/Decal.h | 0 src/{Mass => GameObjects}/Joints.h | 0 src/{Mass => GameObjects}/Mass.cpp | 2 +- src/{Mass => GameObjects}/Mass.h | 0 .../MassPropertyNames.h} | 0 src/{Mass => GameObjects}/Mass_Armour.cpp | 2 +- .../Mass_DecalsAccessories.cpp | 2 +- src/{Mass => GameObjects}/Mass_Frame.cpp | 2 +- src/{Mass => GameObjects}/Mass_Styles.cpp | 2 +- src/{Mass => GameObjects}/Mass_Weapons.cpp | 2 +- src/{Profile => GameObjects}/Profile.cpp | 2 +- src/{Profile => GameObjects}/Profile.h | 3 +- .../ProfilePropertyNames.h} | 0 src/{Mass => GameObjects}/Weapon.cpp | 0 src/{Mass => GameObjects}/Weapon.h | 0 src/{Mass => GameObjects}/WeaponPart.h | 0 src/ImportExport/Export.h | 2 +- src/ImportExport/Import.h | 2 +- src/MassManager/MassManager.h | 2 +- src/ProfileManager/ProfileManager.h | 2 +- 26 files changed, 33 insertions(+), 34 deletions(-) rename src/{Profile => GameData}/ResourceIDs.h (100%) rename src/{Mass => GameObjects}/Accessory.h (100%) rename src/{Mass => GameObjects}/ArmourPart.h (100%) rename src/{Mass => GameObjects}/BulletLauncherAttachment.h (100%) rename src/{Mass => GameObjects}/CustomStyle.h (100%) rename src/{Mass => GameObjects}/Decal.h (100%) rename src/{Mass => GameObjects}/Joints.h (100%) rename src/{Mass => GameObjects}/Mass.cpp (99%) rename src/{Mass => GameObjects}/Mass.h (100%) rename src/{Mass/PropertyNames.h => GameObjects/MassPropertyNames.h} (100%) rename src/{Mass => GameObjects}/Mass_Armour.cpp (99%) rename src/{Mass => GameObjects}/Mass_DecalsAccessories.cpp (99%) rename src/{Mass => GameObjects}/Mass_Frame.cpp (99%) rename src/{Mass => GameObjects}/Mass_Styles.cpp (99%) rename src/{Mass => GameObjects}/Mass_Weapons.cpp (99%) rename src/{Profile => GameObjects}/Profile.cpp (99%) rename src/{Profile => GameObjects}/Profile.h (98%) rename src/{Profile/PropertyNames.h => GameObjects/ProfilePropertyNames.h} (100%) rename src/{Mass => GameObjects}/Weapon.cpp (100%) rename src/{Mass => GameObjects}/Weapon.h (100%) rename src/{Mass => GameObjects}/WeaponPart.h (100%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d7a2d76..f7e6a34 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -160,34 +160,34 @@ add_executable(MassBuilderSaveTool GameData/Accessories.h GameData/ArmourSets.h GameData/LastMissionId.h + GameData/ResourceIDs.h GameData/StoryProgress.h GameData/StyleNames.h GameData/WeaponParts.h + GameObjects/Accessory.h + GameObjects/ArmourPart.h + GameObjects/BulletLauncherAttachment.h + GameObjects/CustomStyle.h + GameObjects/Decal.h + GameObjects/Joints.h + GameObjects/Mass.h + GameObjects/Mass.cpp + GameObjects/Mass_Frame.cpp + GameObjects/Mass_Armour.cpp + GameObjects/Mass_Weapons.cpp + GameObjects/Mass_Styles.cpp + GameObjects/Mass_DecalsAccessories.cpp + GameObjects/MassPropertyNames.h + GameObjects/Profile.h + GameObjects/Profile.cpp + GameObjects/ProfilePropertyNames.h + GameObjects/Weapon.h + GameObjects/Weapon.cpp + GameObjects/WeaponPart.h ProfileManager/ProfileManager.h ProfileManager/ProfileManager.cpp - Profile/Profile.h - Profile/Profile.cpp - Profile/PropertyNames.h - Profile/ResourceIDs.h MassManager/MassManager.h MassManager/MassManager.cpp - Mass/Accessory.h - Mass/ArmourPart.h - Mass/BulletLauncherAttachment.h - Mass/CustomStyle.h - Mass/Decal.h - Mass/Joints.h - Mass/Mass.h - Mass/Mass.cpp - Mass/Mass_Frame.cpp - Mass/Mass_Armour.cpp - Mass/Mass_Weapons.cpp - Mass/Mass_Styles.cpp - Mass/Mass_DecalsAccessories.cpp - Mass/PropertyNames.h - Mass/Weapon.h - Mass/Weapon.cpp - Mass/WeaponPart.h Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherSockets.hpp diff --git a/src/Profile/ResourceIDs.h b/src/GameData/ResourceIDs.h similarity index 100% rename from src/Profile/ResourceIDs.h rename to src/GameData/ResourceIDs.h diff --git a/src/Mass/Accessory.h b/src/GameObjects/Accessory.h similarity index 100% rename from src/Mass/Accessory.h rename to src/GameObjects/Accessory.h diff --git a/src/Mass/ArmourPart.h b/src/GameObjects/ArmourPart.h similarity index 100% rename from src/Mass/ArmourPart.h rename to src/GameObjects/ArmourPart.h diff --git a/src/Mass/BulletLauncherAttachment.h b/src/GameObjects/BulletLauncherAttachment.h similarity index 100% rename from src/Mass/BulletLauncherAttachment.h rename to src/GameObjects/BulletLauncherAttachment.h diff --git a/src/Mass/CustomStyle.h b/src/GameObjects/CustomStyle.h similarity index 100% rename from src/Mass/CustomStyle.h rename to src/GameObjects/CustomStyle.h diff --git a/src/Mass/Decal.h b/src/GameObjects/Decal.h similarity index 100% rename from src/Mass/Decal.h rename to src/GameObjects/Decal.h diff --git a/src/Mass/Joints.h b/src/GameObjects/Joints.h similarity index 100% rename from src/Mass/Joints.h rename to src/GameObjects/Joints.h diff --git a/src/Mass/Mass.cpp b/src/GameObjects/Mass.cpp similarity index 99% rename from src/Mass/Mass.cpp rename to src/GameObjects/Mass.cpp index 9e6f35f..124db44 100644 --- a/src/Mass/Mass.cpp +++ b/src/GameObjects/Mass.cpp @@ -21,7 +21,7 @@ #include #include -#include "PropertyNames.h" +#include "MassPropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/BoolProperty.h" diff --git a/src/Mass/Mass.h b/src/GameObjects/Mass.h similarity index 100% rename from src/Mass/Mass.h rename to src/GameObjects/Mass.h diff --git a/src/Mass/PropertyNames.h b/src/GameObjects/MassPropertyNames.h similarity index 100% rename from src/Mass/PropertyNames.h rename to src/GameObjects/MassPropertyNames.h diff --git a/src/Mass/Mass_Armour.cpp b/src/GameObjects/Mass_Armour.cpp similarity index 99% rename from src/Mass/Mass_Armour.cpp rename to src/GameObjects/Mass_Armour.cpp index 34b6f9b..280f572 100644 --- a/src/Mass/Mass_Armour.cpp +++ b/src/GameObjects/Mass_Armour.cpp @@ -16,7 +16,7 @@ #include -#include "PropertyNames.h" +#include "MassPropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ByteProperty.h" diff --git a/src/Mass/Mass_DecalsAccessories.cpp b/src/GameObjects/Mass_DecalsAccessories.cpp similarity index 99% rename from src/Mass/Mass_DecalsAccessories.cpp rename to src/GameObjects/Mass_DecalsAccessories.cpp index fe68000..320e34c 100644 --- a/src/Mass/Mass_DecalsAccessories.cpp +++ b/src/GameObjects/Mass_DecalsAccessories.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "PropertyNames.h" +#include "MassPropertyNames.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/BoolProperty.h" #include "../Gvas/Types/ColourStructProperty.h" diff --git a/src/Mass/Mass_Frame.cpp b/src/GameObjects/Mass_Frame.cpp similarity index 99% rename from src/Mass/Mass_Frame.cpp rename to src/GameObjects/Mass_Frame.cpp index e19f20f..c3ab3ff 100644 --- a/src/Mass/Mass_Frame.cpp +++ b/src/GameObjects/Mass_Frame.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "PropertyNames.h" +#include "MassPropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ColourStructProperty.h" diff --git a/src/Mass/Mass_Styles.cpp b/src/GameObjects/Mass_Styles.cpp similarity index 99% rename from src/Mass/Mass_Styles.cpp rename to src/GameObjects/Mass_Styles.cpp index daa0c8d..6c08ccb 100644 --- a/src/Mass/Mass_Styles.cpp +++ b/src/GameObjects/Mass_Styles.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "PropertyNames.h" +#include "MassPropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ColourStructProperty.h" diff --git a/src/Mass/Mass_Weapons.cpp b/src/GameObjects/Mass_Weapons.cpp similarity index 99% rename from src/Mass/Mass_Weapons.cpp rename to src/GameObjects/Mass_Weapons.cpp index ef8f975..6a5367c 100644 --- a/src/Mass/Mass_Weapons.cpp +++ b/src/GameObjects/Mass_Weapons.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "PropertyNames.h" +#include "MassPropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/BoolProperty.h" diff --git a/src/Profile/Profile.cpp b/src/GameObjects/Profile.cpp similarity index 99% rename from src/Profile/Profile.cpp rename to src/GameObjects/Profile.cpp index cc342e1..8c0163d 100644 --- a/src/Profile/Profile.cpp +++ b/src/GameObjects/Profile.cpp @@ -19,7 +19,7 @@ #include #include -#include "PropertyNames.h" +#include "ProfilePropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ResourceItemValue.h" diff --git a/src/Profile/Profile.h b/src/GameObjects/Profile.h similarity index 98% rename from src/Profile/Profile.h rename to src/GameObjects/Profile.h index 54d04c2..426d2cc 100644 --- a/src/Profile/Profile.h +++ b/src/GameObjects/Profile.h @@ -21,10 +21,9 @@ #include #include +#include "../GameData/ResourceIDs.h" #include "../Gvas/File.h" -#include "ResourceIDs.h" - using namespace Corrade; namespace mbst { namespace GameObjects { diff --git a/src/Profile/PropertyNames.h b/src/GameObjects/ProfilePropertyNames.h similarity index 100% rename from src/Profile/PropertyNames.h rename to src/GameObjects/ProfilePropertyNames.h diff --git a/src/Mass/Weapon.cpp b/src/GameObjects/Weapon.cpp similarity index 100% rename from src/Mass/Weapon.cpp rename to src/GameObjects/Weapon.cpp diff --git a/src/Mass/Weapon.h b/src/GameObjects/Weapon.h similarity index 100% rename from src/Mass/Weapon.h rename to src/GameObjects/Weapon.h diff --git a/src/Mass/WeaponPart.h b/src/GameObjects/WeaponPart.h similarity index 100% rename from src/Mass/WeaponPart.h rename to src/GameObjects/WeaponPart.h diff --git a/src/ImportExport/Export.h b/src/ImportExport/Export.h index 46c00f8..e869a9f 100644 --- a/src/ImportExport/Export.h +++ b/src/ImportExport/Export.h @@ -18,7 +18,7 @@ #include -#include "../Mass/CustomStyle.h" +#include "../GameObjects/CustomStyle.h" using namespace Corrade; diff --git a/src/ImportExport/Import.h b/src/ImportExport/Import.h index 184ae07..d16990a 100644 --- a/src/ImportExport/Import.h +++ b/src/ImportExport/Import.h @@ -18,7 +18,7 @@ #include -#include "../Mass/CustomStyle.h" +#include "../GameObjects/CustomStyle.h" using namespace Corrade; diff --git a/src/MassManager/MassManager.h b/src/MassManager/MassManager.h index 4b36dcb..71fcf3b 100644 --- a/src/MassManager/MassManager.h +++ b/src/MassManager/MassManager.h @@ -22,7 +22,7 @@ #include #include -#include "../Mass/Mass.h" +#include "../GameObjects/Mass.h" using namespace Corrade; diff --git a/src/ProfileManager/ProfileManager.h b/src/ProfileManager/ProfileManager.h index 99eaab7..b5565c3 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/ProfileManager/ProfileManager.h @@ -23,7 +23,7 @@ #include #include -#include "../Profile/Profile.h" +#include "../GameObjects/Profile.h" using namespace Corrade; -- 2.39.5 From 9d1d0af70a8efb30b3d2193f3b7bce3903ed016d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 28 Mar 2024 13:18:56 +0100 Subject: [PATCH 075/126] GameObjects: merge the two property name headers. --- src/CMakeLists.txt | 3 +-- src/GameObjects/Mass.cpp | 2 +- src/GameObjects/Mass_Armour.cpp | 2 +- src/GameObjects/Mass_DecalsAccessories.cpp | 2 +- src/GameObjects/Mass_Frame.cpp | 2 +- src/GameObjects/Mass_Styles.cpp | 2 +- src/GameObjects/Mass_Weapons.cpp | 2 +- src/GameObjects/Profile.cpp | 2 +- src/GameObjects/ProfilePropertyNames.h | 10 ------- .../{MassPropertyNames.h => PropertyNames.h} | 27 +++++++++++++++++++ 10 files changed, 35 insertions(+), 19 deletions(-) delete mode 100644 src/GameObjects/ProfilePropertyNames.h rename src/GameObjects/{MassPropertyNames.h => PropertyNames.h} (85%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7e6a34..3055025 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -177,10 +177,9 @@ add_executable(MassBuilderSaveTool GameObjects/Mass_Weapons.cpp GameObjects/Mass_Styles.cpp GameObjects/Mass_DecalsAccessories.cpp - GameObjects/MassPropertyNames.h + GameObjects/PropertyNames.h GameObjects/Profile.h GameObjects/Profile.cpp - GameObjects/ProfilePropertyNames.h GameObjects/Weapon.h GameObjects/Weapon.cpp GameObjects/WeaponPart.h diff --git a/src/GameObjects/Mass.cpp b/src/GameObjects/Mass.cpp index 124db44..9e6f35f 100644 --- a/src/GameObjects/Mass.cpp +++ b/src/GameObjects/Mass.cpp @@ -21,7 +21,7 @@ #include #include -#include "MassPropertyNames.h" +#include "PropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/BoolProperty.h" diff --git a/src/GameObjects/Mass_Armour.cpp b/src/GameObjects/Mass_Armour.cpp index 280f572..34b6f9b 100644 --- a/src/GameObjects/Mass_Armour.cpp +++ b/src/GameObjects/Mass_Armour.cpp @@ -16,7 +16,7 @@ #include -#include "MassPropertyNames.h" +#include "PropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ByteProperty.h" diff --git a/src/GameObjects/Mass_DecalsAccessories.cpp b/src/GameObjects/Mass_DecalsAccessories.cpp index 320e34c..fe68000 100644 --- a/src/GameObjects/Mass_DecalsAccessories.cpp +++ b/src/GameObjects/Mass_DecalsAccessories.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "MassPropertyNames.h" +#include "PropertyNames.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/BoolProperty.h" #include "../Gvas/Types/ColourStructProperty.h" diff --git a/src/GameObjects/Mass_Frame.cpp b/src/GameObjects/Mass_Frame.cpp index c3ab3ff..e19f20f 100644 --- a/src/GameObjects/Mass_Frame.cpp +++ b/src/GameObjects/Mass_Frame.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "MassPropertyNames.h" +#include "PropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ColourStructProperty.h" diff --git a/src/GameObjects/Mass_Styles.cpp b/src/GameObjects/Mass_Styles.cpp index 6c08ccb..daa0c8d 100644 --- a/src/GameObjects/Mass_Styles.cpp +++ b/src/GameObjects/Mass_Styles.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "MassPropertyNames.h" +#include "PropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ColourStructProperty.h" diff --git a/src/GameObjects/Mass_Weapons.cpp b/src/GameObjects/Mass_Weapons.cpp index 6a5367c..ef8f975 100644 --- a/src/GameObjects/Mass_Weapons.cpp +++ b/src/GameObjects/Mass_Weapons.cpp @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include "MassPropertyNames.h" +#include "PropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/BoolProperty.h" diff --git a/src/GameObjects/Profile.cpp b/src/GameObjects/Profile.cpp index 8c0163d..cc342e1 100644 --- a/src/GameObjects/Profile.cpp +++ b/src/GameObjects/Profile.cpp @@ -19,7 +19,7 @@ #include #include -#include "ProfilePropertyNames.h" +#include "PropertyNames.h" #include "../Logger/Logger.h" #include "../Gvas/Types/ArrayProperty.h" #include "../Gvas/Types/ResourceItemValue.h" diff --git a/src/GameObjects/ProfilePropertyNames.h b/src/GameObjects/ProfilePropertyNames.h deleted file mode 100644 index 73ebbe3..0000000 --- a/src/GameObjects/ProfilePropertyNames.h +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#define PROFILE_NAME "CompanyName" -#define PROFILE_ACTIVE_FRAME_SLOT "ActiveFrameSlot" -#define PROFILE_CREDITS "Credit" -#define PROFILE_STORY_PROGRESS "StoryProgress" -#define PROFILE_LAST_MISSION_ID "LastMissionID" -#define PROFILE_MATERIAL "ResourceMaterial" -#define PROFILE_QUARK_DATA "ResourceQuarkData" -#define PROFILE_ACCOUNT "Account" diff --git a/src/GameObjects/MassPropertyNames.h b/src/GameObjects/PropertyNames.h similarity index 85% rename from src/GameObjects/MassPropertyNames.h rename to src/GameObjects/PropertyNames.h index 862163b..2d36876 100644 --- a/src/GameObjects/MassPropertyNames.h +++ b/src/GameObjects/PropertyNames.h @@ -1,5 +1,32 @@ #pragma once +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +// Profile stuff +#define PROFILE_NAME "CompanyName" +#define PROFILE_ACTIVE_FRAME_SLOT "ActiveFrameSlot" +#define PROFILE_CREDITS "Credit" +#define PROFILE_STORY_PROGRESS "StoryProgress" +#define PROFILE_LAST_MISSION_ID "LastMissionID" +#define PROFILE_MATERIAL "ResourceMaterial" +#define PROFILE_QUARK_DATA "ResourceQuarkData" +#define PROFILE_ACCOUNT "Account" + +// Basic MASS stuff #define MASS_UNIT_DATA "UnitData" #define MASS_NAME "Name_45_A037C5D54E53456407BDF091344529BB" #define MASS_ACCOUNT "Account" -- 2.39.5 From 04d2ab9dc7c5e42daa56c56dbe4165d81a181942 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 28 Mar 2024 13:32:34 +0100 Subject: [PATCH 076/126] {Mass,Profile}Manager: move into new namespace. --- src/Application/Application.h | 12 ++++---- src/CMakeLists.txt | 8 ++--- .../MassManager.cpp => Managers/Mass.cpp} | 30 +++++++++---------- .../MassManager.h => Managers/Mass.h} | 8 ++--- .../Profile.cpp} | 30 +++++++++---------- .../ProfileManager.h => Managers/Profile.h} | 8 ++--- 6 files changed, 48 insertions(+), 48 deletions(-) rename src/{MassManager/MassManager.cpp => Managers/Mass.cpp} (91%) rename src/{MassManager/MassManager.h => Managers/Mass.h} (91%) rename src/{ProfileManager/ProfileManager.cpp => Managers/Profile.cpp} (94%) rename src/{ProfileManager/ProfileManager.h => Managers/Profile.h} (93%) diff --git a/src/Application/Application.h b/src/Application/Application.h index 1c22d37..9b0b247 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -38,8 +38,8 @@ #include -#include "../ProfileManager/ProfileManager.h" -#include "../MassManager/MassManager.h" +#include "../Managers/Mass.h" +#include "../Managers/Profile.h" #include "../ToastQueue/ToastQueue.h" #include "../UpdateChecker/UpdateChecker.h" @@ -236,11 +236,11 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe SDL_TimerID _gameCheckTimerId = 0; - Containers::Pointer _profileManager; - GameObjects::Profile* _currentProfile = nullptr; + Containers::Pointer _profileManager; + GameObjects::Profile* _currentProfile = nullptr; - Containers::Pointer _massManager; - GameObjects::Mass* _currentMass = nullptr; + Containers::Pointer _massManager; + GameObjects::Mass* _currentMass = nullptr; GameObjects::Weapon* _currentWeapon = nullptr; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3055025..d4310bd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -183,10 +183,10 @@ add_executable(MassBuilderSaveTool GameObjects/Weapon.h GameObjects/Weapon.cpp GameObjects/WeaponPart.h - ProfileManager/ProfileManager.h - ProfileManager/ProfileManager.cpp - MassManager/MassManager.h - MassManager/MassManager.cpp + Managers/Mass.h + Managers/Mass.cpp + Managers/Profile.h + Managers/Profile.cpp Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherSockets.hpp diff --git a/src/MassManager/MassManager.cpp b/src/Managers/Mass.cpp similarity index 91% rename from src/MassManager/MassManager.cpp rename to src/Managers/Mass.cpp index fb3a84a..62e263e 100644 --- a/src/MassManager/MassManager.cpp +++ b/src/Managers/Mass.cpp @@ -21,13 +21,13 @@ #include "../Logger/Logger.h" -#include "MassManager.h" +#include "Mass.h" using namespace Containers::Literals; -namespace mbst { +namespace mbst { namespace Managers { -MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, +Mass::Mass(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir): _saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir} { @@ -42,17 +42,17 @@ MassManager::MassManager(Containers::StringView save_path, Containers::StringVie } Containers::StringView -MassManager::lastError() { +Mass::lastError() { return _lastError; } GameObjects::Mass& -MassManager::hangar(std::int32_t hangar) { +Mass::hangar(std::int32_t hangar) { return _hangars[hangar]; } void -MassManager::refreshHangar(std::int32_t hangar) { +Mass::refreshHangar(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -66,7 +66,7 @@ MassManager::refreshHangar(std::int32_t hangar) { } bool -MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { +Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -109,7 +109,7 @@ MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { } bool -MassManager::exportMass(std::int32_t hangar) { +Mass::exportMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -136,7 +136,7 @@ MassManager::exportMass(std::int32_t hangar) { } bool -MassManager::moveMass(std::int32_t source, std::int32_t destination) { +Mass::moveMass(std::int32_t source, std::int32_t destination) { if(source < 0 || source >= 32) { _lastError = "Source hangar index out of range."_s; LOG_ERROR(_lastError); @@ -174,7 +174,7 @@ MassManager::moveMass(std::int32_t source, std::int32_t destination) { } bool -MassManager::deleteMass(std::int32_t hangar) { +Mass::deleteMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -191,12 +191,12 @@ MassManager::deleteMass(std::int32_t hangar) { } const std::map& -MassManager::stagedMasses() { +Mass::stagedMasses() { return _stagedMasses; } void -MassManager::refreshStagedMasses() { +Mass::refreshStagedMasses() { _stagedMasses.clear(); using Utility::Path::ListFlag; @@ -229,7 +229,7 @@ MassManager::refreshStagedMasses() { } void -MassManager::refreshStagedMass(Containers::StringView filename) { +Mass::refreshStagedMass(Containers::StringView filename) { LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename)); @@ -250,7 +250,7 @@ MassManager::refreshStagedMass(Containers::StringView filename) { } bool -MassManager::deleteStagedMass(Containers::StringView filename) { +Mass::deleteStagedMass(Containers::StringView filename) { if(_stagedMasses.find(filename) == _stagedMasses.cend()) { _lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s; LOG_ERROR(_lastError); @@ -266,4 +266,4 @@ MassManager::deleteStagedMass(Containers::StringView filename) { return true; } -} +}} diff --git a/src/MassManager/MassManager.h b/src/Managers/Mass.h similarity index 91% rename from src/MassManager/MassManager.h rename to src/Managers/Mass.h index 71fcf3b..62db95b 100644 --- a/src/MassManager/MassManager.h +++ b/src/Managers/Mass.h @@ -26,11 +26,11 @@ using namespace Corrade; -namespace mbst { +namespace mbst { namespace Managers { -class MassManager { +class Mass { public: - MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); + Mass(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); auto lastError() -> Containers::StringView; @@ -63,4 +63,4 @@ class MassManager { std::map _stagedMasses; }; -} +}} diff --git a/src/ProfileManager/ProfileManager.cpp b/src/Managers/Profile.cpp similarity index 94% rename from src/ProfileManager/ProfileManager.cpp rename to src/Managers/Profile.cpp index e48f7c0..893d3c3 100644 --- a/src/ProfileManager/ProfileManager.cpp +++ b/src/Managers/Profile.cpp @@ -29,13 +29,13 @@ #include "../Logger/Logger.h" -#include "ProfileManager.h" +#include "Profile.h" using namespace Containers::Literals; -namespace mbst { +namespace mbst { namespace Managers { -ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir): +Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_dir): _saveDirectory{save_dir}, _backupsDirectory{backup_dir} { @@ -43,22 +43,22 @@ ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::Stri } bool -ProfileManager::ready() const { +Profile::ready() const { return _ready; } Containers::StringView -ProfileManager::lastError() { +Profile::lastError() { return _lastError; } Containers::ArrayView -ProfileManager::profiles() { +Profile::profiles() { return _profiles; } bool -ProfileManager::refreshProfiles() { +Profile::refreshProfiles() { LOG_INFO("Refreshing profiles."); _profiles = Containers::Array{}; @@ -100,12 +100,12 @@ ProfileManager::refreshProfiles() { } GameObjects::Profile* -ProfileManager::getProfile(std::size_t index) { +Profile::getProfile(std::size_t index) { return index <= _profiles.size() ? &(_profiles[index]) : nullptr; } bool -ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { +Profile::deleteProfile(std::size_t index, bool delete_builds) { if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) { _lastError = Utility::format("Couldn't delete {} (filename: {}).", _profiles[index].companyName(), @@ -136,7 +136,7 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { } bool -ProfileManager::backupProfile(std::size_t index, bool backup_builds) { +Profile::backupProfile(std::size_t index, bool backup_builds) { std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm* time = std::localtime(×tamp); auto& profile = _profiles[index]; @@ -213,12 +213,12 @@ ProfileManager::backupProfile(std::size_t index, bool backup_builds) { } Containers::ArrayView -ProfileManager::backups() { +Profile::backups() { return _backups; } void -ProfileManager::refreshBackups() { +Profile::refreshBackups() { _backups = Containers::Array{}; using Utility::Path::ListFlag; @@ -303,7 +303,7 @@ ProfileManager::refreshBackups() { } bool -ProfileManager::deleteBackup(std::size_t index) { +Profile::deleteBackup(std::size_t index) { if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) { _lastError = "Couldn't delete " + _backups[index].filename; LOG_ERROR(_lastError); @@ -321,7 +321,7 @@ ProfileManager::deleteBackup(std::size_t index) { } bool -ProfileManager::restoreBackup(std::size_t index) { +Profile::restoreBackup(std::size_t index) { const Backup& backup = _backups[index]; auto error_format = "Extraction of file {} failed: {}"_s; @@ -380,4 +380,4 @@ ProfileManager::restoreBackup(std::size_t index) { return true; } -} +}} diff --git a/src/ProfileManager/ProfileManager.h b/src/Managers/Profile.h similarity index 93% rename from src/ProfileManager/ProfileManager.h rename to src/Managers/Profile.h index b5565c3..8c2474b 100644 --- a/src/ProfileManager/ProfileManager.h +++ b/src/Managers/Profile.h @@ -27,7 +27,7 @@ using namespace Corrade; -namespace mbst { +namespace mbst { namespace Managers { struct Backup { Containers::String filename; @@ -44,9 +44,9 @@ struct Backup { Containers::Array includedFiles; }; -class ProfileManager { +class Profile { public: - explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir); + explicit Profile(Containers::StringView save_dir, Containers::StringView backup_dir); auto ready() const -> bool; auto lastError() -> Containers::StringView; @@ -75,4 +75,4 @@ class ProfileManager { Containers::Array _backups; }; -} +}} -- 2.39.5 From 8a809b77523111e60b97c7aa72ef1fdce7aac21c Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 28 Mar 2024 17:42:56 +0100 Subject: [PATCH 077/126] CMakeLists: reorder some files. --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d4310bd..3197799 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -157,6 +157,8 @@ add_executable(MassBuilderSaveTool Application/Application_UpdateChecker.cpp Configuration/Configuration.h Configuration/Configuration.cpp + FontAwesome/IconsFontAwesome5.h + FontAwesome/IconsFontAwesome5Brands.h GameData/Accessories.h GameData/ArmourSets.h GameData/LastMissionId.h @@ -177,9 +179,9 @@ add_executable(MassBuilderSaveTool GameObjects/Mass_Weapons.cpp GameObjects/Mass_Styles.cpp GameObjects/Mass_DecalsAccessories.cpp - GameObjects/PropertyNames.h GameObjects/Profile.h GameObjects/Profile.cpp + GameObjects/PropertyNames.h GameObjects/Weapon.h GameObjects/Weapon.cpp GameObjects/WeaponPart.h @@ -201,8 +203,6 @@ add_executable(MassBuilderSaveTool Utilities/Crc32.cpp Version/Version.h Version/Version.cpp - FontAwesome/IconsFontAwesome5.h - FontAwesome/IconsFontAwesome5Brands.h ${Logger_SOURCES} ${BinaryIo_SOURCES} ${Gvas_SOURCES} -- 2.39.5 From 9f0386d5b3b6caceb46f1f030cc485ed28fa55a1 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 30 Mar 2024 16:03:11 +0100 Subject: [PATCH 078/126] {Mass,Profile}Manager: rename classes. Partial revert of 04d2ab9dc7c5e42daa56c56dbe4165d81a181942. I forgot about the Backup struct when I was working on the backup manager, and was about to run into a conflict sooner or later. --- src/Application/Application.h | 12 ++++----- src/CMakeLists.txt | 8 +++--- src/Managers/{Mass.cpp => MassManager.cpp} | 26 +++++++++---------- src/Managers/{Mass.h => MassManager.h} | 4 +-- .../{Profile.cpp => ProfileManager.cpp} | 26 +++++++++---------- src/Managers/{Profile.h => ProfileManager.h} | 4 +-- 6 files changed, 40 insertions(+), 40 deletions(-) rename src/Managers/{Mass.cpp => MassManager.cpp} (91%) rename src/Managers/{Mass.h => MassManager.h} (92%) rename src/Managers/{Profile.cpp => ProfileManager.cpp} (95%) rename src/Managers/{Profile.h => ProfileManager.h} (94%) diff --git a/src/Application/Application.h b/src/Application/Application.h index 9b0b247..f9dc920 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -38,8 +38,8 @@ #include -#include "../Managers/Mass.h" -#include "../Managers/Profile.h" +#include "../Managers/MassManager.h" +#include "../Managers/ProfileManager.h" #include "../ToastQueue/ToastQueue.h" #include "../UpdateChecker/UpdateChecker.h" @@ -236,11 +236,11 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe SDL_TimerID _gameCheckTimerId = 0; - Containers::Pointer _profileManager; - GameObjects::Profile* _currentProfile = nullptr; + Containers::Pointer _profileManager; + GameObjects::Profile* _currentProfile = nullptr; - Containers::Pointer _massManager; - GameObjects::Mass* _currentMass = nullptr; + Containers::Pointer _massManager; + GameObjects::Mass* _currentMass = nullptr; GameObjects::Weapon* _currentWeapon = nullptr; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3197799..5bdf541 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -185,10 +185,10 @@ add_executable(MassBuilderSaveTool GameObjects/Weapon.h GameObjects/Weapon.cpp GameObjects/WeaponPart.h - Managers/Mass.h - Managers/Mass.cpp - Managers/Profile.h - Managers/Profile.cpp + Managers/MassManager.h + Managers/MassManager.cpp + Managers/ProfileManager.h + Managers/ProfileManager.cpp Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherSockets.hpp diff --git a/src/Managers/Mass.cpp b/src/Managers/MassManager.cpp similarity index 91% rename from src/Managers/Mass.cpp rename to src/Managers/MassManager.cpp index 62e263e..1947711 100644 --- a/src/Managers/Mass.cpp +++ b/src/Managers/MassManager.cpp @@ -21,13 +21,13 @@ #include "../Logger/Logger.h" -#include "Mass.h" +#include "MassManager.h" using namespace Containers::Literals; namespace mbst { namespace Managers { -Mass::Mass(Containers::StringView save_path, Containers::StringView account, bool demo, +MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir): _saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir} { @@ -42,17 +42,17 @@ Mass::Mass(Containers::StringView save_path, Containers::StringView account, boo } Containers::StringView -Mass::lastError() { +MassManager::lastError() { return _lastError; } GameObjects::Mass& -Mass::hangar(std::int32_t hangar) { +MassManager::hangar(std::int32_t hangar) { return _hangars[hangar]; } void -Mass::refreshHangar(std::int32_t hangar) { +MassManager::refreshHangar(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -66,7 +66,7 @@ Mass::refreshHangar(std::int32_t hangar) { } bool -Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) { +MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."; LOG_ERROR(_lastError); @@ -109,7 +109,7 @@ Mass::importMass(Containers::StringView staged_fn, std::int32_t hangar) { } bool -Mass::exportMass(std::int32_t hangar) { +MassManager::exportMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -136,7 +136,7 @@ Mass::exportMass(std::int32_t hangar) { } bool -Mass::moveMass(std::int32_t source, std::int32_t destination) { +MassManager::moveMass(std::int32_t source, std::int32_t destination) { if(source < 0 || source >= 32) { _lastError = "Source hangar index out of range."_s; LOG_ERROR(_lastError); @@ -174,7 +174,7 @@ Mass::moveMass(std::int32_t source, std::int32_t destination) { } bool -Mass::deleteMass(std::int32_t hangar) { +MassManager::deleteMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { _lastError = "Hangar index out of range."_s; LOG_ERROR(_lastError); @@ -191,12 +191,12 @@ Mass::deleteMass(std::int32_t hangar) { } const std::map& -Mass::stagedMasses() { +MassManager::stagedMasses() { return _stagedMasses; } void -Mass::refreshStagedMasses() { +MassManager::refreshStagedMasses() { _stagedMasses.clear(); using Utility::Path::ListFlag; @@ -229,7 +229,7 @@ Mass::refreshStagedMasses() { } void -Mass::refreshStagedMass(Containers::StringView filename) { +MassManager::refreshStagedMass(Containers::StringView filename) { LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename)); @@ -250,7 +250,7 @@ Mass::refreshStagedMass(Containers::StringView filename) { } bool -Mass::deleteStagedMass(Containers::StringView filename) { +MassManager::deleteStagedMass(Containers::StringView filename) { if(_stagedMasses.find(filename) == _stagedMasses.cend()) { _lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s; LOG_ERROR(_lastError); diff --git a/src/Managers/Mass.h b/src/Managers/MassManager.h similarity index 92% rename from src/Managers/Mass.h rename to src/Managers/MassManager.h index 62db95b..7ebf8f8 100644 --- a/src/Managers/Mass.h +++ b/src/Managers/MassManager.h @@ -28,9 +28,9 @@ using namespace Corrade; namespace mbst { namespace Managers { -class Mass { +class MassManager { public: - Mass(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); + MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); auto lastError() -> Containers::StringView; diff --git a/src/Managers/Profile.cpp b/src/Managers/ProfileManager.cpp similarity index 95% rename from src/Managers/Profile.cpp rename to src/Managers/ProfileManager.cpp index 893d3c3..2786e85 100644 --- a/src/Managers/Profile.cpp +++ b/src/Managers/ProfileManager.cpp @@ -29,13 +29,13 @@ #include "../Logger/Logger.h" -#include "Profile.h" +#include "ProfileManager.h" using namespace Containers::Literals; namespace mbst { namespace Managers { -Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_dir): +ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir): _saveDirectory{save_dir}, _backupsDirectory{backup_dir} { @@ -43,22 +43,22 @@ Profile::Profile(Containers::StringView save_dir, Containers::StringView backup_ } bool -Profile::ready() const { +ProfileManager::ready() const { return _ready; } Containers::StringView -Profile::lastError() { +ProfileManager::lastError() { return _lastError; } Containers::ArrayView -Profile::profiles() { +ProfileManager::profiles() { return _profiles; } bool -Profile::refreshProfiles() { +ProfileManager::refreshProfiles() { LOG_INFO("Refreshing profiles."); _profiles = Containers::Array{}; @@ -100,12 +100,12 @@ Profile::refreshProfiles() { } GameObjects::Profile* -Profile::getProfile(std::size_t index) { +ProfileManager::getProfile(std::size_t index) { return index <= _profiles.size() ? &(_profiles[index]) : nullptr; } bool -Profile::deleteProfile(std::size_t index, bool delete_builds) { +ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) { _lastError = Utility::format("Couldn't delete {} (filename: {}).", _profiles[index].companyName(), @@ -136,7 +136,7 @@ Profile::deleteProfile(std::size_t index, bool delete_builds) { } bool -Profile::backupProfile(std::size_t index, bool backup_builds) { +ProfileManager::backupProfile(std::size_t index, bool backup_builds) { std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); std::tm* time = std::localtime(×tamp); auto& profile = _profiles[index]; @@ -213,12 +213,12 @@ Profile::backupProfile(std::size_t index, bool backup_builds) { } Containers::ArrayView -Profile::backups() { +ProfileManager::backups() { return _backups; } void -Profile::refreshBackups() { +ProfileManager::refreshBackups() { _backups = Containers::Array{}; using Utility::Path::ListFlag; @@ -303,7 +303,7 @@ Profile::refreshBackups() { } bool -Profile::deleteBackup(std::size_t index) { +ProfileManager::deleteBackup(std::size_t index) { if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) { _lastError = "Couldn't delete " + _backups[index].filename; LOG_ERROR(_lastError); @@ -321,7 +321,7 @@ Profile::deleteBackup(std::size_t index) { } bool -Profile::restoreBackup(std::size_t index) { +ProfileManager::restoreBackup(std::size_t index) { const Backup& backup = _backups[index]; auto error_format = "Extraction of file {} failed: {}"_s; diff --git a/src/Managers/Profile.h b/src/Managers/ProfileManager.h similarity index 94% rename from src/Managers/Profile.h rename to src/Managers/ProfileManager.h index 8c2474b..d1bbb7e 100644 --- a/src/Managers/Profile.h +++ b/src/Managers/ProfileManager.h @@ -44,9 +44,9 @@ struct Backup { Containers::Array includedFiles; }; -class Profile { +class ProfileManager { public: - explicit Profile(Containers::StringView save_dir, Containers::StringView backup_dir); + explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir); auto ready() const -> bool; auto lastError() -> Containers::StringView; -- 2.39.5 From bf5a9872e1086d899686b760386585eb0e0c8d93 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 30 Mar 2024 16:07:24 +0100 Subject: [PATCH 079/126] Application: remove a default value. This'll stop Clang-Tidy's complaining that "default values in virtual/override methods are prohibited". Dunno how prohibited they are, but better safe than sorry, even though there was no compile error/warning. --- src/Application/Application.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index f9dc920..0127256 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -63,7 +63,7 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe const std::string& dir, const std::string& filename, efsw::Action action, - std::string old_filename = "") override; + std::string old_filename) override; private: // Events -- 2.39.5 From 12995367eb18afb4b082a5c6bf811dddb0875709 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 30 Mar 2024 17:06:04 +0100 Subject: [PATCH 080/126] Logger: remove an unnecessary include. --- src/Logger/Logger.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Logger/Logger.h b/src/Logger/Logger.h index e75dbfe..f395c2d 100644 --- a/src/Logger/Logger.h +++ b/src/Logger/Logger.h @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include - #ifndef SAVETOOL_DEBUG_BUILD #include #endif -- 2.39.5 From 8ecd1922f17440188385b0e5e15683a14ccc0e6c Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 30 Mar 2024 23:47:04 +0100 Subject: [PATCH 081/126] Utilities: add temp file management functions. --- src/CMakeLists.txt | 2 + src/Configuration/Configuration.cpp | 13 +++++ src/Configuration/Configuration.h | 1 + src/Utilities/Temp.cpp | 88 +++++++++++++++++++++++++++++ src/Utilities/Temp.h | 34 +++++++++++ 5 files changed, 138 insertions(+) create mode 100644 src/Utilities/Temp.cpp create mode 100644 src/Utilities/Temp.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5bdf541..9d60695 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -201,6 +201,8 @@ add_executable(MassBuilderSaveTool UpdateChecker/UpdateChecker.cpp Utilities/Crc32.h Utilities/Crc32.cpp + Utilities/Temp.h + Utilities/Temp.cpp Version/Version.h Version/Version.cpp ${Logger_SOURCES} diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index 62a6a62..01d256b 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -25,6 +25,7 @@ #include #include "../Logger/Logger.h" +#include "../Utilities/Temp.h" #include "Configuration.h" @@ -123,6 +124,7 @@ Configuration::Configuration() { _directories.armours = Utility::Path::join(armoury_dir, "armours"); _directories.weapons = Utility::Path::join(armoury_dir, "weapons"); _directories.styles = Utility::Path::join(armoury_dir, "styles"); + _directories.temp = Utility::Path::join(executable_location, "temp"); if(!Utility::Path::exists(_directories.backups)) { LOG_WARNING("Backups directory not found, creating..."); @@ -160,6 +162,17 @@ Configuration::Configuration() { } } + if(!Utility::Path::exists(_directories.temp)) { + LOG_WARNING("Temporary directory not found, creating..."); + if(!Utility::Path::make(_directories.temp)) { + LOG_ERROR(_lastError = "Couldn't create the temporary directory."); + return; + } + } + else { + Utilities::emptyTempDir(); + } + _valid = true; } diff --git a/src/Configuration/Configuration.h b/src/Configuration/Configuration.h index febea45..79ec469 100644 --- a/src/Configuration/Configuration.h +++ b/src/Configuration/Configuration.h @@ -64,6 +64,7 @@ class Configuration { Containers::String armours; Containers::String weapons; Containers::String styles; + Containers::String temp; }; auto directories() const -> Directories const&; diff --git a/src/Utilities/Temp.cpp b/src/Utilities/Temp.cpp new file mode 100644 index 0000000..0a3900f --- /dev/null +++ b/src/Utilities/Temp.cpp @@ -0,0 +1,88 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include + +#include "../Configuration/Configuration.h" +#include "../Logger/Logger.h" + +#include "Temp.h" + +namespace mbst { namespace Utilities { + +Containers::String +getTempPath(Containers::StringView filename) { + return Utility::Path::join(conf().directories().temp, filename); +} + +Containers::Optional +copyToTemp(Containers::StringView path) { + auto filename = Utility::Path::split(path).first(); + auto dest = Utility::Path::join(conf().directories().temp, filename); + + if(!Utility::Path::copy(path, dest)) { + LOG_ERROR_FORMAT("Couldn't copy {} to {}.", path, conf().directories().temp); + return Containers::NullOpt; + } + + return Utility::move(dest); +} + +Containers::Optional +moveToTemp(Containers::StringView path) { + auto filename = Utility::Path::split(path).first(); + auto dest = Utility::Path::join(conf().directories().temp, filename); + + if(!Utility::Path::move(path, dest)) { + LOG_ERROR_FORMAT("Couldn't move {} to {}.", path, conf().directories().temp); + return Containers::NullOpt; + } + + return Utility::move(dest); +} + +bool +moveFromTemp(Containers::StringView filename, Containers::StringView destination) { + auto source = Utility::Path::join(conf().directories().temp, filename); + auto dest = Utility::Path::join(destination, filename); + + if(!Utility::Path::move(source, dest)) { + LOG_ERROR_FORMAT("Couldn't move {} to {}.", filename, destination); + return false; + } + + return true; +} + +bool +deleteTempFile(Containers::StringView filename) { + return Utility::Path::remove(Utility::Path::join(conf().directories().temp, filename)); +} + +void +emptyTempDir() { + using Flag = Utility::Path::ListFlag; + auto files = Utility::Path::list(conf().directories().temp, Flag::SkipDirectories|Flag::SkipSpecial); + CORRADE_INTERNAL_ASSERT(files); + + for(auto& filename : *files) { + deleteTempFile(filename); + } +} + +}} diff --git a/src/Utilities/Temp.h b/src/Utilities/Temp.h new file mode 100644 index 0000000..b7e13ba --- /dev/null +++ b/src/Utilities/Temp.h @@ -0,0 +1,34 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include + +using namespace Corrade; + +namespace mbst { namespace Utilities { + +auto getTempPath(Containers::StringView filename) -> Containers::String; +auto copyToTemp(Containers::StringView path) -> Containers::Optional; +auto moveToTemp(Containers::StringView path) -> Containers::Optional; +bool moveFromTemp(Containers::StringView filename, Containers::StringView destination); +bool deleteTempFile(Containers::StringView filename); +void emptyTempDir(); + +}} -- 2.39.5 From 1db00ba89225e438de274ad7b384b8e8fed52d30 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 15:10:52 +0200 Subject: [PATCH 082/126] Logger: add a missing string view operator. --- src/Logger/Logger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index b3d9f03..db00e7d 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -85,7 +85,7 @@ Logger::log(EntryType type, StringView location, StringView message) { break; } - d << "["_s << Debug::nospace << location << Debug::nospace << "]"; + d << "["_s << Debug::nospace << location << Debug::nospace << "]"_s; for(auto i = 0u; i < _indentLevel; i++) { d << Debug::nospace << " "_s << Debug::nospace; -- 2.39.5 From c48165614a7fc4fec55ac8c3b292e80322a2b623 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 15:11:33 +0200 Subject: [PATCH 083/126] CMakeLists: remove an unnecessary option. Logger doesn't output coloured text to the console anymore. As a result, we don't need to tell Corrade to use ANSI colour codes on Windows anymore. --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 282abff..f7e0419 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,6 @@ if(NOT SAVETOOL_USE_SYSTEM_LIBS) set(CORRADE_WITH_PLUGINMANAGER OFF CACHE BOOL "" FORCE) set(CORRADE_WITH_TESTSUITE OFF CACHE BOOL "" FORCE) set(CORRADE_WITH_MAIN ON CACHE BOOL "" FORCE) - set(CORRADE_UTILITY_USE_ANSI_COLORS ON CACHE BOOL "" FORCE) add_subdirectory(third-party/corrade EXCLUDE_FROM_ALL) set(DIRECTX OFF CACHE BOOL "" FORCE) # We use OpenGL. -- 2.39.5 From 3ffac15c26c927dcd4a10b4707db7c82dfd56868 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 15:20:03 +0200 Subject: [PATCH 084/126] CMakeLists: add new common variable for dependencies. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f7e0419..51c3e72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ option(SAVETOOL_USE_SYSTEM_LIBS "Use system-wide versions of the dependencies in if(NOT SAVETOOL_USE_SYSTEM_LIBS) # Generic variables shared by multiple libs that don't provide their own. set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) + set(BUILD_STATIC_LIBS ON CACHE BOOL "" FORCE) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) -- 2.39.5 From 35c96af5093d938a48717a2748968587d0d5acb7 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 15:20:47 +0200 Subject: [PATCH 085/126] CMakeLists: reorder lines for consistency. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d60695..970fcfb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,9 +27,9 @@ endif() find_package(Magnum REQUIRED GL Sdl2Application) find_package(MagnumIntegration REQUIRED ImGui) if(SAVETOOL_USE_SYSTEM_LIBS) - find_package(CURL REQUIRED HTTPS) find_package(libzip REQUIRED) find_package(efsw REQUIRED) + find_package(CURL REQUIRED HTTPS) endif() set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) -- 2.39.5 From bd360b926825b81b69e561e5e8a9f2e60c31a483 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 15:40:45 +0200 Subject: [PATCH 086/126] CMakeLists: reorganise how system deps are handled. Allowing each dependency to be system-wide or not is gonna be an improvement, especially when it comes to IDE memory usage. --- CMakeLists.txt | 41 +++++++++++++++++++++++++++++------------ src/CMakeLists.txt | 23 ++++++++++++++++++----- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51c3e72..c260e84 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,23 +23,21 @@ set(ZLIB_USE_STATIC_LIBS ON CACHE BOOL "" FORCE) # Required on setups where zlib option(SAVETOOL_USE_SYSTEM_LIBS "Use system-wide versions of the dependencies instead of the versions provided by submodules." OFF) +include(CMakeDependentOption) +cmake_dependent_option(SAVETOOL_USE_SYSTEM_CORRADE_MAGNUM "Use system-wide versions of Corrade and Magnum." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) +cmake_dependent_option(SAVETOOL_USE_SYSTEM_SDL2 "Use a system-wide version of SDL2." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) +cmake_dependent_option(SAVETOOL_USE_SYSTEM_LIBZIP "Use a system-wide version of libzip." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) +cmake_dependent_option(SAVETOOL_USE_SYSTEM_EFSW "Use a system-wide version of EFSW." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) +cmake_dependent_option(SAVETOOL_USE_SYSTEM_LIBCURL "Use a system-wide version of libcurl." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) + if(NOT SAVETOOL_USE_SYSTEM_LIBS) # Generic variables shared by multiple libs that don't provide their own. set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(BUILD_STATIC_LIBS ON CACHE BOOL "" FORCE) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) +endif(NOT SAVETOOL_USE_SYSTEM_LIBS) - set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) - set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE) - set(CORRADE_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) - set(CORRADE_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE) - set(CORRADE_BUILD_TESTS OFF CACHE BOOL "" FORCE) - set(CORRADE_WITH_INTERCONNECT OFF CACHE BOOL "" FORCE) - set(CORRADE_WITH_PLUGINMANAGER OFF CACHE BOOL "" FORCE) - set(CORRADE_WITH_TESTSUITE OFF CACHE BOOL "" FORCE) - set(CORRADE_WITH_MAIN ON CACHE BOOL "" FORCE) - add_subdirectory(third-party/corrade EXCLUDE_FROM_ALL) - +if(NOT SAVETOOL_USE_SYSTEM_SDL2) set(DIRECTX OFF CACHE BOOL "" FORCE) # We use OpenGL. set(SDL_ATOMIC OFF CACHE BOOL "" FORCE) set(SDL_CPUINFO OFF CACHE BOOL "" FORCE) @@ -55,6 +53,19 @@ if(NOT SAVETOOL_USE_SYSTEM_LIBS) set(SDL_TIMERS ON CACHE BOOL "" FORCE) set(SDL_SHARED OFF CACHE BOOL "" FORCE) add_subdirectory(third-party/SDL EXCLUDE_FROM_ALL) +endif(NOT SAVETOOL_USE_SYSTEM_SDL2) + +if(NOT SAVETOOL_USE_SYSTEM_CORRADE_MAGNUM) + set(CORRADE_BUILD_DEPRECATED OFF CACHE BOOL "" FORCE) + set(CORRADE_BUILD_STATIC ON CACHE BOOL "" FORCE) + set(CORRADE_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) + set(CORRADE_BUILD_STATIC_UNIQUE_GLOBALS OFF CACHE BOOL "" FORCE) + set(CORRADE_BUILD_TESTS OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_INTERCONNECT OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_PLUGINMANAGER OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_TESTSUITE OFF CACHE BOOL "" FORCE) + set(CORRADE_WITH_MAIN ON CACHE BOOL "" FORCE) + add_subdirectory(third-party/corrade EXCLUDE_FROM_ALL) set(MAGNUM_BUILD_STATIC ON CACHE BOOL "" FORCE) set(MAGNUM_BUILD_STATIC_PIC ON CACHE BOOL "" FORCE) @@ -85,7 +96,9 @@ if(NOT SAVETOOL_USE_SYSTEM_LIBS) set(IMGUI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third-party/imgui) set(MAGNUM_WITH_IMGUI ON CACHE BOOL "" FORCE) add_subdirectory(third-party/magnum-integration EXCLUDE_FROM_ALL) +endif(NOT SAVETOOL_USE_SYSTEM_CORRADE_MAGNUM) +if(NOT SAVETOOL_USE_SYSTEM_LIBZIP) set(ENABLE_COMMONCRYPTO OFF CACHE BOOL "" FORCE) set(ENABLE_GNUTLS OFF CACHE BOOL "" FORCE) set(ENABLE_MBEDTLS OFF CACHE BOOL "" FORCE) @@ -99,12 +112,16 @@ if(NOT SAVETOOL_USE_SYSTEM_LIBS) set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) set(BUILD_DOC OFF CACHE BOOL "" FORCE) add_subdirectory(third-party/libzip EXCLUDE_FROM_ALL) +endif(NOT SAVETOOL_USE_SYSTEM_LIBZIP) +if(NOT SAVETOOL_USE_SYSTEM_EFSW) set(VERBOSE OFF CACHE BOOL "" FORCE) set(BUILD_TEST_APP OFF CACHE BOOL "" FORCE) set(EFSW_INSTALL OFF CACHE BOOL "" FORCE) add_subdirectory(third-party/efsw EXCLUDE_FROM_ALL) +endif(NOT SAVETOOL_USE_SYSTEM_EFSW) +if(NOT SAVETOOL_USE_SYSTEM_LIBCURL) set(BUILD_CURL_EXE OFF CACHE BOOL "" FORCE) set(ENABLE_UNICODE ON CACHE BOOL "" FORCE) set(ENABLE_INET_PTON OFF CACHE BOOL "" FORCE) @@ -118,6 +135,6 @@ if(NOT SAVETOOL_USE_SYSTEM_LIBS) set(CURL_USE_SCHANNEL ON CACHE BOOL "" FORCE) set(CURL_USE_LIBSSH2 OFF CACHE BOOL "" FORCE) # For some reason, even when HTTP_ONLY is set to ON, libcurl will try to link to libssh2. add_subdirectory(third-party/curl EXCLUDE_FROM_ALL) -endif(NOT SAVETOOL_USE_SYSTEM_LIBS) +endif(NOT SAVETOOL_USE_SYSTEM_LIBCURL) add_subdirectory(src) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 970fcfb..bbe0045 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -26,11 +26,18 @@ if(CORRADE_TARGET_WINDOWS) endif() find_package(Magnum REQUIRED GL Sdl2Application) find_package(MagnumIntegration REQUIRED ImGui) -if(SAVETOOL_USE_SYSTEM_LIBS) + +if(SAVETOOL_USE_SYSTEM_LIBZIP) find_package(libzip REQUIRED) +endif(SAVETOOL_USE_SYSTEM_LIBZIP) + +if(SAVETOOL_USE_SYSTEM_EFSW) find_package(efsw REQUIRED) +endif(SAVETOOL_USE_SYSTEM_EFSW) + +if(SAVETOOL_USE_SYSTEM_LIBCURL) find_package(CURL REQUIRED HTTPS) -endif() +endif(SAVETOOL_USE_SYSTEM_LIBCURL) set_directory_properties(PROPERTIES CORRADE_USE_PEDANTIC_FLAGS ON) @@ -247,10 +254,16 @@ target_link_libraries(MassBuilderSaveTool PRIVATE CURL::libcurl_static ) -if(SAVETOOL_USE_SYSTEM_LIBS) - target_link_libraries(MassBuilderSaveTool PRIVATE libzip::zip efsw::efsw) +if(SAVETOOL_USE_SYSTEM_LIBZIP) + target_link_libraries(MassBuilderSaveTool PRIVATE libzip::zip) else() - target_link_libraries(MassBuilderSaveTool PRIVATE zip efsw) + target_link_libraries(MassBuilderSaveTool PRIVATE zip) +endif() + +if(SAVETOOL_USE_SYSTEM_EFSW) + target_link_libraries(MassBuilderSaveTool PRIVATE efsw::efsw) +else() + target_link_libraries(MassBuilderSaveTool PRIVATE efsw) endif() if(CORRADE_TARGET_WINDOWS) -- 2.39.5 From e06a65ec71ebc3581737b25227633b8c6b22deb6 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 15:50:49 +0200 Subject: [PATCH 087/126] Update all dependencies. --- modules/FindCorrade.cmake | 15 ++++- modules/FindMagnum.cmake | 90 +++++++++++++++++------------ modules/FindMagnumIntegration.cmake | 10 +++- third-party/SDL | 2 +- third-party/curl | 2 +- third-party/efsw | 2 +- third-party/imgui | 2 +- third-party/libzip | 2 +- third-party/magnum | 2 +- third-party/magnum-integration | 2 +- 10 files changed, 81 insertions(+), 48 deletions(-) diff --git a/modules/FindCorrade.cmake b/modules/FindCorrade.cmake index d7806e0..7d2e725 100644 --- a/modules/FindCorrade.cmake +++ b/modules/FindCorrade.cmake @@ -122,6 +122,7 @@ # automatically) # CORRADE_TESTSUITE_XCTEST_RUNNER - Path to XCTestRunner.mm.in file # CORRADE_TESTSUITE_ADB_RUNNER - Path to AdbRunner.sh file +# CORRADE_UTILITY_JS - Path to CorradeUtility.js file # CORRADE_PEDANTIC_COMPILER_OPTIONS - List of pedantic compiler options used # for targets with :prop_tgt:`CORRADE_USE_PEDANTIC_FLAGS` enabled # CORRADE_PEDANTIC_COMPILER_DEFINITIONS - List of pedantic compiler @@ -473,8 +474,9 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) # Interconnect library if(_component STREQUAL Interconnect) # Disable /OPT:ICF on MSVC, which merges functions with identical - # contents and thus breaks signal comparison - if(CORRADE_TARGET_WINDOWS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + # contents and thus breaks signal comparison. Same case is for + # clang-cl which uses the MSVC linker by default. + if(CORRADE_TARGET_WINDOWS AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")) if(CMAKE_VERSION VERSION_LESS 3.13) set_property(TARGET Corrade::${_component} PROPERTY INTERFACE_LINK_LIBRARIES "-OPT:NOICF,REF") @@ -559,6 +561,15 @@ foreach(_component ${Corrade_FIND_COMPONENTS}) set_property(TARGET Corrade::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "log") endif() + # Emscripten has various stuff implemented in JS + if(CORRADE_TARGET_EMSCRIPTEN) + find_file(CORRADE_UTILITY_JS CorradeUtility.js + PATH_SUFFIXES lib) + set_property(TARGET Corrade::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once we + # require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${CORRADE_UTILITY_JS}") + endif() endif() # Find library includes diff --git a/modules/FindMagnum.cmake b/modules/FindMagnum.cmake index 9fdbd6e..88959a3 100644 --- a/modules/FindMagnum.cmake +++ b/modules/FindMagnum.cmake @@ -135,9 +135,9 @@ # globals unique even across different shared libraries # MAGNUM_TARGET_GL - Defined if compiled with OpenGL interop # MAGNUM_TARGET_GLES - Defined if compiled for OpenGL ES -# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 -# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0 # MAGNUM_TARGET_WEBGL - Defined if compiled for WebGL +# MAGNUM_TARGET_GLES2 - Defined if compiled for OpenGL ES 2.0 / WebGL +# 1 instead of OpenGL ES 3.0+ / WebGL 2 # MAGNUM_TARGET_EGL - Defined if compiled for EGL instead of a # platform-specific OpenGL support library like CGL, EAGL, GLX or WGL # MAGNUM_TARGET_VK - Defined if compiled with Vulkan interop @@ -152,6 +152,8 @@ # Android, Emscripten or Windows RT. Use MAGNUM_TARGET_EGL instead. # MAGNUM_TARGET_DESKTOP_GLES` - Defined if compiled for OpenGL ES but # GLX / WGL is used instead of EGL. Use MAGNUM_TARGET_EGL instead. +# MAGNUM_TARGET_GLES3 - Defined if compiled for OpenGL ES 3.0+ / +# WebGL 2. Use an inverse of the MAGNUM_TARGET_GLES2 variable instead. # # Additionally these variables are defined for internal usage: # @@ -162,6 +164,7 @@ # MAGNUM_*_LIBRARY - Component libraries (w/o dependencies) # MAGNUM_*_LIBRARY_DEBUG - Debug version of given library, if found # MAGNUM_*_LIBRARY_RELEASE - Release version of given library, if found +# MAGNUM_PLATFORM_JS - Path to MagnumPlatform.js file # MAGNUM_BINARY_INSTALL_DIR - Binary installation directory # MAGNUM_LIBRARY_INSTALL_DIR - Library installation directory # MAGNUM_DATA_INSTALL_DIR - Data installation directory @@ -226,6 +229,15 @@ # DEALINGS IN THE SOFTWARE. # +# CMake policies used by FindMagnum are popped again at the end. +cmake_policy(PUSH) +# Prefer GLVND when finding OpenGL. If this causes problems (known to fail with +# NVidia drivers in Debian Buster, reported on 2019-04-09), users can override +# this by setting OpenGL_GL_PREFERENCE to LEGACY. +if(POLICY CMP0072) + cmake_policy(SET CMP0072 NEW) +endif() + # Corrade library dependencies set(_MAGNUM_CORRADE_DEPENDENCIES ) foreach(_magnum_component ${Magnum_FIND_COMPONENTS}) @@ -281,7 +293,6 @@ set(_magnumFlags TARGET_GL TARGET_GLES TARGET_GLES2 - TARGET_GLES3 TARGET_WEBGL TARGET_EGL TARGET_VK) @@ -306,14 +317,9 @@ if(MAGNUM_BUILD_DEPRECATED) set(MAGNUM_TARGET_DESKTOP_GLES 1) endif() endif() -endif() - -# OpenGL library preference. Prefer to use GLVND, since that's the better -# approach nowadays, but allow the users to override it from outside in case -# it is broken for some reason (Nvidia drivers in Debian's testing (Buster) -- -# reported on 2019-04-09). -if(NOT CMAKE_VERSION VERSION_LESS 3.10 AND NOT OpenGL_GL_PREFERENCE) - set(OpenGL_GL_PREFERENCE GLVND) + if(MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_GLES2) + set(MAGNUM_TARGET_GLES3 1) + endif() endif() # Base Magnum library @@ -696,7 +702,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES android EGL::EGL) - # EmscriptenApplication has no additional dependencies + # Emscripten application dependencies + elseif(_component STREQUAL EmscriptenApplication) + # Emscripten has various stuff implemented in JS + if(CORRADE_TARGET_EMSCRIPTEN) + find_file(MAGNUM_PLATFORM_JS MagnumPlatform.js + PATH_SUFFIXES lib) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once + # we require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${MAGNUM_PLATFORM_JS}") + endif() # GLFW application dependencies elseif(_component STREQUAL GlfwApplication) @@ -715,7 +731,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) endif() - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX/EGL because libOpenGL doesn't provide it. For EGL we have # our own EGL find module, which makes things simpler. The # upstream FindOpenGL is anything but simple. Also can't use @@ -752,9 +768,17 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) elseif(CORRADE_TARGET_UNIX) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}) + # Emscripten has various stuff implemented in JS + elseif(CORRADE_TARGET_EMSCRIPTEN) + find_file(MAGNUM_PLATFORM_JS MagnumPlatform.js + PATH_SUFFIXES lib) + set_property(TARGET Magnum::${_component} APPEND PROPERTY + # TODO switch to INTERFACE_LINK_OPTIONS and SHELL: once + # we require CMake 3.13 unconditionally + INTERFACE_LINK_LIBRARIES "--js-library ${MAGNUM_PLATFORM_JS}") endif() - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX/EGL because libOpenGL doesn't provide it. For EGL we have # our own EGL find module, which makes things simpler. The # upstream FindOpenGL is anything but simple. Also can't use @@ -784,12 +808,19 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${X11_LIBRARIES}) - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX because libOpenGL doesn't provide it. Also can't use # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is # *not* found. WTF. Also can't just check for # OPENGL_opengl_LIBRARY because that's set even if # OpenGL_GL_PREFERENCE is explicitly set to LEGACY. + # + # If MAGNUM_TARGET_GLES and MAGNUM_TARGET_EGL is set, these + # applications can be built only if GLVND is available as + # otherwise there would be a conflict between libGL and + # libGLES. Thus, if GLVND is not available, it won't link + # libGLX here, but that shouldn't be a problem since the + # application library won't exist either. find_package(OpenGL) if(OPENGL_opengl_LIBRARY AND OpenGL_GL_PREFERENCE STREQUAL GLVND) set_property(TARGET Magnum::${_component} APPEND PROPERTY @@ -832,7 +863,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # GLX context dependencies if(_component STREQUAL GlxContext) - # With GLVND (since CMake 3.11) we need to explicitly link to + # With GLVND (since CMake 3.10) we need to explicitly link to # GLX because libOpenGL doesn't provide it. Also can't use # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is # *not* found. If GLVND is not used, link to X11 instead. Also @@ -871,7 +902,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) # GL library elseif(_component STREQUAL GL) if(NOT MAGNUM_TARGET_GLES OR (MAGNUM_TARGET_GLES AND NOT MAGNUM_TARGET_EGL AND NOT CORRADE_TARGET_IOS)) - # If the GLVND library (CMake 3.11+) was found, link to the + # If the GLVND library (CMake 3.10+) was found, link to the # imported target. Otherwise (and also on all systems except # Linux) link to the classic libGL. Can't use # OpenGL_OpenGL_FOUND, because that one is set also if GLVND is @@ -890,7 +921,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) find_package(OpenGLES2 REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGLES2::OpenGLES2) - elseif(MAGNUM_TARGET_GLES3) + else() find_package(OpenGLES3 REQUIRED) set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES OpenGLES3::OpenGLES3) @@ -985,7 +1016,7 @@ foreach(_component ${Magnum_FIND_COMPONENTS}) endforeach() set_property(TARGET Magnum::${_component} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Magnum::Magnum) - set(_MAGNUM_${component}_OPTIONAL_DEPENDENCIES_TO_ADD ) + set(_MAGNUM_${_component}_OPTIONAL_DEPENDENCIES_TO_ADD ) foreach(_dependency ${_MAGNUM_${_component}_DEPENDENCIES}) if(NOT _MAGNUM_${_component}_${_dependency}_DEPENDENCY_IS_OPTIONAL) set_property(TARGET Magnum::${_component} APPEND PROPERTY @@ -1047,24 +1078,6 @@ if(CORRADE_TARGET_EMSCRIPTEN) MAGNUM_EMSCRIPTENAPPLICATION_JS MAGNUM_WINDOWLESSEMSCRIPTENAPPLICATION_JS MAGNUM_WEBAPPLICATION_CSS) - - # If we are on CMake 3.13 and up, `-s USE_WEBGL2=1` linker option is - # propagated from FindOpenGLES3.cmake already. If not (and the GL library - # is used), we need to modify the global CMAKE_EXE_LINKER_FLAGS. Do it here - # instead of in FindOpenGLES3.cmake so it works also for CMake subprojects - # (in which case find_package(OpenGLES3) is called in (and so - # CMAKE_EXE_LINKER_FLAGS would be modified in) Magnum's root CMakeLists.txt - # and thus can't affect the variable in the outer project). CMake supports - # IN_LIST as an operator since 3.1 (Emscripten needs at least 3.7), but - # it's behind a policy, so enable that one as well. - cmake_policy(SET CMP0057 NEW) - # TODO since 1.39.19 it's possible to use `-sUSE_WEBGL2=1`, which can be - # then passed via target_link_libraries() etc. without requiring CMake - # 3.13: https://github.com/emscripten-core/emscripten/blob/main/ChangeLog.md#13919-07072020 - # -- change to that once we drop support for older Emscripten versions - if(CMAKE_VERSION VERSION_LESS 3.13 AND GL IN_LIST Magnum_FIND_COMPONENTS AND NOT MAGNUM_TARGET_GLES2 AND NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-s USE_WEBGL2=1") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s USE_WEBGL2=1") - endif() endif() # For CMake 3.16+ with REASON_FAILURE_MESSAGE, provide additional potentially @@ -1291,3 +1304,6 @@ if(MAGNUM_PLUGINS_RELEASE_DIR) set(MAGNUM_PLUGINS_SCENECONVERTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/sceneconverters) set(MAGNUM_PLUGINS_AUDIOIMPORTER_RELEASE_DIR ${MAGNUM_PLUGINS_RELEASE_DIR}/audioimporters) endif() + +# Resets CMake policies set at the top of the file to not affect other code. +cmake_policy(POP) diff --git a/modules/FindMagnumIntegration.cmake b/modules/FindMagnumIntegration.cmake index d2e64de..7a547ce 100644 --- a/modules/FindMagnumIntegration.cmake +++ b/modules/FindMagnumIntegration.cmake @@ -89,8 +89,14 @@ if(_MAGNUMINTEGRATION_OPTIONAL_DEPENDENCIES) find_package(Magnum OPTIONAL_COMPONENTS ${_MAGNUMINTEGRATION_OPTIONAL_DEPENDENCIES}) endif() -# Global integration include dir -find_path(MAGNUMINTEGRATION_INCLUDE_DIR Magnum +# Global include dir that's unique to Magnum Integration. Often it will be +# installed alongside Magnum, which is why the hint, but if not, it shouldn't +# just pick MAGNUM_INCLUDE_DIR because then _MAGNUMINTEGRATION_*_INCLUDE_DIR +# will fail to be found. In case of CMake subprojects the versionIntegration.h +# is generated inside the build dir so this won't find it, instead +# src/CMakeLists.txt forcibly sets MAGNUMINTEGRATION_INCLUDE_DIR as an internal +# cache value to make that work. +find_path(MAGNUMINTEGRATION_INCLUDE_DIR Magnum/versionIntegration.h HINTS ${MAGNUM_INCLUDE_DIR}) mark_as_advanced(MAGNUMINTEGRATION_INCLUDE_DIR) diff --git a/third-party/SDL b/third-party/SDL index 0134672..1fa6142 160000 --- a/third-party/SDL +++ b/third-party/SDL @@ -1 +1 @@ -Subproject commit 01346723455a37c1cd14bba28ebeffe268002bcd +Subproject commit 1fa6142903b88007c7b77d324ee78fad9966871a diff --git a/third-party/curl b/third-party/curl index a4ed3e7..9287563 160000 --- a/third-party/curl +++ b/third-party/curl @@ -1 +1 @@ -Subproject commit a4ed3e766a68ff7517ee9cf3cb71c7255e8ee9b0 +Subproject commit 9287563e86a5b2007fb67f68c075a87a93825861 diff --git a/third-party/efsw b/third-party/efsw index bc85baf..3419347 160000 --- a/third-party/efsw +++ b/third-party/efsw @@ -1 +1 @@ -Subproject commit bc85bafae7d7b641e326ed5d01bfffd5eb0352f5 +Subproject commit 341934765471e4074e90bb5205ff4a65c16499c6 diff --git a/third-party/imgui b/third-party/imgui index 3c435c0..4f9ba19 160000 --- a/third-party/imgui +++ b/third-party/imgui @@ -1 +1 @@ -Subproject commit 3c435c029788cc26c52e835e2feb262a3057addc +Subproject commit 4f9ba19e520bea478f5cb654d37ef45e6404bd52 diff --git a/third-party/libzip b/third-party/libzip index 0b6ebe6..f0eff80 160000 --- a/third-party/libzip +++ b/third-party/libzip @@ -1 +1 @@ -Subproject commit 0b6ebe6fad8adb1ec95bb5529c5af2185d40c2cf +Subproject commit f0eff80889f1b0791e91516d2d84e8d5b84a1e02 diff --git a/third-party/magnum b/third-party/magnum index 7d0a821..8538610 160000 --- a/third-party/magnum +++ b/third-party/magnum @@ -1 +1 @@ -Subproject commit 7d0a8215d38284f7b7ae041cfbb19d410e5988a6 +Subproject commit 8538610fa27e1db37070eaabe34f1e4e41648bab diff --git a/third-party/magnum-integration b/third-party/magnum-integration index f01593f..bf09698 160000 --- a/third-party/magnum-integration +++ b/third-party/magnum-integration @@ -1 +1 @@ -Subproject commit f01593fc94556bff23a848ac71187c56e034b6d9 +Subproject commit bf09698491f2061733dc263f375da1f02f41d8ec -- 2.39.5 From fbfcce1d86252b66c44e9ac3cdff9a431ac1e61d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 7 Apr 2024 20:45:31 +0200 Subject: [PATCH 088/126] Managers: split ProfileManager functionality. There's now a BackupManager class, which handles all backup management functionalities ProfileManager used to have. ProfileManager also got adapted to paths being available from Configuration, which was long overdue. Application was adapted to the various changes. --- src/Application/Application.h | 4 +- .../Application_Initialisation.cpp | 4 +- .../Application_ProfileManager.cpp | 94 ++--- src/CMakeLists.txt | 3 + src/Managers/Backup.h | 43 +++ src/Managers/BackupManager.cpp | 323 ++++++++++++++++++ src/Managers/BackupManager.h | 55 +++ src/Managers/ProfileManager.cpp | 262 +------------- src/Managers/ProfileManager.h | 28 +- 9 files changed, 465 insertions(+), 351 deletions(-) create mode 100644 src/Managers/Backup.h create mode 100644 src/Managers/BackupManager.cpp create mode 100644 src/Managers/BackupManager.h diff --git a/src/Application/Application.h b/src/Application/Application.h index 0127256..49c74ce 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -38,6 +38,7 @@ #include +#include "../Managers/BackupManager.h" #include "../Managers/MassManager.h" #include "../Managers/ProfileManager.h" #include "../ToastQueue/ToastQueue.h" @@ -116,7 +117,6 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawBackupListPopup(); void drawBackupRestorePopup(std::size_t backup_index); void drawBackupDeletePopup(std::size_t backup_index); - void drawBackupProfilePopup(std::size_t profile_index); void drawDeleteProfilePopup(std::size_t profile_index); void drawManager(); @@ -239,6 +239,8 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe Containers::Pointer _profileManager; GameObjects::Profile* _currentProfile = nullptr; + Containers::Pointer _backupManager; + Containers::Pointer _massManager; GameObjects::Mass* _currentMass = nullptr; diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 31f68e8..1c96fbf 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -109,13 +109,15 @@ Application::initialiseManager() { SDL_zero(event); event.type = _initEventId; - _profileManager.emplace(conf().directories().gameSaves, conf().directories().backups); + _profileManager.emplace(); if(!_profileManager->ready()) { event.user.code = ProfileManagerFailure; SDL_PushEvent(&event); return; } + _backupManager.emplace(); + event.user.code = InitSuccess; SDL_PushEvent(&event); } diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index 29b5e8d..fa55485 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -58,7 +58,7 @@ Application::drawProfileManager() { } ImGui::SameLine(); if(ImGui::SmallButton("Backups")) { - _profileManager->refreshBackups(); + _backupManager->refresh(); ImGui::OpenPopup("Backups##BackupsModal"); } drawBackupListPopup(); @@ -100,11 +100,14 @@ Application::drawProfileManager() { ImGui::TableSetColumnIndex(2); if(ImGui::SmallButton(ICON_FA_FILE_ARCHIVE)) { - profile_index = i; - ImGui::OpenPopup("Include builds ?##IncludeBuildsDialog"); + if(!_backupManager->create(_profileManager->profiles()[i])) { + _queue.addToast(Toast::Type::Error, _backupManager->lastError(), std::chrono::seconds{5}); + } + else { + _queue.addToast(Toast::Type::Success, "Backup created successfully!"_s); + } } drawTooltip("Backup"); - drawBackupProfilePopup(profile_index); ImGui::SameLine(0.0f, 2.0f); if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_TRASH_ALT)) { profile_index = i; @@ -144,13 +147,13 @@ Application::drawBackupListPopup() { ImGui::TableSetColumnIndex(1); if(ImGui::SmallButton("Refresh")) { - _profileManager->refreshBackups(); + _backupManager->refresh(); } ImGui::EndTable(); } - if(_profileManager->backups().isEmpty()) { + if(_backupManager->backups().isEmpty()) { ImGui::TextDisabled("No backups were found."); } else if(ImGui::BeginTable("##Backups", 4, @@ -172,8 +175,8 @@ Application::drawBackupListPopup() { ImGui::TableSetColumnIndex(3); ImGui::TextUnformatted("Actions"); - for(std::size_t i = 0; i < _profileManager->backups().size(); ++i) { - auto& backup = _profileManager->backups()[i]; + for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { + auto& backup = _backupManager->backups()[i]; ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); @@ -249,13 +252,13 @@ Application::drawBackupRestorePopup(std::size_t backup_index) { ImGui::PushTextWrapPos(float(windowSize().x()) * 0.50f); ImGui::Text("Are you sure you want to restore the %s backup from %.4i-%.2i-%.2i %.2i:%.2i:%.2i ?\n\n" "Any existing data will be overwritten.", - _profileManager->backups()[backup_index].company.data(), - _profileManager->backups()[backup_index].timestamp.year, - _profileManager->backups()[backup_index].timestamp.month, - _profileManager->backups()[backup_index].timestamp.day, - _profileManager->backups()[backup_index].timestamp.hour, - _profileManager->backups()[backup_index].timestamp.minute, - _profileManager->backups()[backup_index].timestamp.second); + _backupManager->backups()[backup_index].company.data(), + _backupManager->backups()[backup_index].timestamp.year, + _backupManager->backups()[backup_index].timestamp.month, + _backupManager->backups()[backup_index].timestamp.day, + _backupManager->backups()[backup_index].timestamp.hour, + _backupManager->backups()[backup_index].timestamp.minute, + _backupManager->backups()[backup_index].timestamp.second); ImGui::PopTextWrapPos(); if(ImGui::BeginTable("##RestoreBackupLayout", 2)) { @@ -266,7 +269,7 @@ Application::drawBackupRestorePopup(std::size_t backup_index) { ImGui::TableSetColumnIndex(1); if(ImGui::Button("Yes")) { - if(!_profileManager->restoreBackup(backup_index)) { + if(!_backupManager->restore(backup_index)) { _queue.addToast(Toast::Type::Error, _profileManager->lastError()); } if(!_profileManager->refreshProfiles()) { @@ -298,13 +301,13 @@ Application::drawBackupDeletePopup(std::size_t backup_index) { ImGui::PushTextWrapPos(float(windowSize().x()) * 0.50f); ImGui::Text("Are you sure you want to delete the %s backup from %.4i-%.2i-%.2i %.2i:%.2i:%.2i ?\n\n" "This operation is irreversible.", - _profileManager->backups()[backup_index].company.data(), - _profileManager->backups()[backup_index].timestamp.year, - _profileManager->backups()[backup_index].timestamp.month, - _profileManager->backups()[backup_index].timestamp.day, - _profileManager->backups()[backup_index].timestamp.hour, - _profileManager->backups()[backup_index].timestamp.minute, - _profileManager->backups()[backup_index].timestamp.second); + _backupManager->backups()[backup_index].company.data(), + _backupManager->backups()[backup_index].timestamp.year, + _backupManager->backups()[backup_index].timestamp.month, + _backupManager->backups()[backup_index].timestamp.day, + _backupManager->backups()[backup_index].timestamp.hour, + _backupManager->backups()[backup_index].timestamp.minute, + _backupManager->backups()[backup_index].timestamp.second); ImGui::PopTextWrapPos(); if(ImGui::BeginTable("##DeleteBackupLayout", 2)) { @@ -315,7 +318,7 @@ Application::drawBackupDeletePopup(std::size_t backup_index) { ImGui::TableSetColumnIndex(1); if(ImGui::Button("Yes")) { - if(!_profileManager->deleteBackup(backup_index)) { + if(!_backupManager->remove(backup_index)) { _queue.addToast(Toast::Type::Error, _profileManager->lastError()); } ImGui::CloseCurrentPopup(); @@ -331,49 +334,6 @@ Application::drawBackupDeletePopup(std::size_t backup_index) { ImGui::EndPopup(); } -void -Application::drawBackupProfilePopup(std::size_t profile_index) { - if(!ImGui::BeginPopupModal("Include builds ?##IncludeBuildsDialog", nullptr, - ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) - { - return; - } - - ImGui::TextUnformatted("Should builds be added to the backup ?"); - - if(ImGui::BeginTable("##NameBackupLayout", 2)) { - ImGui::TableSetupColumn("##Dummy", ImGuiTableColumnFlags_WidthStretch); - ImGui::TableSetupColumn("##YesNo", ImGuiTableColumnFlags_WidthFixed); - - ImGui::TableNextRow(); - - ImGui::TableSetColumnIndex(1); - if(ImGui::Button("Yes")) { - if(!_profileManager->backupProfile(profile_index, true)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", - _profileManager->lastError().data(), window()); - } - ImGui::CloseCurrentPopup(); - } - ImGui::SameLine(); - if(ImGui::Button("No", ImGui::GetItemRectSize())) { - if(!_profileManager->backupProfile(profile_index, false)) { - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Error", - _profileManager->lastError().data(), window()); - } - ImGui::CloseCurrentPopup(); - } - ImGui::SameLine(); - if(ImGui::Button("Cancel")) { - ImGui::CloseCurrentPopup(); - } - - ImGui::EndTable(); - } - - ImGui::EndPopup(); -} - void Application::drawDeleteProfilePopup(std::size_t profile_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteProfileConfirmation", nullptr, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bbe0045..89f4ac5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -192,6 +192,9 @@ add_executable(MassBuilderSaveTool GameObjects/Weapon.h GameObjects/Weapon.cpp GameObjects/WeaponPart.h + Managers/Backup.h + Managers/BackupManager.h + Managers/BackupManager.cpp Managers/MassManager.h Managers/MassManager.cpp Managers/ProfileManager.h diff --git a/src/Managers/Backup.h b/src/Managers/Backup.h new file mode 100644 index 0000000..db8b014 --- /dev/null +++ b/src/Managers/Backup.h @@ -0,0 +1,43 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include +#include + +using namespace Corrade; + +namespace mbst { namespace Managers { + +struct Backup { + Containers::String filename; + Containers::String company; + bool demo; + struct { + std::int32_t year; + std::int32_t month; + std::int32_t day; + std::int32_t hour; + std::int32_t minute; + std::int32_t second; + } timestamp; + Containers::Array includedFiles; +}; + +}} diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp new file mode 100644 index 0000000..a455e49 --- /dev/null +++ b/src/Managers/BackupManager.cpp @@ -0,0 +1,323 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include "../Configuration/Configuration.h" +#include "../Logger/Logger.h" +#include "../Utilities/Temp.h" + +#include "BackupManager.h" + +namespace mbst { namespace Managers { + +BackupManager::BackupManager() { + refresh(); +} + +Containers::StringView +BackupManager::lastError() { + return _lastError; +} + +void +BackupManager::refresh() { + _backups = Containers::Array{}; + + scanSubdir(""_s); +} + +Containers::ArrayView +BackupManager::backups() const { + return _backups; +} + +bool +BackupManager::create(const GameObjects::Profile& profile) { + if(!profile.valid()) { + LOG_ERROR(_lastError = "Profile is not valid."); + return false; + } + + const auto timestamp = []{ + std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); + return *std::localtime(×tamp); + }(); + + auto filename = Utility::format("{}_{}{:.2d}{:.2d}_{:.2d}{:.2d}{:.2d}.backup.mbst", + Utility::String::replaceAll(profile.companyName(), ' ', '_').data(), + timestamp.tm_year + 1900, timestamp.tm_mon + 1, timestamp.tm_mday, + timestamp.tm_hour, timestamp.tm_min, timestamp.tm_sec); + auto temp_path = Utilities::getTempPath(filename); + + int error_code = 0; + auto zip = zip_open(temp_path.data(), ZIP_CREATE|ZIP_TRUNCATE, &error_code); + if(zip == nullptr) { + zip_error_t error; + zip_error_init_with_code(&error, error_code); + LOG_ERROR(_lastError = zip_error_strerror(&error)); + zip_error_fini(&error); + return false; + } + + Containers::ScopeGuard guard{&filename, [](Containers::String* str){ + Utilities::deleteTempFile(*str); + }}; + + Containers::StringView save_dir = conf().directories().gameSaves; + + auto profile_source = zip_source_file(zip, Utility::Path::join(save_dir, profile.filename()).data(), 0, 0); + if(!profile_source) { + LOG_ERROR(_lastError = zip_strerror(zip)); + zip_source_free(profile_source); + return false; + } + + if(zip_file_add(zip, profile.filename().data(), profile_source, ZIP_FL_ENC_UTF_8) == -1) { + LOG_ERROR(_lastError = zip_strerror(zip)); + zip_source_free(profile_source); + return false; + } + + auto comment = Utility::format("{}|{}|{}-{:.2d}-{:.2d}-{:.2d}-{:.2d}-{:.2d}", + profile.companyName(), profile.isDemo() ? "demo"_s : "full"_s, + timestamp.tm_year + 1900, timestamp.tm_mon + 1, timestamp.tm_mday, + timestamp.tm_hour, timestamp.tm_min, timestamp.tm_sec); + zip_set_archive_comment(zip, comment.data(), comment.size()); + + for(std::uint8_t i = 0; i < 32; ++i) { + auto build_filename = Utility::format("{}Unit{:.2d}{}.sav", + profile.isDemo() ? "Demo"_s : ""_s, i, + profile.account()); + + if(!Utility::Path::exists(Utility::Path::join(save_dir, build_filename))) { + continue; + } + + auto build_source = zip_source_file(zip, Utility::Path::join(save_dir, build_filename).data(), 0, 0); + if(!build_source) { + LOG_ERROR(_lastError = zip_strerror(zip)); + zip_source_free(build_source); + return false; + } + + if(zip_file_add(zip, build_filename.data(), build_source, ZIP_FL_ENC_UTF_8) == -1) { + LOG_ERROR(_lastError = zip_strerror(zip)); + zip_source_free(build_source); + return false; + } + } + + if(zip_close(zip) == -1) { + LOG_ERROR(_lastError = zip_strerror(zip)); + return false; + } + + if(!Utilities::moveFromTemp(filename, conf().directories().backups)) { + _lastError = Utility::format("Couldn't move {} to {}.", filename, conf().directories().backups); + return false; + } + + guard.release(); + + return true; +} + +bool +BackupManager::remove(std::size_t index) { + CORRADE_INTERNAL_ASSERT(index < _backups.size()); + + if(!Utility::Path::remove(Utility::Path::join(conf().directories().backups, _backups[index].filename))) { + LOG_ERROR(_lastError = "Couldn't delete " + _backups[index].filename); + return false; + } + + return true; +} + +bool +BackupManager::restore(std::size_t index) { + CORRADE_INTERNAL_ASSERT(index < _backups.size()); + + const auto& backup = _backups[index]; + + int error_code = 0; + auto zip = zip_open(Utility::Path::join(conf().directories().backups, backup.filename).data(), ZIP_RDONLY, + &error_code); + if(zip == nullptr) { + zip_error_t error; + zip_error_init_with_code(&error, error_code); + LOG_ERROR(_lastError = zip_error_strerror(&error)); + zip_error_fini(&error); + return false; + } + + Containers::ScopeGuard zip_guard{zip, zip_close}; + + auto error_format = "Extraction of file {} failed: {}"_s; + + for(Containers::StringView file : backup.includedFiles) { + auto temp_file = Utilities::getTempPath(file); + auto out = std::fopen(temp_file.cbegin(), "wb"); + if(out == nullptr) { + LOG_ERROR(_lastError = Utility::format(error_format.data(), file, std::strerror(errno))); + return false; + } + + Containers::ScopeGuard out_guard{out, std::fclose}; + + auto zf = zip_fopen(zip, file.data(), ZIP_FL_ENC_UTF_8); + if(zf == nullptr) { + LOG_ERROR(_lastError = Utility::format(error_format.data(), file, zip_strerror(zip))); + return false; + } + + Containers::ScopeGuard zf_guard{zf, zip_fclose}; + + Containers::StaticArray<8192, char> buf{ValueInit}; + + std::int64_t bytes_read; + while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0ll) { + if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast(bytes_read)) { + LOG_ERROR(_lastError = Utility::format(error_format.data(), file, "not enough bytes written.")); + return false; + } + } + + if(bytes_read == -1) { + LOG_ERROR(_lastError = Utility::format(error_format.data(), file, "couldn't read bytes from archive.")); + return false; + } + + if(!Utilities::moveFromTemp(file, conf().directories().gameSaves)) { + _lastError = Utility::format("Couldn't move {} to {}.", file, conf().directories().gameSaves); + return false; + } + } + + return true; +} + +void +BackupManager::scanSubdir(Containers::StringView subdir) { + static std::uint8_t depth = 0; + + using Flag = Utility::Path::ListFlag; + auto files = Utility::Path::list(conf().directories().backups, Flag::SkipDirectories|Flag::SkipSpecial); + if(!files) { + LOG_ERROR_FORMAT("Couldn't list contents of {}.", conf().directories().backups); + } + + auto predicate = [](Containers::StringView file)->bool{ + return !(file.hasSuffix(".mbprofbackup"_s) || file.hasSuffix(".backup.mbst"_s)); + }; + + auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate)); + + int error_code = 0; + zip_t* zip; + for(Containers::StringView file : files_view) { + Backup backup; + backup.filename = Utility::Path::join(subdir, file); + + zip = zip_open(Utility::Path::join(conf().directories().backups, file).data(), ZIP_RDONLY, &error_code); + if(zip == nullptr) { + continue; + } + + Containers::ScopeGuard guard{zip, zip_close}; + + auto num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED); + + if(num_entries == 0) { + continue; + } + + int comment_length; + Containers::StringView comment = zip_get_archive_comment(zip, &comment_length, ZIP_FL_UNCHANGED); + if(comment == nullptr) { + continue; + } + + auto info = comment.split('|'); + + if(info.size() != 3) { + continue; + } + + backup.company = info[0]; + + if(info[1].hasPrefix("full")) { + backup.demo = false; + } + else if(info[1].hasPrefix("demo")) { + backup.demo = true; + } + else { + continue; + } + + auto ts = info[2].split('-'); + if(ts.size() != 6) { + continue; + } + + backup.timestamp.year = std::strtol(ts[0].data(), nullptr, 10); + backup.timestamp.month = std::strtol(ts[1].data(), nullptr, 10); + backup.timestamp.day = std::strtol(ts[2].data(), nullptr, 10); + backup.timestamp.hour = std::strtol(ts[3].data(), nullptr, 10); + backup.timestamp.minute = std::strtol(ts[4].data(), nullptr, 10); + backup.timestamp.second = std::strtol(ts[5].data(), nullptr, 10); + + arrayReserve(backup.includedFiles, num_entries); + + for(auto i = 0; i < num_entries; i++) { + arrayAppend(backup.includedFiles, InPlaceInit, zip_get_name(zip, i, ZIP_FL_UNCHANGED)); + } + + arrayAppend(_backups, Utility::move(backup)); + } + + auto subdirs = Utility::Path::list(conf().directories().backups, + Flag::SkipFiles|Flag::SkipSpecial|Flag::SkipDotAndDotDot); + if(!subdirs) { + LOG_ERROR_FORMAT("Couldn't list contents of {}.", conf().directories().backups); + } + + if(depth == 5) { + return; + } + + depth++; + + for(auto& dir : *subdirs) { + scanSubdir(Utility::Path::join(subdir, dir)); + } + + depth--; +} + +}} diff --git a/src/Managers/BackupManager.h b/src/Managers/BackupManager.h new file mode 100644 index 0000000..f165f23 --- /dev/null +++ b/src/Managers/BackupManager.h @@ -0,0 +1,55 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include +#include + +#include + +#include "Backup.h" +#include "../GameObjects/Profile.h" + +using namespace Corrade; + +namespace mbst { namespace Managers { + +class BackupManager { + public: + BackupManager(); + + auto lastError() -> Containers::StringView; + + void refresh(); + + auto backups() const -> Containers::ArrayView; + + bool create(const GameObjects::Profile& profile); + bool remove(std::size_t index); + bool restore(std::size_t index); + + private: + void scanSubdir(Containers::StringView subdir); + + Containers::String _lastError; + + Containers::Array _backups; +}; + +}} diff --git a/src/Managers/ProfileManager.cpp b/src/Managers/ProfileManager.cpp index 2786e85..aab1024 100644 --- a/src/Managers/ProfileManager.cpp +++ b/src/Managers/ProfileManager.cpp @@ -27,6 +27,7 @@ #include +#include "../Configuration/Configuration.h" #include "../Logger/Logger.h" #include "ProfileManager.h" @@ -35,10 +36,7 @@ using namespace Containers::Literals; namespace mbst { namespace Managers { -ProfileManager::ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir): - _saveDirectory{save_dir}, - _backupsDirectory{backup_dir} -{ +ProfileManager::ProfileManager() { _ready = refreshProfiles(); } @@ -64,12 +62,11 @@ ProfileManager::refreshProfiles() { _profiles = Containers::Array{}; using Utility::Path::ListFlag; - auto files = Utility::Path::list(_saveDirectory, + auto files = Utility::Path::list(conf().directories().gameSaves, ListFlag::SkipSpecial|ListFlag::SkipDirectories|ListFlag::SkipDotAndDotDot); if(!files) { - _lastError = _saveDirectory + " can't be opened."; - LOG_ERROR(_lastError); + LOG_ERROR(_lastError = conf().directories().gameSaves + " can't be opened."); return false; } @@ -80,7 +77,7 @@ ProfileManager::refreshProfiles() { auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate)); for(const auto& file : files_view) { - GameObjects::Profile profile{Utility::Path::join(_saveDirectory, file)}; + GameObjects::Profile profile{Utility::Path::join(conf().directories().gameSaves, file)}; if(!profile.valid()) { LOG_WARNING_FORMAT("Profile {} is invalid: {}", file, profile.lastError()); @@ -106,7 +103,7 @@ ProfileManager::getProfile(std::size_t index) { bool ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { - if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _profiles[index].filename()))) { + if(!Utility::Path::remove(Utility::Path::join(conf().directories().gameSaves, _profiles[index].filename()))) { _lastError = Utility::format("Couldn't delete {} (filename: {}).", _profiles[index].companyName(), _profiles[index].filename()); @@ -120,7 +117,7 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { auto filename = Utility::format("{}Unit{:.2d}{}.sav", _profiles[index].type() == GameObjects::Profile::Type::Demo ? "Demo": "", i, _profiles[index].account()); - Utility::Path::remove(Utility::Path::join(_saveDirectory, filename)); + Utility::Path::remove(Utility::Path::join(conf().directories().gameSaves, filename)); } } @@ -135,249 +132,4 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { return true; } -bool -ProfileManager::backupProfile(std::size_t index, bool backup_builds) { - std::time_t timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); - std::tm* time = std::localtime(×tamp); - auto& profile = _profiles[index]; - - auto filename = Utility::format("{}_{}{:.2d}{:.2d}_{:.2d}{:.2d}{:.2d}.backup.mbst", - Utility::String::replaceAll(profile.companyName().data(), " ", "_").data(), - time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, - time->tm_hour, time->tm_min, time->tm_sec); - - int error_code = 0; - zip_error_t error; - zip_t* zip = zip_open(Utility::Path::join(_backupsDirectory, filename).data(), ZIP_CREATE|ZIP_TRUNCATE, &error_code); - if(zip == nullptr) { - zip_error_init_with_code(&error, error_code); - _lastError = zip_error_strerror(&error); - LOG_ERROR(_lastError); - return false; - } - - zip_source_t* profile_source = zip_source_file(zip, Utility::Path::toNativeSeparators(Utility::Path::join(_saveDirectory, profile.filename())).data(), 0, 0); - if(profile_source == nullptr) { - _lastError = zip_strerror(zip); - LOG_ERROR(_lastError); - zip_source_free(profile_source); - return false; - } - - if(zip_file_add(zip, profile.filename().data(), profile_source, ZIP_FL_ENC_UTF_8) == -1) { - _lastError = zip_strerror(zip); - LOG_ERROR(_lastError); - zip_source_free(profile_source); - return false; - } - - auto comment = Utility::format("{}|{}|{}-{:.2d}-{:.2d}-{:.2d}-{:.2d}-{:.2d}", - profile.companyName(), - profile.isDemo() ? "demo"_s : "full"_s, - time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, - time->tm_hour, time->tm_min, time->tm_sec); - zip_set_archive_comment(zip, comment.data(), comment.size()); - - if(backup_builds) { - for(std::uint8_t i = 0; i < 32; ++i) { - auto build_filename = Utility::format("{}Unit{:.2d}{}.sav", - profile.isDemo() ? "Demo"_s : ""_s, i, - profile.account()); - - if(!Utility::Path::exists(Utility::Path::join(_saveDirectory, build_filename))) { - continue; - } - - zip_source_t* build_source = zip_source_file(zip, Utility::Path::toNativeSeparators(Utility::Path::join(_saveDirectory, build_filename)).data(), 0, 0); - if(build_source == nullptr) { - zip_source_free(build_source); - continue; - } - - if(zip_file_add(zip, build_filename.data(), build_source, ZIP_FL_ENC_UTF_8) == -1) { - zip_source_free(build_source); - continue; - } - } - } - - if(zip_close(zip) == -1) { - _lastError = zip_strerror(zip); - LOG_ERROR(_lastError); - return false; - } - - refreshBackups(); - - return true; -} - -Containers::ArrayView -ProfileManager::backups() { - return _backups; -} - -void -ProfileManager::refreshBackups() { - _backups = Containers::Array{}; - - using Utility::Path::ListFlag; - auto files = Utility::Path::list(_backupsDirectory, - ListFlag::SkipSpecial|ListFlag::SkipDirectories|ListFlag::SkipDotAndDotDot); - - if(!files) { - _lastError = _backupsDirectory + " can't be opened."; - LOG_ERROR(_lastError); - return; - } - - auto predicate = [](Containers::StringView file)->bool{ - return !(file.hasSuffix(".mbprofbackup"_s) || file.hasSuffix(".backup.mbst")); - }; - - auto files_view = files->exceptSuffix(files->end() - std::remove_if(files->begin(), files->end(), predicate)); - - int error_code = 0; - zip_t* zip; - for(Containers::StringView file : files_view) { - Backup backup; - backup.filename = file; - - zip = zip_open(Utility::Path::join(_backupsDirectory, file).data(), ZIP_RDONLY, &error_code); - if(zip == nullptr) { - continue; - } - - Containers::ScopeGuard guard{zip, zip_close}; - - auto num_entries = zip_get_num_entries(zip, ZIP_FL_UNCHANGED); - - if(num_entries == 0) { - continue; - } - - int comment_length; - Containers::StringView comment = zip_get_archive_comment(zip, &comment_length, ZIP_FL_UNCHANGED); - if(comment == nullptr) { - continue; - } - - auto info = comment.split('|'); - - if(info.size() != 3) { - continue; - } - - backup.company = info[0]; - - if(info[1].hasPrefix("full")) { - backup.demo = false; - } - else if(info[1].hasPrefix("demo")) { - backup.demo = true; - } - else { - continue; - } - - auto ts = info[2].split('-'); - if(ts.size() != 6) { - continue; - } - - backup.timestamp.year = std::strtol(ts[0].data(), nullptr, 10); - backup.timestamp.month = std::strtol(ts[1].data(), nullptr, 10); - backup.timestamp.day = std::strtol(ts[2].data(), nullptr, 10); - backup.timestamp.hour = std::strtol(ts[3].data(), nullptr, 10); - backup.timestamp.minute = std::strtol(ts[4].data(), nullptr, 10); - backup.timestamp.second = std::strtol(ts[5].data(), nullptr, 10); - - arrayReserve(backup.includedFiles, num_entries); - - for(auto i = 0; i < num_entries; i++) { - arrayAppend(backup.includedFiles, InPlaceInit, zip_get_name(zip, i, ZIP_FL_UNCHANGED)); - } - - arrayAppend(_backups, Utility::move(backup)); - } -} - -bool -ProfileManager::deleteBackup(std::size_t index) { - if(!Utility::Path::remove(Utility::Path::join(_backupsDirectory, _backups[index].filename))) { - _lastError = "Couldn't delete " + _backups[index].filename; - LOG_ERROR(_lastError); - return false; - } - - auto file = _backups[index].filename; - auto it = std::remove_if(_backups.begin(), _backups.end(), [&file](Backup& backup){return backup.filename == file;}); - - if(it != _backups.end()) { - arrayRemoveSuffix(_backups, 1); - } - - return true; -} - -bool -ProfileManager::restoreBackup(std::size_t index) { - const Backup& backup = _backups[index]; - - auto error_format = "Extraction of file {} failed: {}"_s; - - int error_code = 0; - zip_t* zip; - - zip = zip_open(Utility::Path::join(_backupsDirectory, backup.filename).data(), ZIP_RDONLY, &error_code); - if(zip == nullptr) { - zip_error_t error; - zip_error_init_with_code(&error, error_code); - _lastError = zip_error_strerror(&error); - LOG_ERROR(_lastError); - return false; - } - - Containers::ScopeGuard zip_guard{zip, zip_close}; - - for(Containers::StringView file : backup.includedFiles) { - FILE* out = std::fopen(Utility::Path::join(_saveDirectory, file).data(), "wb"); - if(out == nullptr) { - _lastError = Utility::format(error_format.data(), file, std::strerror(errno)); - LOG_ERROR(_lastError); - return false; - } - - Containers::ScopeGuard out_guard{out, std::fclose}; - - zip_file_t* zf = zip_fopen(zip, file.data(), ZIP_FL_ENC_GUESS); - if(zf == nullptr) { - _lastError = Utility::format(error_format.data(), file, zip_strerror(zip)); - LOG_ERROR(_lastError); - return false; - } - - Containers::ScopeGuard zf_guard{zf, zip_fclose}; - - Containers::StaticArray<8192, char> buf{ValueInit}; - - std::int64_t bytes_read; - while((bytes_read = zip_fread(zf, buf.data(), buf.size())) > 0ll) { - if(std::fwrite(buf.data(), sizeof(char), bytes_read, out) < static_cast(bytes_read)) { - _lastError = Utility::format(error_format.data(), file, "not enough bytes written."); - LOG_ERROR(_lastError); - return false; - } - } - - if(bytes_read == -1) { - _lastError = Utility::format(error_format.data(), file, "couldn't read bytes from archive."); - LOG_ERROR(_lastError); - return false; - } - } - - return true; -} - }} diff --git a/src/Managers/ProfileManager.h b/src/Managers/ProfileManager.h index d1bbb7e..6116518 100644 --- a/src/Managers/ProfileManager.h +++ b/src/Managers/ProfileManager.h @@ -29,24 +29,9 @@ using namespace Corrade; namespace mbst { namespace Managers { -struct Backup { - Containers::String filename; - Containers::String company; - bool demo; - struct { - std::int32_t year; - std::int32_t month; - std::int32_t day; - std::int32_t hour; - std::int32_t minute; - std::int32_t second; - } timestamp; - Containers::Array includedFiles; -}; - class ProfileManager { public: - explicit ProfileManager(Containers::StringView save_dir, Containers::StringView backup_dir); + explicit ProfileManager(); auto ready() const -> bool; auto lastError() -> Containers::StringView; @@ -56,23 +41,12 @@ class ProfileManager { auto getProfile(std::size_t index) -> GameObjects::Profile*; bool deleteProfile(std::size_t index, bool delete_builds); - bool backupProfile(std::size_t index, bool backup_builds); - - auto backups() -> Containers::ArrayView; - void refreshBackups(); - - bool deleteBackup(std::size_t index); - bool restoreBackup(std::size_t index); private: bool _ready = false; Containers::String _lastError; - Containers::StringView _saveDirectory; - Containers::StringView _backupsDirectory; - Containers::Array _profiles; - Containers::Array _backups; }; }} -- 2.39.5 From 661f6acd120838b5447d322455ca2cdbb62aac17 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 8 Apr 2024 11:17:48 +0200 Subject: [PATCH 089/126] Managers: cleanup includes and add an assert. --- src/Managers/ProfileManager.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Managers/ProfileManager.cpp b/src/Managers/ProfileManager.cpp index aab1024..85c1784 100644 --- a/src/Managers/ProfileManager.cpp +++ b/src/Managers/ProfileManager.cpp @@ -14,10 +14,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include - #include -#include #include #include @@ -25,8 +22,6 @@ #include #include -#include - #include "../Configuration/Configuration.h" #include "../Logger/Logger.h" @@ -103,6 +98,8 @@ ProfileManager::getProfile(std::size_t index) { bool ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { + CORRADE_INTERNAL_ASSERT(index < _profiles.size()); + if(!Utility::Path::remove(Utility::Path::join(conf().directories().gameSaves, _profiles[index].filename()))) { _lastError = Utility::format("Couldn't delete {} (filename: {}).", _profiles[index].companyName(), -- 2.39.5 From e10e457ad820339eddb25fe57f3060033aec426d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Tue, 9 Apr 2024 00:39:35 +0200 Subject: [PATCH 090/126] Managers: simplify MassManager. --- .../Application_Initialisation.cpp | 3 +- src/Managers/MassManager.cpp | 38 ++++++++++--------- src/Managers/MassManager.h | 5 +-- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 1c96fbf..51acb98 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -125,8 +125,7 @@ Application::initialiseManager() { void Application::initialiseMassManager() { LOG_INFO("Initialising the M.A.S.S. manager."); - _massManager.emplace(conf().directories().gameSaves, _currentProfile->account(), _currentProfile->isDemo(), - conf().directories().staging); + _massManager.emplace(_currentProfile->account(), _currentProfile->isDemo()); } void diff --git a/src/Managers/MassManager.cpp b/src/Managers/MassManager.cpp index 1947711..eeb6f8d 100644 --- a/src/Managers/MassManager.cpp +++ b/src/Managers/MassManager.cpp @@ -19,6 +19,7 @@ #include #include +#include "../Configuration/Configuration.h" #include "../Logger/Logger.h" #include "MassManager.h" @@ -27,13 +28,12 @@ using namespace Containers::Literals; namespace mbst { namespace Managers { -MassManager::MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, - Containers::StringView staging_dir): - _saveDirectory{save_path}, _account{account}, _demo{demo}, _stagingAreaDirectory{staging_dir} +MassManager::MassManager(Containers::StringView account, bool demo): + _account{account}, _demo{demo} { Containers::String mass_filename = ""; for(std::uint32_t i = 0; i < _hangars.size(); i++) { - mass_filename = Utility::Path::join(_saveDirectory, + mass_filename = Utility::Path::join(conf().directories().gameSaves, Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account)); new(&_hangars[i]) GameObjects::Mass{mass_filename}; } @@ -60,7 +60,7 @@ MassManager::refreshHangar(std::int32_t hangar) { } Containers::String mass_filename = - Utility::Path::join(_saveDirectory, + Utility::Path::join(conf().directories().gameSaves, Utility::format("{}Unit{:.2d}{}.sav", _demo ? "Demo" : "", hangar, _account)); _hangars[hangar] = GameObjects::Mass{mass_filename}; } @@ -81,7 +81,7 @@ MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { return false; } - Containers::String source = Utility::Path::join(_stagingAreaDirectory, staged_fn); + Containers::String source = Utility::Path::join(conf().directories().staging, staged_fn); Utility::Path::copy(source, source + ".tmp"_s); { @@ -93,7 +93,7 @@ MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { } } - Containers::String dest = Utility::Path::join(_saveDirectory, _hangars[hangar].filename()); + Containers::String dest = Utility::Path::join(conf().directories().gameSaves, _hangars[hangar].filename()); if(Utility::Path::exists(dest)) { Utility::Path::remove(dest); @@ -122,8 +122,8 @@ MassManager::exportMass(std::int32_t hangar) { return false; } - Containers::String source = Utility::Path::join(_saveDirectory, _hangars[hangar].filename()); - Containers::String dest = Utility::Path::join(_stagingAreaDirectory, + Containers::String source = Utility::Path::join(conf().directories().gameSaves, _hangars[hangar].filename()); + Containers::String dest = Utility::Path::join(conf().directories().staging, Utility::format("{}_{}.sav", _hangars[hangar].name(), _account)); if(!Utility::Path::copy(source, dest)) { @@ -149,8 +149,10 @@ MassManager::moveMass(std::int32_t source, std::int32_t destination) { return false; } - Containers::String source_file = Utility::Path::join(_saveDirectory, _hangars[source].filename()); - Containers::String dest_file = Utility::Path::join(_saveDirectory, _hangars[destination].filename()); + Containers::String source_file = Utility::Path::join(conf().directories().gameSaves, + _hangars[source].filename()); + Containers::String dest_file = Utility::Path::join(conf().directories().gameSaves, + _hangars[destination].filename()); GameObjects::Mass::State dest_state = _hangars[destination].state(); switch(dest_state) { @@ -181,7 +183,7 @@ MassManager::deleteMass(std::int32_t hangar) { return false; } - if(!Utility::Path::remove(Utility::Path::join(_saveDirectory, _hangars[hangar].filename()))) { + if(!Utility::Path::remove(Utility::Path::join(conf().directories().gameSaves, _hangars[hangar].filename()))) { _lastError = Utility::format("Deletion failed: {}", std::strerror(errno)); LOG_ERROR(_lastError); return false; @@ -200,11 +202,11 @@ MassManager::refreshStagedMasses() { _stagedMasses.clear(); using Utility::Path::ListFlag; - auto file_list = Utility::Path::list(_stagingAreaDirectory, + auto file_list = Utility::Path::list(conf().directories().staging, ListFlag::SkipSpecial|ListFlag::SkipDirectories|ListFlag::SkipDotAndDotDot); if(!file_list) { - LOG_ERROR_FORMAT("{} couldn't be opened.", _stagingAreaDirectory); + LOG_ERROR_FORMAT("{} couldn't be opened.", conf().directories().staging); return; } @@ -216,7 +218,7 @@ MassManager::refreshStagedMasses() { LOG_INFO("Scanning for staged M.A.S.S.es..."); for(Containers::StringView file : list_view) { - auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, file)); + auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(conf().directories().staging, file)); if(name) { LOG_INFO_FORMAT("Found staged M.A.S.S.: {}", *name); @@ -232,11 +234,11 @@ void MassManager::refreshStagedMass(Containers::StringView filename) { LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); - bool file_exists = Utility::Path::exists(Utility::Path::join(_stagingAreaDirectory, filename)); + bool file_exists = Utility::Path::exists(Utility::Path::join(conf().directories().staging, filename)); auto it = _stagedMasses.find(filename); if(file_exists) { - auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(_stagingAreaDirectory, filename)); + auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(conf().directories().staging, filename)); if(name) { _stagedMasses[filename] = *name; } @@ -257,7 +259,7 @@ MassManager::deleteStagedMass(Containers::StringView filename) { return false; } - if(!Utility::Path::remove(Utility::Path::join(_stagingAreaDirectory, filename))) { + if(!Utility::Path::remove(Utility::Path::join(conf().directories().staging, filename))) { _lastError = filename + " couldn't be deleted: " + std::strerror(errno); LOG_ERROR(_lastError); return false; diff --git a/src/Managers/MassManager.h b/src/Managers/MassManager.h index 7ebf8f8..d4e8b71 100644 --- a/src/Managers/MassManager.h +++ b/src/Managers/MassManager.h @@ -30,7 +30,7 @@ namespace mbst { namespace Managers { class MassManager { public: - MassManager(Containers::StringView save_path, Containers::StringView account, bool demo, Containers::StringView staging_dir); + MassManager(Containers::StringView account, bool demo); auto lastError() -> Containers::StringView; @@ -50,7 +50,6 @@ class MassManager { bool deleteStagedMass(Containers::StringView filename); private: - Containers::StringView _saveDirectory; Containers::StringView _account; bool _demo; @@ -58,8 +57,6 @@ class MassManager { Containers::StaticArray<32, GameObjects::Mass> _hangars{NoInit}; - Containers::StringView _stagingAreaDirectory; - std::map _stagedMasses; }; -- 2.39.5 From 2f70aa767260097c198b582b3fde9558472233b5 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Apr 2024 10:25:23 +0200 Subject: [PATCH 091/126] Application: minor style changes. --- src/Application/Application.cpp | 6 +++--- src/Application/Application_FileWatcher.cpp | 7 ++----- src/Application/Application_Initialisation.cpp | 7 +++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 01764aa..33f67d0 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -130,7 +130,7 @@ Application::Application(const Arguments& arguments): } if(conf().skipDisclaimer()) { - _uiState = UiState::Initialising; + _uiState = UiState::Initialising; _initThread = std::thread{[this]{ initialiseManager(); }}; } @@ -174,7 +174,7 @@ void Application::viewportEvent(ViewportEvent& event) { GL::defaultFramebuffer.setViewport({{}, event.framebufferSize()}); - const Vector2 size = Vector2{windowSize()}/dpiScaling(); + const auto size = Vector2{windowSize()}/dpiScaling(); _imgui.relayout(size, windowSize(), framebufferSize()); } @@ -347,7 +347,7 @@ Application::drawDisclaimer() { ImGui::TableSetColumnIndex(1); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {24.0f, 12.0f}); if(ImGui::Button("I understand the risks")) { - _uiState = UiState::Initialising; + _uiState = UiState::Initialising; _initThread = std::thread{[this]{ initialiseManager(); }}; } ImGui::PopStyleVar(); diff --git a/src/Application/Application_FileWatcher.cpp b/src/Application/Application_FileWatcher.cpp index 5dfdf8d..d5cf9a4 100644 --- a/src/Application/Application_FileWatcher.cpp +++ b/src/Application/Application_FileWatcher.cpp @@ -29,11 +29,8 @@ namespace mbst { void -Application::handleFileAction(efsw::WatchID watch_id, - const std::string&, - const std::string& filename, - efsw::Action action, - std::string old_filename) +Application::handleFileAction(efsw::WatchID watch_id, const std::string&, const std::string& filename, + efsw::Action action, std::string old_filename) { SDL_Event event; SDL_zero(event); diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 51acb98..0e525ae 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -58,8 +58,7 @@ Application::initialiseGui() { LOG_INFO("Initialising Dear ImGui."); auto ctx = ImGui::CreateContext(); - - ImGuiIO& io = ImGui::GetIO(); + auto& io = ImGui::GetIO(); const auto size = Vector2{windowSize()}/dpiScaling(); @@ -94,10 +93,10 @@ Application::initialiseGui() { io.IniFilename = nullptr; - ImGuiStyle& style = ImGui::GetStyle(); + auto& style = ImGui::GetStyle(); style.WindowTitleAlign = {0.5f, 0.5f}; - style.FrameRounding = 3.2f; + style.FrameRounding = 3.2f; style.Colors[ImGuiCol_WindowBg] = ImColor(0xff1f1f1f); } -- 2.39.5 From 555cfcaadd4fca13d0c8863ccd1a2a04299a8f31 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Apr 2024 10:29:05 +0200 Subject: [PATCH 092/126] Application: add initial UI for style import/export. --- src/Application/Application_MassViewer.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index d17c259..1cda5f6 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -333,6 +333,18 @@ Application::drawCustomStyle(GameObjects::CustomStyle& style) { style.name = name_buf.data(); } + if(ImGui::SmallButton(ICON_FA_FILE_EXPORT " Export")) { + if(!ImportExport::exportStyle(_currentMass->name(), style)) { + _queue.addToast(Toast::Type::Error, ImportExport::lastExportError()); + } + else { + _queue.addToast(Toast::Type::Success, "Style exported successfully."); + } + } + if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_FILE_IMPORT " Import")) { + // TODO: implement once the style manager is ready. + } + ImGui::EndMenuBar(); } -- 2.39.5 From fd367619e2624028871d8472431043efc8db03e6 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Apr 2024 10:29:49 +0200 Subject: [PATCH 093/126] Application: add a TODO for later. --- src/Application/Application_MainManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index a05770a..eb7118b 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -521,6 +521,7 @@ Application::drawMassManager() { drawDeleteMassPopup(mass_to_delete); + // TODO: fix this shit, like with the profile manager. static ImGuiID staged_mass_deletion_popup_ID = drawDeleteStagedMassPopup(""); static Containers::StringView staged_mass_to_delete; -- 2.39.5 From 028d991b74fb75547ea3f37ebdd7c5423c786724 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Apr 2024 10:44:46 +0200 Subject: [PATCH 094/126] CMakeLists: change a condition to be more reliable. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c260e84..66f0c4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,12 +30,12 @@ cmake_dependent_option(SAVETOOL_USE_SYSTEM_LIBZIP "Use a system-wide version of cmake_dependent_option(SAVETOOL_USE_SYSTEM_EFSW "Use a system-wide version of EFSW." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) cmake_dependent_option(SAVETOOL_USE_SYSTEM_LIBCURL "Use a system-wide version of libcurl." ON "SAVETOOL_USE_SYSTEM_LIBS" OFF) -if(NOT SAVETOOL_USE_SYSTEM_LIBS) +if(NOT SAVETOOL_USE_SYSTEM_LIBS OR NOT (SAVETOOL_USE_SYSTEM_CORRADE_MAGNUM AND SAVETOOL_USE_SYSTEM_SDL2 AND SAVETOOL_USE_SYSTEM_LIBZIP AND SAVETOOL_USE_SYSTEM_EFSW AND SAVETOOL_USE_SYSTEM_LIBCURL)) # Generic variables shared by multiple libs that don't provide their own. set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) set(BUILD_STATIC_LIBS ON CACHE BOOL "" FORCE) set(BUILD_TESTING OFF CACHE BOOL "" FORCE) -endif(NOT SAVETOOL_USE_SYSTEM_LIBS) +endif() if(NOT SAVETOOL_USE_SYSTEM_SDL2) set(DIRECTX OFF CACHE BOOL "" FORCE) # We use OpenGL. -- 2.39.5 From b9fe38782d0df73e101276e33ed4f9a51431421c Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Apr 2024 18:30:39 +0200 Subject: [PATCH 095/126] Configuration: avoid a deadlock. --- src/Configuration/Configuration.cpp | 4 ---- src/main.cpp | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Configuration/Configuration.cpp b/src/Configuration/Configuration.cpp index 01d256b..f2c8887 100644 --- a/src/Configuration/Configuration.cpp +++ b/src/Configuration/Configuration.cpp @@ -25,7 +25,6 @@ #include #include "../Logger/Logger.h" -#include "../Utilities/Temp.h" #include "Configuration.h" @@ -169,9 +168,6 @@ Configuration::Configuration() { return; } } - else { - Utilities::emptyTempDir(); - } _valid = true; } diff --git a/src/main.cpp b/src/main.cpp index 14142cb..89d3227 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,9 +22,10 @@ #include #include +#include "Application/Application.h" #include "Configuration/Configuration.h" #include "Logger/MagnumLogBuffer.h" -#include "Application/Application.h" +#include "Utilities/Temp.h" int main(int argc, char** argv) { MagnumLogBuffer debug_intercept_buffer{EntryType::Info}; @@ -48,6 +49,8 @@ int main(int argc, char** argv) { return EXIT_FAILURE; } + mbst::Utilities::emptyTempDir(); + auto str = setlocale(LC_ALL, ".utf-8"); if(str) { Containers::StringView locale{str}; -- 2.39.5 From f2a021cd78716712a4834e02de1590c7b13ed111 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Tue, 16 Apr 2024 15:41:02 +0200 Subject: [PATCH 096/126] Application: improve the M.A.S.S. manager. --- src/Application/Application.h | 4 +-- src/Application/Application_MainManager.cpp | 32 +++++++++------------ 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index 49c74ce..4a6a1c8 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -127,8 +127,8 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawMaterialRow(Containers::StringView name, std::int32_t tier, GameData::MaterialID id); void drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier); void drawMassManager(); - auto drawDeleteMassPopup(int mass_index) -> ImGuiID; - auto drawDeleteStagedMassPopup(Containers::StringView filename) -> ImGuiID; + void drawDeleteMassPopup(int mass_index); + void drawDeleteStagedMassPopup(Containers::StringView filename); void drawMassViewer(); void drawFrameInfo(); diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index eb7118b..ba55ea8 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -16,6 +16,7 @@ #include +#include #include #include @@ -399,7 +400,6 @@ Application::drawMassManager() { } static int mass_to_delete = 0; - static ImGuiID mass_deletion_popup_ID = drawDeleteMassPopup(mass_to_delete); if(ImGui::BeginTable("##HangarsTable", 4, ImGuiTableFlags_BordersOuter|ImGuiTableFlags_RowBg|ImGuiTableFlags_ScrollY, @@ -509,9 +509,10 @@ Application::drawMassManager() { ImGui::SameLine(0.0f, 2.0f); if(drawUnsafeWidget(ImGui::SmallButton, ICON_FA_TRASH_ALT)) { mass_to_delete = i; - ImGui::OpenPopup(mass_deletion_popup_ID); + ImGui::OpenPopup("Confirmation##DeleteMassConfirmation"); } drawTooltip("Delete"); + drawDeleteMassPopup(mass_to_delete); ImGui::PopID(); } } @@ -521,8 +522,6 @@ Application::drawMassManager() { drawDeleteMassPopup(mass_to_delete); - // TODO: fix this shit, like with the profile manager. - static ImGuiID staged_mass_deletion_popup_ID = drawDeleteStagedMassPopup(""); static Containers::StringView staged_mass_to_delete; if(ImGui::BeginTable("##StagingArea", 2, @@ -562,9 +561,10 @@ Application::drawMassManager() { ImGui::PushID(pair.first.data()); if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { staged_mass_to_delete = pair.first; - ImGui::OpenPopup(staged_mass_deletion_popup_ID); + ImGui::OpenPopup("Confirmation##DeleteStagedMassConfirmation"); } drawTooltip("Delete"); + drawDeleteStagedMassPopup(staged_mass_to_delete); ImGui::PopID(); } @@ -592,24 +592,24 @@ Application::drawMassManager() { drawDeleteStagedMassPopup(staged_mass_to_delete); } -ImGuiID +void Application::drawDeleteMassPopup(int mass_index) { if(!ImGui::BeginPopupModal("Confirmation##DeleteMassConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { - return ImGui::GetID("Confirmation##DeleteMassConfirmation"); + return; } + Containers::ScopeGuard guard{ImGui::EndPopup}; + if(_massManager->hangar(mass_index).state() == GameObjects::Mass::State::Empty) { ImGui::CloseCurrentPopup(); - ImGui::EndPopup(); - return 0; + return; } if(_gameState != GameState::NotRunning) { ImGui::CloseCurrentPopup(); - ImGui::EndPopup(); - return 0; + return; } ImGui::PushTextWrapPos(float(windowSize().x()) * 0.40f); @@ -643,18 +643,14 @@ Application::drawDeleteMassPopup(int mass_index) { ImGui::EndTable(); } - - ImGui::EndPopup(); - - return 0; } -ImGuiID +void Application::drawDeleteStagedMassPopup(Containers::StringView filename) { if(!ImGui::BeginPopupModal("Confirmation##DeleteStagedMassConfirmation", nullptr, ImGuiWindowFlags_AlwaysAutoResize|ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove)) { - return ImGui::GetID("Confirmation##DeleteStagedMassConfirmation"); + return; } ImGui::PushTextWrapPos(float(windowSize().x()) * 0.40f); @@ -684,8 +680,6 @@ Application::drawDeleteStagedMassPopup(Containers::StringView filename) { } ImGui::EndPopup(); - - return 0; } } -- 2.39.5 From 902e31e160ca493e7bdf701953e90c384f1c7ed8 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 18 Apr 2024 18:05:41 +0200 Subject: [PATCH 097/126] Managers: make BackupManager constructor explicit. --- src/Managers/BackupManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Managers/BackupManager.h b/src/Managers/BackupManager.h index f165f23..bc6a438 100644 --- a/src/Managers/BackupManager.h +++ b/src/Managers/BackupManager.h @@ -32,7 +32,7 @@ namespace mbst { namespace Managers { class BackupManager { public: - BackupManager(); + explicit BackupManager(); auto lastError() -> Containers::StringView; -- 2.39.5 From ccbafe5e302cd24f37e76eebaee4433addc53d97 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Tue, 23 Apr 2024 21:26:26 +0200 Subject: [PATCH 098/126] Managers: make BackupManager::scanSubdir() actually work. --- src/Managers/BackupManager.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp index a455e49..8187f0f 100644 --- a/src/Managers/BackupManager.cpp +++ b/src/Managers/BackupManager.cpp @@ -225,10 +225,12 @@ void BackupManager::scanSubdir(Containers::StringView subdir) { static std::uint8_t depth = 0; + auto full_subdir = Utility::Path::join(conf().directories().backups, subdir); + using Flag = Utility::Path::ListFlag; - auto files = Utility::Path::list(conf().directories().backups, Flag::SkipDirectories|Flag::SkipSpecial); + auto files = Utility::Path::list(full_subdir, Flag::SkipDirectories|Flag::SkipSpecial); if(!files) { - LOG_ERROR_FORMAT("Couldn't list contents of {}.", conf().directories().backups); + LOG_ERROR_FORMAT("Couldn't list contents of {}.", full_subdir); } auto predicate = [](Containers::StringView file)->bool{ @@ -241,9 +243,9 @@ BackupManager::scanSubdir(Containers::StringView subdir) { zip_t* zip; for(Containers::StringView file : files_view) { Backup backup; - backup.filename = Utility::Path::join(subdir, file); + backup.filename = Utility::Path::join(full_subdir, file); - zip = zip_open(Utility::Path::join(conf().directories().backups, file).data(), ZIP_RDONLY, &error_code); + zip = zip_open(backup.filename.cbegin(), ZIP_RDONLY, &error_code); if(zip == nullptr) { continue; } @@ -301,16 +303,15 @@ BackupManager::scanSubdir(Containers::StringView subdir) { arrayAppend(_backups, Utility::move(backup)); } - auto subdirs = Utility::Path::list(conf().directories().backups, - Flag::SkipFiles|Flag::SkipSpecial|Flag::SkipDotAndDotDot); - if(!subdirs) { - LOG_ERROR_FORMAT("Couldn't list contents of {}.", conf().directories().backups); - } - if(depth == 5) { return; } + auto subdirs = Utility::Path::list(full_subdir, Flag::SkipFiles|Flag::SkipSpecial|Flag::SkipDotAndDotDot); + if(!subdirs) { + LOG_ERROR_FORMAT("Couldn't list contents of {}.", full_subdir); + } + depth++; for(auto& dir : *subdirs) { -- 2.39.5 From 9f570a004b6ed5f6a3a01ea8d8303825b71d3b05 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 11 Jul 2024 18:06:08 +0200 Subject: [PATCH 099/126] Managers: prepare BackupManager for the upcoming VFS. --- src/Managers/BackupManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp index 8187f0f..6250433 100644 --- a/src/Managers/BackupManager.cpp +++ b/src/Managers/BackupManager.cpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -243,9 +244,11 @@ BackupManager::scanSubdir(Containers::StringView subdir) { zip_t* zip; for(Containers::StringView file : files_view) { Backup backup; - backup.filename = Utility::Path::join(full_subdir, file); + backup.filename = Utility::Path::join(subdir, file); - zip = zip_open(backup.filename.cbegin(), ZIP_RDONLY, &error_code); + auto full_path = Utility::Path::join(full_subdir, file); + + zip = zip_open(full_path.cbegin(), ZIP_RDONLY, &error_code); if(zip == nullptr) { continue; } -- 2.39.5 From 79e2ff38c5b4b72294c3358f18dc812a574741de Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 11 Jul 2024 18:06:57 +0200 Subject: [PATCH 100/126] Update Corrade, Magnum, ImGui. --- third-party/corrade | 2 +- third-party/imgui | 2 +- third-party/magnum | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/third-party/corrade b/third-party/corrade index 295bbba..f966f91 160000 --- a/third-party/corrade +++ b/third-party/corrade @@ -1 +1 @@ -Subproject commit 295bbba1f49887da060465f88b8501965f6acd7d +Subproject commit f966f918bd7dec95002921227b6bd68ccbdda113 diff --git a/third-party/imgui b/third-party/imgui index 4f9ba19..a8e96ae 160000 --- a/third-party/imgui +++ b/third-party/imgui @@ -1 +1 @@ -Subproject commit 4f9ba19e520bea478f5cb654d37ef45e6404bd52 +Subproject commit a8e96ae21a4ec10e5f02b19dd865dfffe8a98e67 diff --git a/third-party/magnum b/third-party/magnum index 8538610..a40020f 160000 --- a/third-party/magnum +++ b/third-party/magnum @@ -1 +1 @@ -Subproject commit 8538610fa27e1db37070eaabe34f1e4e41648bab +Subproject commit a40020f3fff91dc9c59148f52adb0d48203799eb -- 2.39.5 From e11fa34c097e8884b708b981d965508b0dc1cfd5 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Thu, 11 Jul 2024 19:48:02 +0200 Subject: [PATCH 101/126] Managers: add a VFS to help with #36. --- src/CMakeLists.txt | 2 + src/Managers/Vfs/VfsDirectory.h | 88 ++++++++++++++++++++++++++++ src/Managers/Vfs/VirtualFileSystem.h | 47 +++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 src/Managers/Vfs/VfsDirectory.h create mode 100644 src/Managers/Vfs/VirtualFileSystem.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 89f4ac5..2523730 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,6 +199,8 @@ add_executable(MassBuilderSaveTool Managers/MassManager.cpp Managers/ProfileManager.h Managers/ProfileManager.cpp + Managers/Vfs/VirtualFileSystem.h + Managers/Vfs/VfsDirectory.h Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherSockets.hpp diff --git a/src/Managers/Vfs/VfsDirectory.h b/src/Managers/Vfs/VfsDirectory.h new file mode 100644 index 0000000..e0c203f --- /dev/null +++ b/src/Managers/Vfs/VfsDirectory.h @@ -0,0 +1,88 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include + +using namespace Corrade; + +namespace mbst { namespace Managers { namespace Vfs { + +CORRADE_HAS_TYPE(HasFilename, decltype(T::filename)); + +template +class VfsDirectory { + public: + static_assert(HasFilename::value && (std::is_same::value || std::is_same::value), + "FileType has no string-like member named filename."); + + using DirType = VfsDirectory; + + explicit VfsDirectory(Containers::StringView name): _name{name} { + // ctor + } + + VfsDirectory(const VfsDirectory& other) = delete; + VfsDirectory& operator=(const VfsDirectory& other) = delete; + + VfsDirectory(VfsDirectory&& other) = default; + VfsDirectory& operator=(VfsDirectory&& other) = default; + + auto name() const -> Containers::StringView { + return _name; + } + + auto subdirs() const -> Containers::ArrayView { + return _subdirs; + } + + auto files() const -> Containers::ArrayView { + return _files; + } + + protected: + void buildNestedPath(VfsDirectory& root, Containers::ArrayView components, + FileType& file) + { + if(components.size() > 1) { + bool found = false; + for(auto& subdir : root._subdirs) { + if(subdir._name == components[0]) { + found = true; + buildNestedPath(subdir, components.exceptPrefix(1), file); + break; + } + } + + if(!found) { + arrayAppend(root._subdirs, InPlaceInit, components[0]); + buildNestedPath(root._subdirs.back(), components.exceptPrefix(1), file); + } + } + else if(components.size() == 1) { + arrayAppend(root._files, &file); + } + } + + Containers::String _name; + Containers::Array _subdirs; + Containers::Array _files; +}; + +}}} diff --git a/src/Managers/Vfs/VirtualFileSystem.h b/src/Managers/Vfs/VirtualFileSystem.h new file mode 100644 index 0000000..0f3333c --- /dev/null +++ b/src/Managers/Vfs/VirtualFileSystem.h @@ -0,0 +1,47 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include "VfsDirectory.h" + +namespace mbst { namespace Managers { namespace Vfs { + +template +class VirtualFileSystem: public VfsDirectory { + public: + explicit VirtualFileSystem(): + VfsDirectory("") + { + // ctor + } + explicit VirtualFileSystem(Containers::ArrayView files): + VfsDirectory("") + { + build(files); + } + + void build(Containers::ArrayView files) { + for(auto& file : files) { + auto components = file.filename.split('/'); + CORRADE_INTERNAL_ASSERT(components.size() == 0); + + VfsDirectory::buildNestedPath(*this, components, file); + } + } +}; + +}}} -- 2.39.5 From e10a2df906c29f5bc8966811036c4f3381820624 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 12 Jul 2024 11:37:47 +0200 Subject: [PATCH 102/126] Managers: add a VFS to BackupManager. Crashes at runtime. Needs debugging. --- src/Managers/BackupManager.cpp | 12 +++++++++++- src/Managers/BackupManager.h | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp index 6250433..b5922bc 100644 --- a/src/Managers/BackupManager.cpp +++ b/src/Managers/BackupManager.cpp @@ -35,7 +35,9 @@ namespace mbst { namespace Managers { -BackupManager::BackupManager() { +BackupManager::BackupManager(): + _vfs() +{ refresh(); } @@ -49,6 +51,8 @@ BackupManager::refresh() { _backups = Containers::Array{}; scanSubdir(""_s); + + _vfs.build(_backups); } Containers::ArrayView @@ -56,6 +60,12 @@ BackupManager::backups() const { return _backups; } +const Vfs::VirtualFileSystem& +BackupManager::vfs() const +{ + return _vfs; +} + bool BackupManager::create(const GameObjects::Profile& profile) { if(!profile.valid()) { diff --git a/src/Managers/BackupManager.h b/src/Managers/BackupManager.h index bc6a438..938f88e 100644 --- a/src/Managers/BackupManager.h +++ b/src/Managers/BackupManager.h @@ -25,6 +25,7 @@ #include "Backup.h" #include "../GameObjects/Profile.h" +#include "Vfs/VirtualFileSystem.h" using namespace Corrade; @@ -40,6 +41,8 @@ class BackupManager { auto backups() const -> Containers::ArrayView; + auto vfs() const -> const Vfs::VirtualFileSystem&; + bool create(const GameObjects::Profile& profile); bool remove(std::size_t index); bool restore(std::size_t index); @@ -50,6 +53,8 @@ class BackupManager { Containers::String _lastError; Containers::Array _backups; + + Vfs::VirtualFileSystem _vfs; }; }} -- 2.39.5 From b8584f26bbf5323a46215bab3b0a7565167fb6a1 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 12 Jul 2024 12:46:25 +0200 Subject: [PATCH 103/126] Update libzip. This fixes a compilation issue with MinGW-w64 on MSYS2. Probably MinGW-w64 on Linux too, but I haven't checked yet. --- third-party/libzip | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/libzip b/third-party/libzip index f0eff80..aa90b70 160000 --- a/third-party/libzip +++ b/third-party/libzip @@ -1 +1 @@ -Subproject commit f0eff80889f1b0791e91516d2d84e8d5b84a1e02 +Subproject commit aa90b70e552709316cd2144837c3dd13b5fa1ec3 -- 2.39.5 From 03cbb7f8ae84cfbe4be64e230c40837f46eaa841 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 12 Jul 2024 14:12:35 +0200 Subject: [PATCH 104/126] Managers: invert an assert condition. Somehow, it made the app crash _only_ in release mode, while debug was unaffected. --- src/Managers/Vfs/VirtualFileSystem.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Managers/Vfs/VirtualFileSystem.h b/src/Managers/Vfs/VirtualFileSystem.h index 0f3333c..a9e227e 100644 --- a/src/Managers/Vfs/VirtualFileSystem.h +++ b/src/Managers/Vfs/VirtualFileSystem.h @@ -37,7 +37,7 @@ class VirtualFileSystem: public VfsDirectory { void build(Containers::ArrayView files) { for(auto& file : files) { auto components = file.filename.split('/'); - CORRADE_INTERNAL_ASSERT(components.size() == 0); + CORRADE_INTERNAL_ASSERT(components.size() != 0); VfsDirectory::buildNestedPath(*this, components, file); } -- 2.39.5 From e9a356fa214b02b0bfd435a40641431c5c154e30 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 12 Jul 2024 15:03:39 +0200 Subject: [PATCH 105/126] Managers: remove a redundant statement. --- src/Managers/BackupManager.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp index b5922bc..b41586e 100644 --- a/src/Managers/BackupManager.cpp +++ b/src/Managers/BackupManager.cpp @@ -35,9 +35,7 @@ namespace mbst { namespace Managers { -BackupManager::BackupManager(): - _vfs() -{ +BackupManager::BackupManager() { refresh(); } -- 2.39.5 From 90a67f30d99ff64dd29f8ee3baf72c14a26845f4 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 12 Jul 2024 15:06:02 +0200 Subject: [PATCH 106/126] Logger: flush to file after each log entry in release. --- src/Logger/Logger.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Logger/Logger.cpp b/src/Logger/Logger.cpp index db00e7d..4d738f0 100644 --- a/src/Logger/Logger.cpp +++ b/src/Logger/Logger.cpp @@ -92,6 +92,10 @@ Logger::log(EntryType type, StringView location, StringView message) { } d << ((message.back() == '\n') ? message.exceptSuffix(1) : message); + + #ifndef SAVETOOL_DEBUG_BUILD + _logFile.flush(); + #endif } void -- 2.39.5 From c0bf16144fc57c354aacc1c7f83417f2a9e46140 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Fri, 12 Jul 2024 15:08:06 +0200 Subject: [PATCH 107/126] CMakeLists: re-enable the debug define. --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2523730..7998333 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -239,6 +239,10 @@ target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_SUPPORTED_GAME_VERSION="0.10.x" ) +if(CMAKE_BUILD_TYPE STREQUAL Debug) + target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_DEBUG_BUILD) +endif() + if(CMAKE_BUILD_TYPE STREQUAL Release) set_target_properties(MassBuilderSaveTool PROPERTIES OUTPUT_NAME MassBuilderSaveTool-${SAVETOOL_PROJECT_VERSION}) endif() -- 2.39.5 From c1ad757f80ebaf39735859ee2a0bc6e5bd215d69 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 13 Jul 2024 11:00:28 +0200 Subject: [PATCH 108/126] Managers: redesign the VFS and adapt BackupManager. --- src/CMakeLists.txt | 3 +- src/Managers/BackupManager.cpp | 11 +++-- src/Managers/BackupManager.h | 9 ++-- .../Vfs/{VfsDirectory.h => Directory.h} | 34 ++++++++++---- src/Managers/Vfs/VirtualFileSystem.h | 47 ------------------- 5 files changed, 38 insertions(+), 66 deletions(-) rename src/Managers/Vfs/{VfsDirectory.h => Directory.h} (70%) delete mode 100644 src/Managers/Vfs/VirtualFileSystem.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7998333..6340051 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,8 +199,7 @@ add_executable(MassBuilderSaveTool Managers/MassManager.cpp Managers/ProfileManager.h Managers/ProfileManager.cpp - Managers/Vfs/VirtualFileSystem.h - Managers/Vfs/VfsDirectory.h + Managers/Vfs/Directory.h Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp Maps/BulletLauncherSockets.hpp diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp index b41586e..6d7a5b2 100644 --- a/src/Managers/BackupManager.cpp +++ b/src/Managers/BackupManager.cpp @@ -35,7 +35,9 @@ namespace mbst { namespace Managers { -BackupManager::BackupManager() { +BackupManager::BackupManager(): + _root{""} +{ refresh(); } @@ -50,7 +52,8 @@ BackupManager::refresh() { scanSubdir(""_s); - _vfs.build(_backups); + _root.clear(); + _root.build(_backups); } Containers::ArrayView @@ -58,10 +61,10 @@ BackupManager::backups() const { return _backups; } -const Vfs::VirtualFileSystem& +const Vfs::Directory& BackupManager::vfs() const { - return _vfs; + return _root; } bool diff --git a/src/Managers/BackupManager.h b/src/Managers/BackupManager.h index 938f88e..cc7678f 100644 --- a/src/Managers/BackupManager.h +++ b/src/Managers/BackupManager.h @@ -25,7 +25,7 @@ #include "Backup.h" #include "../GameObjects/Profile.h" -#include "Vfs/VirtualFileSystem.h" +#include "Vfs/Directory.h" using namespace Corrade; @@ -41,10 +41,13 @@ class BackupManager { auto backups() const -> Containers::ArrayView; - auto vfs() const -> const Vfs::VirtualFileSystem&; + auto vfs() const -> const Vfs::Directory&; bool create(const GameObjects::Profile& profile); + bool remove(std::size_t index); + bool remove(Containers::StringView filename); + bool restore(std::size_t index); private: @@ -54,7 +57,7 @@ class BackupManager { Containers::Array _backups; - Vfs::VirtualFileSystem _vfs; + Vfs::Directory _root; }; }} diff --git a/src/Managers/Vfs/VfsDirectory.h b/src/Managers/Vfs/Directory.h similarity index 70% rename from src/Managers/Vfs/VfsDirectory.h rename to src/Managers/Vfs/Directory.h index e0c203f..5fd600f 100644 --- a/src/Managers/Vfs/VfsDirectory.h +++ b/src/Managers/Vfs/Directory.h @@ -27,22 +27,22 @@ namespace mbst { namespace Managers { namespace Vfs { CORRADE_HAS_TYPE(HasFilename, decltype(T::filename)); template -class VfsDirectory { +class Directory { public: static_assert(HasFilename::value && (std::is_same::value || std::is_same::value), "FileType has no string-like member named filename."); - using DirType = VfsDirectory; + using DirType = Directory; - explicit VfsDirectory(Containers::StringView name): _name{name} { + explicit Directory(Containers::StringView name): _name{name} { // ctor } - VfsDirectory(const VfsDirectory& other) = delete; - VfsDirectory& operator=(const VfsDirectory& other) = delete; + Directory(const Directory& other) = delete; + Directory& operator=(const Directory& other) = delete; - VfsDirectory(VfsDirectory&& other) = default; - VfsDirectory& operator=(VfsDirectory&& other) = default; + Directory(Directory&& other) = default; + Directory& operator=(Directory&& other) = default; auto name() const -> Containers::StringView { return _name; @@ -52,12 +52,26 @@ class VfsDirectory { return _subdirs; } - auto files() const -> Containers::ArrayView { + auto files() const -> Containers::ArrayView { return _files; } - protected: - void buildNestedPath(VfsDirectory& root, Containers::ArrayView components, + void clear() { + _subdirs = Containers::Array{}; + _files = Containers::Array{}; + } + + void build(Containers::ArrayView files) { + for(auto& file : files) { + auto components = file.filename.split('/'); + CORRADE_INTERNAL_ASSERT(components.size() != 0); + + buildNestedPath(*this, components, file); + } + } + + private: + void buildNestedPath(Directory& root, Containers::ArrayView components, FileType& file) { if(components.size() > 1) { diff --git a/src/Managers/Vfs/VirtualFileSystem.h b/src/Managers/Vfs/VirtualFileSystem.h deleted file mode 100644 index a9e227e..0000000 --- a/src/Managers/Vfs/VirtualFileSystem.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -// MassBuilderSaveTool -// Copyright (C) 2021-2024 Guillaume Jacquemin -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -#include "VfsDirectory.h" - -namespace mbst { namespace Managers { namespace Vfs { - -template -class VirtualFileSystem: public VfsDirectory { - public: - explicit VirtualFileSystem(): - VfsDirectory("") - { - // ctor - } - explicit VirtualFileSystem(Containers::ArrayView files): - VfsDirectory("") - { - build(files); - } - - void build(Containers::ArrayView files) { - for(auto& file : files) { - auto components = file.filename.split('/'); - CORRADE_INTERNAL_ASSERT(components.size() != 0); - - VfsDirectory::buildNestedPath(*this, components, file); - } - } -}; - -}}} -- 2.39.5 From 165ca39e844e5973d6beeeb6d4711c367dfd639f Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 13 Jul 2024 11:32:13 +0200 Subject: [PATCH 109/126] Application: early UI work for the backup tree view. --- src/Application/Application.h | 1 + .../Application_ProfileManager.cpp | 150 +++++++++++++----- 2 files changed, 113 insertions(+), 38 deletions(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index 4a6a1c8..00ce53a 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -115,6 +115,7 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawProfileManager(); void drawBackupListPopup(); + void drawBackupFolder(const Managers::Vfs::Directory& dir); void drawBackupRestorePopup(std::size_t backup_index); void drawBackupDeletePopup(std::size_t backup_index); void drawDeleteProfilePopup(std::size_t profile_index); diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index fa55485..ec3141d 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -175,48 +175,50 @@ Application::drawBackupListPopup() { ImGui::TableSetColumnIndex(3); ImGui::TextUnformatted("Actions"); - for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { - auto& backup = _backupManager->backups()[i]; - ImGui::TableNextRow(); + drawBackupFolder(_backupManager->vfs()); - ImGui::TableSetColumnIndex(0); - ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); - if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { - for(const auto& file : backup.includedFiles) { - ImGui::TextUnformatted(file.cbegin()); - } - ImGui::EndTooltip(); - } + //for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { + // auto& backup = _backupManager->backups()[i]; + // ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(1); - ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", - backup.timestamp.year, - backup.timestamp.month, - backup.timestamp.day, - backup.timestamp.hour, - backup.timestamp.minute, - backup.timestamp.second); + // ImGui::TableSetColumnIndex(0); + // ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); + // if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { + // for(const auto& file : backup.includedFiles) { + // ImGui::TextUnformatted(file.cbegin()); + // } + // ImGui::EndTooltip(); + // } - ImGui::TableSetColumnIndex(2); - ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); + // ImGui::TableSetColumnIndex(1); + // ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", + // backup.timestamp.year, + // backup.timestamp.month, + // backup.timestamp.day, + // backup.timestamp.hour, + // backup.timestamp.minute, + // backup.timestamp.second); - ImGui::TableSetColumnIndex(3); - ImGui::PushID(int(i)); - if(ImGui::SmallButton(ICON_FA_UNDO)) { - backup_index = i; - ImGui::OpenPopup("Restore backup##RestoreBackupModal"); - } - drawTooltip("Restore"); - drawBackupRestorePopup(backup_index); - ImGui::SameLine(0.0f, 2.0f); - if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { - backup_index = i; - ImGui::OpenPopup("Delete backup##DeleteBackupModal"); - } - drawTooltip("Delete"); - drawBackupDeletePopup(backup_index); - ImGui::PopID(); - } + // ImGui::TableSetColumnIndex(2); + // ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); + + // ImGui::TableSetColumnIndex(3); + // ImGui::PushID(int(i)); + // if(ImGui::SmallButton(ICON_FA_UNDO)) { + // backup_index = i; + // ImGui::OpenPopup("Restore backup##RestoreBackupModal"); + // } + // drawTooltip("Restore"); + // drawBackupRestorePopup(backup_index); + // ImGui::SameLine(0.0f, 2.0f); + // if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { + // backup_index = i; + // ImGui::OpenPopup("Delete backup##DeleteBackupModal"); + // } + // drawTooltip("Delete"); + // drawBackupDeletePopup(backup_index); + // ImGui::PopID(); + //} ImGui::EndTable(); } @@ -241,6 +243,78 @@ Application::drawBackupListPopup() { ImGui::EndPopup(); } +void +Application::drawBackupFolder(const Managers::Vfs::Directory& dir) { + if(dir.files().isEmpty() && dir.subdirs().isEmpty()) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TextDisabled(""); + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + return; + } + + bool open = false; + + if(dir.name() != "") { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + open = ImGui::TreeNodeEx(dir.name().cbegin(), ImGuiTreeNodeFlags_SpanAllColumns); + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + } + + for(auto& subdir : dir.subdirs()) { + drawBackupFolder(subdir); + if(open) { + ImGui::TreePop(); + } + } + + for(auto file : dir.files()) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::TreeNodeEx(file->company.cbegin(), ImGuiTreeNodeFlags_SpanAllColumns|ImGuiTreeNodeFlags_Leaf| + ImGuiTreeNodeFlags_Bullet|ImGuiTreeNodeFlags_NoTreePushOnOpen); + + ImGui::TableNextColumn(); + ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", + file->timestamp.year, + file->timestamp.month, + file->timestamp.day, + file->timestamp.hour, + file->timestamp.minute, + file->timestamp.second); + + ImGui::TableNextColumn(); + ImGui::TextUnformatted(file->demo ? "Demo" : "Full"); + + ImGui::TableNextColumn(); + ImGui::PushID(file); + if(ImGui::SmallButton(ICON_FA_UNDO)) { + //ImGui::OpenPopup("Restore backup##RestoreBackupModal"); + } + drawTooltip("Restore"); + //drawBackupRestorePopup(backup_index); + ImGui::SameLine(0.0f, 2.0f); + if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { + //ImGui::OpenPopup("Delete backup##DeleteBackupModal"); + } + drawTooltip("Delete"); + //drawBackupDeletePopup(backup_index); + ImGui::PopID(); + } +} + + void Application::drawBackupRestorePopup(std::size_t backup_index) { if(!ImGui::BeginPopupModal("Restore backup##RestoreBackupModal", nullptr, -- 2.39.5 From e1e82c0c434f7ff31f81df43b146488b6f3829e1 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 13 Jul 2024 12:34:39 +0200 Subject: [PATCH 110/126] Application: rewrite drawBackupFolder(). Though there's another issue, which I'll have to investigate further. --- .../Application_ProfileManager.cpp | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index ec3141d..7dc70d1 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -246,35 +246,25 @@ Application::drawBackupListPopup() { void Application::drawBackupFolder(const Managers::Vfs::Directory& dir) { if(dir.files().isEmpty() && dir.subdirs().isEmpty()) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - ImGui::TextDisabled(""); - ImGui::TableNextColumn(); - ImGui::TextDisabled("--"); - ImGui::TableNextColumn(); - ImGui::TextDisabled("--"); - ImGui::TableNextColumn(); - ImGui::TextDisabled("--"); return; } - bool open = false; - - if(dir.name() != "") { + for(auto& subdir : dir.subdirs()) { ImGui::TableNextRow(); ImGui::TableNextColumn(); - open = ImGui::TreeNodeEx(dir.name().cbegin(), ImGuiTreeNodeFlags_SpanAllColumns); - ImGui::TableNextColumn(); - ImGui::TextDisabled("--"); - ImGui::TableNextColumn(); - ImGui::TextDisabled("--"); - ImGui::TableNextColumn(); - ImGui::TextDisabled("--"); - } + bool open = ImGui::TreeNodeEx(subdir.name().cbegin(), ImGuiTreeNodeFlags_SpanAllColumns); + + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); + + ImGui::TableNextColumn(); + ImGui::TextDisabled("--"); - for(auto& subdir : dir.subdirs()) { - drawBackupFolder(subdir); if(open) { + drawBackupFolder(subdir); ImGui::TreePop(); } } @@ -283,7 +273,7 @@ Application::drawBackupFolder(const Managers::Vfs::Directory& ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::TreeNodeEx(file->company.cbegin(), ImGuiTreeNodeFlags_SpanAllColumns|ImGuiTreeNodeFlags_Leaf| - ImGuiTreeNodeFlags_Bullet|ImGuiTreeNodeFlags_NoTreePushOnOpen); + ImGuiTreeNodeFlags_NoTreePushOnOpen); ImGui::TableNextColumn(); ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", -- 2.39.5 From 3e0c0bb7a495bd0e1ae9dacf5a22c0cfd950a90d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 13 Jul 2024 13:29:42 +0200 Subject: [PATCH 111/126] Application: disable the tree view for backups. As mentioned in the commit, something's wrong. Probably on ImGui's side, but I'll have to investigate more. --- .../Application_ProfileManager.cpp | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Application/Application_ProfileManager.cpp b/src/Application/Application_ProfileManager.cpp index 7dc70d1..ce103a0 100644 --- a/src/Application/Application_ProfileManager.cpp +++ b/src/Application/Application_ProfileManager.cpp @@ -175,50 +175,50 @@ Application::drawBackupListPopup() { ImGui::TableSetColumnIndex(3); ImGui::TextUnformatted("Actions"); - drawBackupFolder(_backupManager->vfs()); + //drawBackupFolder(_backupManager->vfs()); - //for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { - // auto& backup = _backupManager->backups()[i]; - // ImGui::TableNextRow(); + for(std::size_t i = 0; i < _backupManager->backups().size(); ++i) { + auto& backup = _backupManager->backups()[i]; + ImGui::TableNextRow(); - // ImGui::TableSetColumnIndex(0); - // ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); - // if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { - // for(const auto& file : backup.includedFiles) { - // ImGui::TextUnformatted(file.cbegin()); - // } - // ImGui::EndTooltip(); - // } + ImGui::TableSetColumnIndex(0); + ImGui::TextUnformatted(backup.company.cbegin(), backup.company.cend()); + if(ImGui::IsItemHovered() && ImGui::BeginTooltip()) { + for(const auto& file : backup.includedFiles) { + ImGui::TextUnformatted(file.cbegin()); + } + ImGui::EndTooltip(); + } - // ImGui::TableSetColumnIndex(1); - // ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", - // backup.timestamp.year, - // backup.timestamp.month, - // backup.timestamp.day, - // backup.timestamp.hour, - // backup.timestamp.minute, - // backup.timestamp.second); + ImGui::TableSetColumnIndex(1); + ImGui::Text("%.4i-%.2i-%.2i %.2i:%.2i:%.2i", + backup.timestamp.year, + backup.timestamp.month, + backup.timestamp.day, + backup.timestamp.hour, + backup.timestamp.minute, + backup.timestamp.second); - // ImGui::TableSetColumnIndex(2); - // ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); + ImGui::TableSetColumnIndex(2); + ImGui::TextUnformatted(backup.demo ? "Demo" : "Full"); - // ImGui::TableSetColumnIndex(3); - // ImGui::PushID(int(i)); - // if(ImGui::SmallButton(ICON_FA_UNDO)) { - // backup_index = i; - // ImGui::OpenPopup("Restore backup##RestoreBackupModal"); - // } - // drawTooltip("Restore"); - // drawBackupRestorePopup(backup_index); - // ImGui::SameLine(0.0f, 2.0f); - // if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { - // backup_index = i; - // ImGui::OpenPopup("Delete backup##DeleteBackupModal"); - // } - // drawTooltip("Delete"); - // drawBackupDeletePopup(backup_index); - // ImGui::PopID(); - //} + ImGui::TableSetColumnIndex(3); + ImGui::PushID(int(i)); + if(ImGui::SmallButton(ICON_FA_UNDO)) { + backup_index = i; + ImGui::OpenPopup("Restore backup##RestoreBackupModal"); + } + drawTooltip("Restore"); + drawBackupRestorePopup(backup_index); + ImGui::SameLine(0.0f, 2.0f); + if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { + backup_index = i; + ImGui::OpenPopup("Delete backup##DeleteBackupModal"); + } + drawTooltip("Delete"); + drawBackupDeletePopup(backup_index); + ImGui::PopID(); + } ImGui::EndTable(); } -- 2.39.5 From a290542f6ed7e6eb02b2840782830457a17573dc Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 13 Jul 2024 15:03:30 +0200 Subject: [PATCH 112/126] Gvas: add support for UE5 saves. Fuckers at Epic added four more bytes to the file header, and not even equivalent Rust libraries know what those bytes are for. --- src/Gvas/File.cpp | 93 +++++++++++++++++++++++++++++++++++++++-------- src/Gvas/File.h | 2 +- 2 files changed, 78 insertions(+), 17 deletions(-) diff --git a/src/Gvas/File.cpp b/src/Gvas/File.cpp index 7493f5d..e99ffd2 100644 --- a/src/Gvas/File.cpp +++ b/src/Gvas/File.cpp @@ -95,16 +95,39 @@ File::saveToFile() { return false; } - if(!writer.writeArray(arrayView(_magicBytes)) || - !writer.writeUint32(_saveVersion) || - !writer.writeUint32(_packageVersion) || - !writer.writeUint16(_engineVersion.major) || - !writer.writeUint16(_engineVersion.minor) || - !writer.writeUint16(_engineVersion.patch) || - !writer.writeUint32(_engineVersion.build) || + if(!writer.writeArray(arrayView(_magicBytes))) { + _lastError = "Couldn't write the magic bytes."_s; + LOG_ERROR(_lastError); + return false; + } + + if(!writer.writeUint32(_saveVersion)) { + _lastError = "Couldn't write the save version."_s; + LOG_ERROR(_lastError); + return false; + } + + if(!writer.writeUint32(_packageVersion)) { + _lastError = "Couldn't write the package version."_s; + LOG_ERROR(_lastError); + return false; + } + + if(_saveVersion == 3) { + if(!writer.writeUint32(_unknown)) { + _lastError = "Couldn't write some unknown bytes."_s; + LOG_ERROR(_lastError); + return false; + } + } + + if(!writer.writeUint16(_engineVersion.major) || + !writer.writeUint16(_engineVersion.minor) || + !writer.writeUint16(_engineVersion.patch) || + !writer.writeUint32(_engineVersion.build) || !writer.writeUEString(_engineVersion.buildId)) { - _lastError = "Couldn't write the header."_s; + _lastError = "Couldn't write the engine version."_s; LOG_ERROR(_lastError); return false; } @@ -198,15 +221,53 @@ File::loadData() { return; } - if(!reader.readUint32(_saveVersion) || - !reader.readUint32(_packageVersion) || - !reader.readUint16(_engineVersion.major) || - !reader.readUint16(_engineVersion.minor) || - !reader.readUint16(_engineVersion.patch) || - !reader.readUint32(_engineVersion.build) || - !reader.readUEString(_engineVersion.buildId)) + if(!reader.readUint32(_saveVersion)) { + _lastError = "Couldn't read save version."; + LOG_ERROR(_lastError); + return; + } + + if(!reader.readUint32(_packageVersion)) { + _lastError = "Couldn't read package version."; + LOG_ERROR(_lastError); + return; + } + + if(_saveVersion == 3) { + if(!reader.readUint32(_unknown)) { + _lastError = "Couldn't read some unknown bytes."; + LOG_ERROR(_lastError); + return; + } + } + + if(!reader.readUint16(_engineVersion.major)) { + _lastError = "Couldn't read major engine version."; + LOG_ERROR(_lastError); + return; + } + + if(!reader.readUint16(_engineVersion.minor)) { + _lastError = "Couldn't read minor engine version."; + LOG_ERROR(_lastError); + return; + } + + if(!reader.readUint16(_engineVersion.patch)) { + _lastError = "Couldn't read patch engine version."; + LOG_ERROR(_lastError); + return; + } + + if(!reader.readUint32(_engineVersion.build)) { + _lastError = "Couldn't read engine build."; + LOG_ERROR(_lastError); + return; + } + + if(!reader.readUEString(_engineVersion.buildId)) { - _lastError = "Couldn't read version data."; + _lastError = "Couldn't read engine build ID string."; LOG_ERROR(_lastError); return; } diff --git a/src/Gvas/File.h b/src/Gvas/File.h index 117252b..0dce428 100644 --- a/src/Gvas/File.h +++ b/src/Gvas/File.h @@ -17,7 +17,6 @@ // along with this program. If not, see . #include -#include #include #include #include @@ -73,6 +72,7 @@ class File { std::uint32_t _saveVersion = 0; std::uint32_t _packageVersion = 0; + std::uint32_t _unknown = 0; struct { std::uint16_t major = 0; std::uint16_t minor = 0; -- 2.39.5 From bbf457beb65a4fe7324743a664ac9852dadd19f9 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Jul 2024 15:32:44 +0200 Subject: [PATCH 113/126] GameData: update the accessory list. --- src/GameData/Accessories.h | 97 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/GameData/Accessories.h b/src/GameData/Accessories.h index 7ac7529..78ffa90 100644 --- a/src/GameData/Accessories.h +++ b/src/GameData/Accessories.h @@ -258,6 +258,11 @@ static const std::map accessories{ {1213, {"Pointed Armour 13"_s, Accessory::Size::L}}, {1214, {"Pointed Armour 14"_s, Accessory::Size::L}}, {1215, {"Pointed Armour 15"_s, Accessory::Size::L}}, + {1216, {"Pointed Armour 16"_s, Accessory::Size::L}}, + {1217, {"Pointed Armour 17"_s, Accessory::Size::L}}, + {1218, {"Pointed Armour 18"_s, Accessory::Size::L}}, + {1219, {"Pointed Armour 19"_s, Accessory::Size::L}}, + {1220, {"Pointed Armour 20"_s, Accessory::Size::L}}, {1251, {"E Limb Cover 01"_s, Accessory::Size::L}}, {1252, {"E Limb Cover 02"_s, Accessory::Size::L}}, @@ -359,6 +364,12 @@ static const std::map accessories{ {2104, {"Plating 04"_s, Accessory::Size::L}}, {2105, {"Plating 05"_s, Accessory::Size::L}}, + {2126, {"Curved Plating 01"_s, Accessory::Size::L}}, + {2127, {"Curved Plating 02"_s, Accessory::Size::L}}, + {2128, {"Curved Plating 03"_s, Accessory::Size::L}}, + {2129, {"Curved Plating 04"_s, Accessory::Size::L}}, + {2130, {"Curved Plating 05"_s, Accessory::Size::L}}, + {2151, {"Complex Base 01"_s, Accessory::Size::L}}, {2152, {"Complex Base 02"_s, Accessory::Size::L}}, {2153, {"Complex Base 03"_s, Accessory::Size::L}}, @@ -498,6 +509,17 @@ static const std::map accessories{ {2554, {"Energy Barrel 04"_s, Accessory::Size::XL}}, {2555, {"Energy Barrel 05"_s, Accessory::Size::XL}}, + {2560, {"Wire Head 01"_s, Accessory::Size::M}}, + {2561, {"Wire Head 02"_s, Accessory::Size::M}}, + {2562, {"Wire Head 03"_s, Accessory::Size::M}}, + {2563, {"Wire Head 04"_s, Accessory::Size::M}}, + {2564, {"Wire Head 05"_s, Accessory::Size::M}}, + {2565, {"Wire Head 06"_s, Accessory::Size::M}}, + {2566, {"Wire Head 07"_s, Accessory::Size::M}}, + {2567, {"Wire Head 08"_s, Accessory::Size::M}}, + {2568, {"Wire Head 09"_s, Accessory::Size::M}}, + {2569, {"Wire Head 10"_s, Accessory::Size::M}}, + {2601, {"L Bullet Barrel 01"_s, Accessory::Size::XL}}, {2602, {"L Bullet Barrel 02"_s, Accessory::Size::XL}}, {2603, {"L Bullet Barrel 03"_s, Accessory::Size::XL}}, @@ -551,6 +573,18 @@ static const std::map accessories{ {2714, {"Atk Packed Weaponry 03"_s, Accessory::Size::XL}}, {2715, {"Atk Packed Weaponry 04"_s, Accessory::Size::XL}}, + {2721, {"Double Pod"_s, Accessory::Size::L}}, + {2722, {"Triple Pod"_s, Accessory::Size::L}}, + {2723, {"Vertical T Pod"_s, Accessory::Size::L}}, + {2724, {"Quadruple Pod"_s, Accessory::Size::L}}, + {2725, {"Vertical Q Pod"_s, Accessory::Size::L}}, + + {2741, {"Grenade 01"_s, Accessory::Size::M}}, + {2742, {"Grenade 02"_s, Accessory::Size::M}}, + {2743, {"Grenade 03"_s, Accessory::Size::M}}, + {2744, {"Grenade 04"_s, Accessory::Size::M}}, + {2745, {"Grenade 05"_s, Accessory::Size::M}}, + {2751, {"Vent 01"_s, Accessory::Size::M}}, {2752, {"Vent 02"_s, Accessory::Size::M}}, {2753, {"Vent 03"_s, Accessory::Size::M}}, @@ -561,12 +595,33 @@ static const std::map accessories{ {2758, {"Vent 08"_s, Accessory::Size::M}}, {2759, {"Vent 09"_s, Accessory::Size::M}}, {2760, {"Vent 10"_s, Accessory::Size::M}}, + {2761, {"Cooling Tile 01"_s, Accessory::Size::L}}, + {2762, {"Cooling Tile 02"_s, Accessory::Size::L}}, + {2763, {"Cooling Tile 03"_s, Accessory::Size::L}}, + {2764, {"Cooling Tile 04"_s, Accessory::Size::L}}, + {2765, {"Cooling Tile 05"_s, Accessory::Size::L}}, {2901, {"Complex Construct 01"_s, Accessory::Size::L}}, {2902, {"Complex Construct 02"_s, Accessory::Size::L}}, {2903, {"Complex Construct 03"_s, Accessory::Size::L}}, {2904, {"Complex Construct 04"_s, Accessory::Size::L}}, {2905, {"Complex Construct 05"_s, Accessory::Size::L}}, + {2906, {"Grating 01"_s, Accessory::Size::M}}, + {2907, {"Grating 02"_s, Accessory::Size::M}}, + {2908, {"Grating 03"_s, Accessory::Size::M}}, + {2909, {"Grating 04"_s, Accessory::Size::M}}, + {2910, {"Grating 05"_s, Accessory::Size::M}}, + {2911, {"Wireframe 01"_s, Accessory::Size::L}}, + {2912, {"Wireframe 02"_s, Accessory::Size::L}}, + {2913, {"Wireframe 03"_s, Accessory::Size::L}}, + {2914, {"Wireframe 04"_s, Accessory::Size::L}}, + {2915, {"Wireframe 05"_s, Accessory::Size::L}}, + + {2926, {"Complex Armour 01"_s, Accessory::Size::L}}, + {2927, {"Complex Armour 02"_s, Accessory::Size::L}}, + {2928, {"Complex Armour 03"_s, Accessory::Size::L}}, + {2929, {"Complex Armour 04"_s, Accessory::Size::L}}, + {2930, {"Complex Armour 05"_s, Accessory::Size::L}}, {2950, {"Q Mask 01"_s, Accessory::Size::M}}, {2951, {"Q Mask 02"_s, Accessory::Size::M}}, @@ -669,6 +724,11 @@ static const std::map accessories{ {3358, {"Radar Pod 03"_s, Accessory::Size::M}}, {3359, {"Radar Pod 04"_s, Accessory::Size::M}}, {3360, {"Radar Pod 05"_s, Accessory::Size::M}}, + {3361, {"Radar Ring 01"_s, Accessory::Size::XL}}, + {3362, {"Radar Ring 02"_s, Accessory::Size::XL}}, + {3363, {"Radar Ring 03"_s, Accessory::Size::XL}}, + {3364, {"Radar Ring 04"_s, Accessory::Size::XL}}, + {3365, {"Radar Ring 05"_s, Accessory::Size::XL}}, {3401, {"Tri Pod 01"_s, Accessory::Size::M}}, {3402, {"Tri Pod 02"_s, Accessory::Size::M}}, @@ -680,6 +740,43 @@ static const std::map accessories{ {3408, {"Signal Pod 03"_s, Accessory::Size::M}}, {3409, {"Signal Pod 04"_s, Accessory::Size::M}}, {3410, {"Signal Pod 05"_s, Accessory::Size::M}}, + + {3451, {"Track Wheel 01"_s, Accessory::Size::XL}}, + {3452, {"Track Wheel 02"_s, Accessory::Size::XL}}, + {3453, {"Track Wheel 03"_s, Accessory::Size::XL}}, + {3454, {"Track Wheel 04"_s, Accessory::Size::XL}}, + {3455, {"Track Wheel 05"_s, Accessory::Size::XL}}, + {3456, {"Track Chain 01"_s, Accessory::Size::XL}}, + {3457, {"Track Chain 02"_s, Accessory::Size::XL}}, + {3458, {"Track Chain 03"_s, Accessory::Size::XL}}, + {3459, {"Track Chain 04"_s, Accessory::Size::XL}}, + {3460, {"Track Chain 05"_s, Accessory::Size::XL}}, + {3461, {"Track Chain 06"_s, Accessory::Size::XL}}, + {3462, {"Track Chain 07"_s, Accessory::Size::XL}}, + {3463, {"Track Chain 08"_s, Accessory::Size::XL}}, + {3464, {"Track Chain 09"_s, Accessory::Size::XL}}, + {3465, {"Track Chain 10"_s, Accessory::Size::XL}}, + {3466, {"Track Chain 11"_s, Accessory::Size::XL}}, + {3467, {"Track Chain 12"_s, Accessory::Size::XL}}, + {3468, {"Track Chain 13"_s, Accessory::Size::XL}}, + {3469, {"Track Chain 14"_s, Accessory::Size::XL}}, + {3470, {"Track Chain 15"_s, Accessory::Size::XL}}, + + {3500, {"Wire Module 05"_s, Accessory::Size::XL}}, + {3501, {"Wire Module 06"_s, Accessory::Size::XL}}, + {3502, {"Wire Module 07"_s, Accessory::Size::XL}}, + {3503, {"Wire Module 08"_s, Accessory::Size::XL}}, + {3504, {"Wire Module 09"_s, Accessory::Size::XL}}, + {3505, {"Wire Module 10"_s, Accessory::Size::XL}}, + {3506, {"Wire Module 11"_s, Accessory::Size::XL}}, + {3507, {"Wire Module 12"_s, Accessory::Size::XL}}, + {3508, {"Wire Module 13"_s, Accessory::Size::XL}}, + {3509, {"Wire Module 14"_s, Accessory::Size::XL}}, + {3510, {"Wire Module 15"_s, Accessory::Size::XL}}, + {3511, {"Wire Module 06"_s, Accessory::Size::XL}}, + {3512, {"Wire Module 07"_s, Accessory::Size::XL}}, + {3513, {"Wire Module 08"_s, Accessory::Size::XL}}, + {3514, {"Wire Module 09"_s, Accessory::Size::XL}}, // endregion }; -- 2.39.5 From 53c58ba97932cba3e4f00ec3d819c72587a54edc Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Jul 2024 16:28:17 +0200 Subject: [PATCH 114/126] Switch to C++17. Also change namespace definitions to nested ones. --- src/CMakeLists.txt | 2 +- src/GameData/Accessories.h | 4 ++-- src/GameData/ArmourSets.h | 4 ++-- src/GameData/LastMissionId.h | 4 ++-- src/GameData/ResourceIDs.h | 4 ++-- src/GameData/StoryProgress.h | 4 ++-- src/GameData/StyleNames.h | 4 ++-- src/GameData/WeaponParts.h | 4 ++-- src/GameObjects/Accessory.h | 4 ++-- src/GameObjects/ArmourPart.h | 4 ++-- src/GameObjects/BulletLauncherAttachment.h | 4 ++-- src/GameObjects/CustomStyle.h | 4 ++-- src/GameObjects/Decal.h | 4 ++-- src/GameObjects/Joints.h | 4 ++-- src/GameObjects/Mass.cpp | 4 ++-- src/GameObjects/Mass.h | 4 ++-- src/GameObjects/Mass_Armour.cpp | 4 ++-- src/GameObjects/Mass_DecalsAccessories.cpp | 4 ++-- src/GameObjects/Mass_Frame.cpp | 4 ++-- src/GameObjects/Mass_Styles.cpp | 4 ++-- src/GameObjects/Mass_Weapons.cpp | 4 ++-- src/GameObjects/Profile.cpp | 4 ++-- src/GameObjects/Profile.h | 4 ++-- src/GameObjects/Weapon.cpp | 4 ++-- src/GameObjects/Weapon.h | 4 ++-- src/GameObjects/WeaponPart.h | 4 ++-- .../AbstractUnrealCollectionProperty.h | 4 ++-- src/Gvas/Serialisers/AbstractUnrealProperty.h | 4 ++-- src/Gvas/Serialisers/AbstractUnrealStruct.h | 4 ++-- src/Gvas/Serialisers/ArrayProperty.cpp | 4 ++-- src/Gvas/Serialisers/ArrayProperty.h | 4 ++-- src/Gvas/Serialisers/BoolProperty.cpp | 4 ++-- src/Gvas/Serialisers/BoolProperty.h | 4 ++-- src/Gvas/Serialisers/ByteProperty.cpp | 6 ++--- src/Gvas/Serialisers/ByteProperty.h | 4 ++-- src/Gvas/Serialisers/ColourProperty.cpp | 4 ++-- src/Gvas/Serialisers/ColourProperty.h | 4 ++-- src/Gvas/Serialisers/DateTimeProperty.cpp | 4 ++-- src/Gvas/Serialisers/DateTimeProperty.h | 4 ++-- src/Gvas/Serialisers/EnumProperty.cpp | 4 ++-- src/Gvas/Serialisers/EnumProperty.h | 4 ++-- src/Gvas/Serialisers/FloatProperty.cpp | 4 ++-- src/Gvas/Serialisers/FloatProperty.h | 4 ++-- src/Gvas/Serialisers/GuidProperty.cpp | 4 ++-- src/Gvas/Serialisers/GuidProperty.h | 4 ++-- src/Gvas/Serialisers/IntProperty.cpp | 4 ++-- src/Gvas/Serialisers/IntProperty.h | 4 ++-- src/Gvas/Serialisers/MapProperty.cpp | 4 ++-- src/Gvas/Serialisers/MapProperty.h | 4 ++-- src/Gvas/Serialisers/ResourceProperty.cpp | 4 ++-- src/Gvas/Serialisers/ResourceProperty.h | 4 ++-- src/Gvas/Serialisers/RotatorProperty.cpp | 4 ++-- src/Gvas/Serialisers/RotatorProperty.h | 4 ++-- src/Gvas/Serialisers/Serialisers.h | 4 ++-- src/Gvas/Serialisers/SetProperty.cpp | 4 ++-- src/Gvas/Serialisers/SetProperty.h | 4 ++-- src/Gvas/Serialisers/StringProperty.cpp | 4 ++-- src/Gvas/Serialisers/StringProperty.h | 4 ++-- src/Gvas/Serialisers/Struct.cpp | 4 ++-- src/Gvas/Serialisers/Struct.h | 4 ++-- src/Gvas/Serialisers/TextProperty.cpp | 4 ++-- src/Gvas/Serialisers/TextProperty.h | 4 ++-- src/Gvas/Serialisers/UnrealProperty.h | 4 ++-- src/Gvas/Serialisers/Vector2DProperty.cpp | 4 ++-- src/Gvas/Serialisers/Vector2DProperty.h | 4 ++-- src/Gvas/Serialisers/VectorProperty.cpp | 4 ++-- src/Gvas/Serialisers/VectorProperty.h | 4 ++-- src/Gvas/Types/ArrayProperty.h | 4 ++-- src/Gvas/Types/BoolProperty.h | 4 ++-- src/Gvas/Types/ByteProperty.h | 4 ++-- src/Gvas/Types/ColourStructProperty.h | 4 ++-- src/Gvas/Types/DateTimeStructProperty.h | 4 ++-- src/Gvas/Types/EnumProperty.h | 4 ++-- src/Gvas/Types/FloatProperty.h | 4 ++-- src/Gvas/Types/GenericStructProperty.h | 4 ++-- src/Gvas/Types/GuidStructProperty.h | 4 ++-- src/Gvas/Types/IntProperty.h | 4 ++-- src/Gvas/Types/MapProperty.h | 4 ++-- src/Gvas/Types/NoneProperty.h | 4 ++-- src/Gvas/Types/ResourceItemValue.h | 4 ++-- src/Gvas/Types/RotatorStructProperty.h | 4 ++-- src/Gvas/Types/SetProperty.h | 4 ++-- src/Gvas/Types/StringProperty.h | 4 ++-- src/Gvas/Types/StructProperty.h | 4 ++-- src/Gvas/Types/TextProperty.h | 4 ++-- src/Gvas/Types/Types.h | 4 ++-- src/Gvas/Types/UnrealProperty.h | 4 ++-- src/Gvas/Types/UnrealPropertyBase.h | 4 ++-- src/Gvas/Types/Vector2DStructProperty.h | 4 ++-- src/Gvas/Types/VectorStructProperty.h | 4 ++-- src/ImportExport/Export.cpp | 4 ++-- src/ImportExport/Export.h | 4 ++-- src/ImportExport/Import.cpp | 4 ++-- src/ImportExport/Import.h | 4 ++-- src/ImportExport/Keys.h | 22 +++++++++---------- src/Managers/Backup.h | 4 ++-- src/Managers/BackupManager.cpp | 4 ++-- src/Managers/BackupManager.h | 4 ++-- src/Managers/MassManager.cpp | 4 ++-- src/Managers/MassManager.h | 4 ++-- src/Managers/ProfileManager.cpp | 4 ++-- src/Managers/ProfileManager.h | 8 ++----- src/Managers/Vfs/Directory.h | 4 ++-- src/Utilities/Crc32.cpp | 4 ++-- src/Utilities/Crc32.h | 4 ++-- src/Utilities/Temp.cpp | 4 ++-- src/Utilities/Temp.h | 4 ++-- 107 files changed, 223 insertions(+), 227 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6340051..548639c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -14,7 +14,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/src/GameData/Accessories.h b/src/GameData/Accessories.h index 78ffa90..0eb4463 100644 --- a/src/GameData/Accessories.h +++ b/src/GameData/Accessories.h @@ -25,7 +25,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace mbst { namespace GameData { +namespace mbst::GameData { struct Accessory { Containers::StringView name; @@ -780,4 +780,4 @@ static const std::map accessories{ // endregion }; -}} +} diff --git a/src/GameData/ArmourSets.h b/src/GameData/ArmourSets.h index 85c1762..b88a83d 100644 --- a/src/GameData/ArmourSets.h +++ b/src/GameData/ArmourSets.h @@ -25,7 +25,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace mbst { namespace GameData { +namespace mbst::GameData { struct ArmourSet { Containers::StringView name; @@ -58,4 +58,4 @@ static const std::map armour_sets { {27, {"Axial Core X-Type"_s, false}}, }; -}} +} diff --git a/src/GameData/LastMissionId.h b/src/GameData/LastMissionId.h index 3f041c8..61c1e7f 100644 --- a/src/GameData/LastMissionId.h +++ b/src/GameData/LastMissionId.h @@ -23,7 +23,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace mbst { namespace GameData { +namespace mbst::GameData { static const std::map mission_id_map {{ // Story missions @@ -59,4 +59,4 @@ static const std::map mission_id_map {{ {400, "Challenge 3 - Gates of Ascension"_s} }}; -}} +} diff --git a/src/GameData/ResourceIDs.h b/src/GameData/ResourceIDs.h index d070355..1affa75 100644 --- a/src/GameData/ResourceIDs.h +++ b/src/GameData/ResourceIDs.h @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -namespace mbst { namespace GameData { +namespace mbst::GameData { enum MaterialID : std::int32_t { VerseSteel = 0xC3500, @@ -48,4 +48,4 @@ enum MaterialID : std::int32_t { IsolatedVoidParticle = 0xDBBA5, }; -}} +} diff --git a/src/GameData/StoryProgress.h b/src/GameData/StoryProgress.h index d620c53..9a891cf 100644 --- a/src/GameData/StoryProgress.h +++ b/src/GameData/StoryProgress.h @@ -22,7 +22,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace mbst { namespace GameData { +namespace mbst::GameData { struct StoryProgressPoint { std::int32_t id{}; @@ -112,4 +112,4 @@ static const Corrade::Containers::Array story_progress } }; -}} +} diff --git a/src/GameData/StyleNames.h b/src/GameData/StyleNames.h index 3dbe5b8..a64a73a 100644 --- a/src/GameData/StyleNames.h +++ b/src/GameData/StyleNames.h @@ -25,7 +25,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace mbst { namespace GameData { +namespace mbst::GameData { extern const std::map builtin_style_names #ifdef STYLENAMES_DEFINITION @@ -162,4 +162,4 @@ extern const std::map builtin_style_names #endif ; -}} +} diff --git a/src/GameData/WeaponParts.h b/src/GameData/WeaponParts.h index e0fb8d8..0f8c8f4 100644 --- a/src/GameData/WeaponParts.h +++ b/src/GameData/WeaponParts.h @@ -25,7 +25,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace mbst { namespace GameData { +namespace mbst::GameData { // region Melee static const std::map melee_grips { @@ -433,4 +433,4 @@ static const std::map elauncher_pods { }; // endregion -}} +} diff --git a/src/GameObjects/Accessory.h b/src/GameObjects/Accessory.h index 6779d2e..d6e6cae 100644 --- a/src/GameObjects/Accessory.h +++ b/src/GameObjects/Accessory.h @@ -24,7 +24,7 @@ using namespace Corrade; using namespace Magnum; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct Accessory { std::int32_t attachIndex = -1; @@ -37,4 +37,4 @@ struct Accessory { Vector3 localScale{1.0f}; }; -}} +} diff --git a/src/GameObjects/ArmourPart.h b/src/GameObjects/ArmourPart.h index 1b8076d..03d2fc5 100644 --- a/src/GameObjects/ArmourPart.h +++ b/src/GameObjects/ArmourPart.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct ArmourPart { enum class Slot { @@ -39,4 +39,4 @@ struct ArmourPart { Containers::Array accessories; }; -}} +} diff --git a/src/GameObjects/BulletLauncherAttachment.h b/src/GameObjects/BulletLauncherAttachment.h index 7f9b58b..a83ffda 100644 --- a/src/GameObjects/BulletLauncherAttachment.h +++ b/src/GameObjects/BulletLauncherAttachment.h @@ -24,7 +24,7 @@ using namespace Corrade; using namespace Magnum; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { enum class BulletLauncherAttachmentStyle { #define c(enumerator, enumstr) enumerator, @@ -46,4 +46,4 @@ struct BulletLauncherAttachment { Vector3 relativeScale; }; -}} +} diff --git a/src/GameObjects/CustomStyle.h b/src/GameObjects/CustomStyle.h index b7d6ec0..29e1f1d 100644 --- a/src/GameObjects/CustomStyle.h +++ b/src/GameObjects/CustomStyle.h @@ -25,7 +25,7 @@ using namespace Corrade; using namespace Magnum; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct CustomStyle { Containers::String name; @@ -50,4 +50,4 @@ struct CustomStyle { } type = Type::Unknown; }; -}} +} diff --git a/src/GameObjects/Decal.h b/src/GameObjects/Decal.h index f071791..7d75670 100644 --- a/src/GameObjects/Decal.h +++ b/src/GameObjects/Decal.h @@ -23,7 +23,7 @@ using namespace Magnum; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct Decal { std::int32_t id = -1; @@ -38,4 +38,4 @@ struct Decal { bool wrap = false; }; -}} +} diff --git a/src/GameObjects/Joints.h b/src/GameObjects/Joints.h index e731e91..ebb294a 100644 --- a/src/GameObjects/Joints.h +++ b/src/GameObjects/Joints.h @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct Joints { float neck = 0.0f; @@ -29,4 +29,4 @@ struct Joints { float lowerLegs = 0.0f; }; -}} +} diff --git a/src/GameObjects/Mass.cpp b/src/GameObjects/Mass.cpp index 9e6f35f..6025185 100644 --- a/src/GameObjects/Mass.cpp +++ b/src/GameObjects/Mass.cpp @@ -34,7 +34,7 @@ using namespace Containers::Literals; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { Mass::Mass(Containers::StringView path) { auto split = Utility::Path::split(path); @@ -402,4 +402,4 @@ Mass::getTuningCategory(Containers::StringView big_node_prop_name, std::int32_t& } } -}} +} diff --git a/src/GameObjects/Mass.h b/src/GameObjects/Mass.h index 3c9d921..13edb42 100644 --- a/src/GameObjects/Mass.h +++ b/src/GameObjects/Mass.h @@ -42,7 +42,7 @@ using namespace Corrade; using namespace Magnum; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { class Mass { public: @@ -213,4 +213,4 @@ class Mass { Containers::String _account; }; -}} +} diff --git a/src/GameObjects/Mass_Armour.cpp b/src/GameObjects/Mass_Armour.cpp index 34b6f9b..2de6d08 100644 --- a/src/GameObjects/Mass_Armour.cpp +++ b/src/GameObjects/Mass_Armour.cpp @@ -29,7 +29,7 @@ using namespace Containers::Literals; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { Containers::ArrayView Mass::armourParts() { @@ -448,4 +448,4 @@ Mass::writeArmourCustomStyle(std::size_t index) { return writeCustomStyle(_armour.customStyles[index], index, armour_styles); } -}} +} diff --git a/src/GameObjects/Mass_DecalsAccessories.cpp b/src/GameObjects/Mass_DecalsAccessories.cpp index fe68000..6b94fc5 100644 --- a/src/GameObjects/Mass_DecalsAccessories.cpp +++ b/src/GameObjects/Mass_DecalsAccessories.cpp @@ -29,7 +29,7 @@ using namespace Containers::Literals; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { void Mass::getDecals(Containers::ArrayView decals, Gvas::Types::ArrayProperty* decal_array) { @@ -153,4 +153,4 @@ Mass::writeAccessories(Containers::ArrayView accessories, Gvas::Types } } -}} +} diff --git a/src/GameObjects/Mass_Frame.cpp b/src/GameObjects/Mass_Frame.cpp index e19f20f..cae1676 100644 --- a/src/GameObjects/Mass_Frame.cpp +++ b/src/GameObjects/Mass_Frame.cpp @@ -26,7 +26,7 @@ using namespace Containers::Literals; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { Joints& Mass::jointSliders() { @@ -408,4 +408,4 @@ Mass::writeFrameCustomStyle(std::size_t index) { return writeCustomStyle(_frame.customStyles[index], index, frame_styles); } -}} +} diff --git a/src/GameObjects/Mass_Styles.cpp b/src/GameObjects/Mass_Styles.cpp index daa0c8d..25311aa 100644 --- a/src/GameObjects/Mass_Styles.cpp +++ b/src/GameObjects/Mass_Styles.cpp @@ -27,7 +27,7 @@ using namespace Containers::Literals; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { Containers::ArrayView Mass::globalStyles() { @@ -155,4 +155,4 @@ Mass::writeCustomStyle(const CustomStyle& style, std::size_t index, Gvas::Types: return true; } -}} +} diff --git a/src/GameObjects/Mass_Weapons.cpp b/src/GameObjects/Mass_Weapons.cpp index ef8f975..5b29e38 100644 --- a/src/GameObjects/Mass_Weapons.cpp +++ b/src/GameObjects/Mass_Weapons.cpp @@ -28,7 +28,7 @@ using namespace Containers::Literals; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { Containers::ArrayView Mass::meleeWeapons() { @@ -385,4 +385,4 @@ Mass::writeWeaponType(Containers::StringView prop_name, Containers::ArrayViewitems.end() ? dynamic_cast(it->get())->quantity : 0; } -}} +} diff --git a/src/GameObjects/Profile.h b/src/GameObjects/Profile.h index 426d2cc..2735b01 100644 --- a/src/GameObjects/Profile.h +++ b/src/GameObjects/Profile.h @@ -26,7 +26,7 @@ using namespace Corrade; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { class Profile { public: @@ -89,4 +89,4 @@ class Profile { Containers::String _lastError; }; -}} +} diff --git a/src/GameObjects/Weapon.cpp b/src/GameObjects/Weapon.cpp index 9f3b230..cc9d646 100644 --- a/src/GameObjects/Weapon.cpp +++ b/src/GameObjects/Weapon.cpp @@ -16,7 +16,7 @@ #include "Weapon.h" -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { Weapon::Weapon(const Weapon& other) { name = other.name; @@ -51,4 +51,4 @@ Weapon::operator=(const Weapon& other) { return *this; } -}} +} diff --git a/src/GameObjects/Weapon.h b/src/GameObjects/Weapon.h index 68c99dc..f72f660 100644 --- a/src/GameObjects/Weapon.h +++ b/src/GameObjects/Weapon.h @@ -29,7 +29,7 @@ using namespace Corrade; using namespace Magnum; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct Weapon { Weapon() = default; @@ -63,4 +63,4 @@ struct Weapon { Color4 effectColour{0.0f}; }; -}} +} diff --git a/src/GameObjects/WeaponPart.h b/src/GameObjects/WeaponPart.h index 595754b..d6e519c 100644 --- a/src/GameObjects/WeaponPart.h +++ b/src/GameObjects/WeaponPart.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace mbst { namespace GameObjects { +namespace mbst::GameObjects { struct WeaponPart { WeaponPart() = default; @@ -64,4 +64,4 @@ struct WeaponPart { Containers::Array accessories{}; }; -}} +} diff --git a/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h index db440d6..e7d6095 100644 --- a/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h +++ b/src/Gvas/Serialisers/AbstractUnrealCollectionProperty.h @@ -27,7 +27,7 @@ using namespace Corrade; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { using PropertyArray = Containers::Array; using PropertyArrayView = Containers::ArrayView; @@ -50,4 +50,4 @@ class AbstractUnrealCollectionProperty { PropertySerialiser& serialiser) = 0; }; -}} +} diff --git a/src/Gvas/Serialisers/AbstractUnrealProperty.h b/src/Gvas/Serialisers/AbstractUnrealProperty.h index 061e95c..a8030c4 100644 --- a/src/Gvas/Serialisers/AbstractUnrealProperty.h +++ b/src/Gvas/Serialisers/AbstractUnrealProperty.h @@ -26,7 +26,7 @@ using namespace Corrade; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { using StringArrayView = Containers::ArrayView; @@ -46,4 +46,4 @@ class AbstractUnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0; }; -}} +} diff --git a/src/Gvas/Serialisers/AbstractUnrealStruct.h b/src/Gvas/Serialisers/AbstractUnrealStruct.h index 715c2e7..b9d1e08 100644 --- a/src/Gvas/Serialisers/AbstractUnrealStruct.h +++ b/src/Gvas/Serialisers/AbstractUnrealStruct.h @@ -27,7 +27,7 @@ using namespace Corrade; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class AbstractUnrealStruct { public: @@ -43,4 +43,4 @@ class AbstractUnrealStruct { std::size_t& bytes_written) = 0; }; -}} +} diff --git a/src/Gvas/Serialisers/ArrayProperty.cpp b/src/Gvas/Serialisers/ArrayProperty.cpp index 0b8a13f..d6c4254 100644 --- a/src/Gvas/Serialisers/ArrayProperty.cpp +++ b/src/Gvas/Serialisers/ArrayProperty.cpp @@ -23,7 +23,7 @@ #include "ArrayProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr ArrayProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -76,4 +76,4 @@ ArrayProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size return ret; } -}} +} diff --git a/src/Gvas/Serialisers/ArrayProperty.h b/src/Gvas/Serialisers/ArrayProperty.h index 2ed6f56..9a0080a 100644 --- a/src/Gvas/Serialisers/ArrayProperty.h +++ b/src/Gvas/Serialisers/ArrayProperty.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class ArrayProperty : public UnrealProperty { public: @@ -38,4 +38,4 @@ class ArrayProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/BoolProperty.cpp b/src/Gvas/Serialisers/BoolProperty.cpp index 3f38495..80de98a 100644 --- a/src/Gvas/Serialisers/BoolProperty.cpp +++ b/src/Gvas/Serialisers/BoolProperty.cpp @@ -20,7 +20,7 @@ #include "BoolProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { StringArrayView BoolProperty::types() { @@ -70,4 +70,4 @@ BoolProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes return true; } -}} +} diff --git a/src/Gvas/Serialisers/BoolProperty.h b/src/Gvas/Serialisers/BoolProperty.h index b36a66d..a80b2e2 100644 --- a/src/Gvas/Serialisers/BoolProperty.h +++ b/src/Gvas/Serialisers/BoolProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class BoolProperty : public AbstractUnrealProperty { public: @@ -41,4 +41,4 @@ class BoolProperty : public AbstractUnrealProperty { PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/ByteProperty.cpp b/src/Gvas/Serialisers/ByteProperty.cpp index ca0a104..fba23ea 100644 --- a/src/Gvas/Serialisers/ByteProperty.cpp +++ b/src/Gvas/Serialisers/ByteProperty.cpp @@ -20,7 +20,7 @@ #include "ByteProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { StringArrayView ByteProperty::types() { @@ -31,7 +31,7 @@ ByteProperty::types() { Types::UnrealPropertyBase::ptr ByteProperty::deserialise(Containers::StringView name, Containers::StringView type, std::size_t value_length, - BinaryIo::Reader& reader, PropertySerialiser& serialiser) + BinaryIo::Reader& reader, PropertySerialiser& serialiser) { auto prop = Containers::pointer(); @@ -91,4 +91,4 @@ ByteProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes return true; } -}} +} diff --git a/src/Gvas/Serialisers/ByteProperty.h b/src/Gvas/Serialisers/ByteProperty.h index f5e97c4..4a80cba 100644 --- a/src/Gvas/Serialisers/ByteProperty.h +++ b/src/Gvas/Serialisers/ByteProperty.h @@ -23,7 +23,7 @@ #include "../Types/ByteProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class ByteProperty : public AbstractUnrealProperty { public: @@ -39,4 +39,4 @@ class ByteProperty : public AbstractUnrealProperty { PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/ColourProperty.cpp b/src/Gvas/Serialisers/ColourProperty.cpp index fd39617..d2923af 100644 --- a/src/Gvas/Serialisers/ColourProperty.cpp +++ b/src/Gvas/Serialisers/ColourProperty.cpp @@ -20,7 +20,7 @@ #include "ColourProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr ColourProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -56,4 +56,4 @@ ColourProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz return true; } -}} +} diff --git a/src/Gvas/Serialisers/ColourProperty.h b/src/Gvas/Serialisers/ColourProperty.h index b86061c..69ac66d 100644 --- a/src/Gvas/Serialisers/ColourProperty.h +++ b/src/Gvas/Serialisers/ColourProperty.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class ColourProperty : public UnrealProperty { public: @@ -38,4 +38,4 @@ class ColourProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/DateTimeProperty.cpp b/src/Gvas/Serialisers/DateTimeProperty.cpp index 1a4caf3..b4b5d9c 100644 --- a/src/Gvas/Serialisers/DateTimeProperty.cpp +++ b/src/Gvas/Serialisers/DateTimeProperty.cpp @@ -20,7 +20,7 @@ #include "DateTimeProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr DateTimeProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, @@ -51,4 +51,4 @@ DateTimeProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s return true; } -}} +} diff --git a/src/Gvas/Serialisers/DateTimeProperty.h b/src/Gvas/Serialisers/DateTimeProperty.h index 6d7822e..8b7dfa0 100644 --- a/src/Gvas/Serialisers/DateTimeProperty.h +++ b/src/Gvas/Serialisers/DateTimeProperty.h @@ -22,7 +22,7 @@ #include "../Types/DateTimeStructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class DateTimeProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class DateTimeProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/EnumProperty.cpp b/src/Gvas/Serialisers/EnumProperty.cpp index c475cf4..04feb7d 100644 --- a/src/Gvas/Serialisers/EnumProperty.cpp +++ b/src/Gvas/Serialisers/EnumProperty.cpp @@ -20,7 +20,7 @@ #include "EnumProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { StringArrayView EnumProperty::types() { @@ -71,4 +71,4 @@ EnumProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& bytes return true; } -}} +} diff --git a/src/Gvas/Serialisers/EnumProperty.h b/src/Gvas/Serialisers/EnumProperty.h index 3ed25f9..97929f3 100644 --- a/src/Gvas/Serialisers/EnumProperty.h +++ b/src/Gvas/Serialisers/EnumProperty.h @@ -23,7 +23,7 @@ #include "../Types/EnumProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class EnumProperty : public AbstractUnrealProperty { public: @@ -39,4 +39,4 @@ class EnumProperty : public AbstractUnrealProperty { PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/FloatProperty.cpp b/src/Gvas/Serialisers/FloatProperty.cpp index 84ee2b1..11be552 100644 --- a/src/Gvas/Serialisers/FloatProperty.cpp +++ b/src/Gvas/Serialisers/FloatProperty.cpp @@ -20,7 +20,7 @@ #include "FloatProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { StringArrayView FloatProperty::types() { @@ -65,4 +65,4 @@ FloatProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& byte return true; } -}} +} diff --git a/src/Gvas/Serialisers/FloatProperty.h b/src/Gvas/Serialisers/FloatProperty.h index 2a94b10..5547a7b 100644 --- a/src/Gvas/Serialisers/FloatProperty.h +++ b/src/Gvas/Serialisers/FloatProperty.h @@ -23,7 +23,7 @@ #include "../Types/FloatProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class FloatProperty : public AbstractUnrealProperty { public: @@ -39,4 +39,4 @@ class FloatProperty : public AbstractUnrealProperty { PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/GuidProperty.cpp b/src/Gvas/Serialisers/GuidProperty.cpp index 8d1f04b..5626346 100644 --- a/src/Gvas/Serialisers/GuidProperty.cpp +++ b/src/Gvas/Serialisers/GuidProperty.cpp @@ -22,7 +22,7 @@ using namespace Containers::Literals; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr GuidProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -53,4 +53,4 @@ GuidProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_ return true; } -}} +} diff --git a/src/Gvas/Serialisers/GuidProperty.h b/src/Gvas/Serialisers/GuidProperty.h index a704a9f..5942be5 100644 --- a/src/Gvas/Serialisers/GuidProperty.h +++ b/src/Gvas/Serialisers/GuidProperty.h @@ -22,7 +22,7 @@ #include "../Types/GuidStructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class GuidProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class GuidProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/IntProperty.cpp b/src/Gvas/Serialisers/IntProperty.cpp index f4b24ea..c08b1ec 100644 --- a/src/Gvas/Serialisers/IntProperty.cpp +++ b/src/Gvas/Serialisers/IntProperty.cpp @@ -20,7 +20,7 @@ #include "IntProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr IntProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -73,4 +73,4 @@ IntProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t return true; } -}} +} diff --git a/src/Gvas/Serialisers/IntProperty.h b/src/Gvas/Serialisers/IntProperty.h index 7b9002b..59e0ca6 100644 --- a/src/Gvas/Serialisers/IntProperty.h +++ b/src/Gvas/Serialisers/IntProperty.h @@ -22,7 +22,7 @@ #include "../Types/IntProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class IntProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class IntProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/MapProperty.cpp b/src/Gvas/Serialisers/MapProperty.cpp index 2925276..041f0f9 100644 --- a/src/Gvas/Serialisers/MapProperty.cpp +++ b/src/Gvas/Serialisers/MapProperty.cpp @@ -24,7 +24,7 @@ using namespace Containers::Literals; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr MapProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -156,4 +156,4 @@ MapProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t return true; } -}} +} diff --git a/src/Gvas/Serialisers/MapProperty.h b/src/Gvas/Serialisers/MapProperty.h index efd6553..044e06e 100644 --- a/src/Gvas/Serialisers/MapProperty.h +++ b/src/Gvas/Serialisers/MapProperty.h @@ -22,7 +22,7 @@ #include "../Types/MapProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class MapProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class MapProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/ResourceProperty.cpp b/src/Gvas/Serialisers/ResourceProperty.cpp index 58f9403..4fd36e4 100644 --- a/src/Gvas/Serialisers/ResourceProperty.cpp +++ b/src/Gvas/Serialisers/ResourceProperty.cpp @@ -25,7 +25,7 @@ using namespace Containers::Literals; -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr ResourceProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, @@ -107,4 +107,4 @@ ResourceProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s return true; } -}} +} diff --git a/src/Gvas/Serialisers/ResourceProperty.h b/src/Gvas/Serialisers/ResourceProperty.h index 351a5bd..d9ef0b3 100644 --- a/src/Gvas/Serialisers/ResourceProperty.h +++ b/src/Gvas/Serialisers/ResourceProperty.h @@ -22,7 +22,7 @@ #include "../Types/ResourceItemValue.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class ResourceProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class ResourceProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/RotatorProperty.cpp b/src/Gvas/Serialisers/RotatorProperty.cpp index c3759a2..bb495d9 100644 --- a/src/Gvas/Serialisers/RotatorProperty.cpp +++ b/src/Gvas/Serialisers/RotatorProperty.cpp @@ -20,7 +20,7 @@ #include "RotatorProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -53,4 +53,4 @@ RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::si return true; } -}} +} diff --git a/src/Gvas/Serialisers/RotatorProperty.h b/src/Gvas/Serialisers/RotatorProperty.h index 63fdb4e..355f1b3 100644 --- a/src/Gvas/Serialisers/RotatorProperty.h +++ b/src/Gvas/Serialisers/RotatorProperty.h @@ -22,7 +22,7 @@ #include "../Types/RotatorStructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class RotatorProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class RotatorProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/Serialisers.h b/src/Gvas/Serialisers/Serialisers.h index 8c8470c..d1bf748 100644 --- a/src/Gvas/Serialisers/Serialisers.h +++ b/src/Gvas/Serialisers/Serialisers.h @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class AbstractUnrealCollectionProperty; class AbstractUnrealProperty; @@ -41,4 +41,4 @@ class UnrealProperty; class Vector2DProperty; class VectorProperty; -}} +} diff --git a/src/Gvas/Serialisers/SetProperty.cpp b/src/Gvas/Serialisers/SetProperty.cpp index dd7220f..e010996 100644 --- a/src/Gvas/Serialisers/SetProperty.cpp +++ b/src/Gvas/Serialisers/SetProperty.cpp @@ -21,7 +21,7 @@ #include "SetProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr SetProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -82,4 +82,4 @@ SetProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_t return true; } -}} +} diff --git a/src/Gvas/Serialisers/SetProperty.h b/src/Gvas/Serialisers/SetProperty.h index 5291d9f..7fa5276 100644 --- a/src/Gvas/Serialisers/SetProperty.h +++ b/src/Gvas/Serialisers/SetProperty.h @@ -22,7 +22,7 @@ #include "../Types/SetProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class SetProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class SetProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/StringProperty.cpp b/src/Gvas/Serialisers/StringProperty.cpp index 0dbe810..c9e36f0 100644 --- a/src/Gvas/Serialisers/StringProperty.cpp +++ b/src/Gvas/Serialisers/StringProperty.cpp @@ -20,7 +20,7 @@ #include "StringProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { StringArrayView StringProperty::types() { @@ -74,4 +74,4 @@ StringProperty::serialise(Types::UnrealPropertyBase::ptr& prop, std::size_t& byt return true; } -}} +} diff --git a/src/Gvas/Serialisers/StringProperty.h b/src/Gvas/Serialisers/StringProperty.h index ceba34b..75d868e 100644 --- a/src/Gvas/Serialisers/StringProperty.h +++ b/src/Gvas/Serialisers/StringProperty.h @@ -23,7 +23,7 @@ #include "../Types/StringProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class StringProperty : public AbstractUnrealProperty { public: @@ -39,4 +39,4 @@ class StringProperty : public AbstractUnrealProperty { PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/Struct.cpp b/src/Gvas/Serialisers/Struct.cpp index c16cccd..ee73e54 100644 --- a/src/Gvas/Serialisers/Struct.cpp +++ b/src/Gvas/Serialisers/Struct.cpp @@ -25,7 +25,7 @@ #include "Struct.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { StringArrayView Struct::types() { @@ -242,4 +242,4 @@ Struct::writeStructValue(Types::StructProperty* prop, std::size_t& bytes_written return true; } -}} +} diff --git a/src/Gvas/Serialisers/Struct.h b/src/Gvas/Serialisers/Struct.h index 18bd2b3..339dd4e 100644 --- a/src/Gvas/Serialisers/Struct.h +++ b/src/Gvas/Serialisers/Struct.h @@ -25,7 +25,7 @@ #include "../Types/StructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionProperty { public: @@ -52,4 +52,4 @@ class Struct : public AbstractUnrealProperty, public AbstractUnrealCollectionPro PropertySerialiser& serialiser); }; -}} +} diff --git a/src/Gvas/Serialisers/TextProperty.cpp b/src/Gvas/Serialisers/TextProperty.cpp index 0d60c11..cd7724a 100644 --- a/src/Gvas/Serialisers/TextProperty.cpp +++ b/src/Gvas/Serialisers/TextProperty.cpp @@ -23,7 +23,7 @@ #include "TextProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr TextProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -91,4 +91,4 @@ TextProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::size_ return true; } -}} +} diff --git a/src/Gvas/Serialisers/TextProperty.h b/src/Gvas/Serialisers/TextProperty.h index 804743f..2b6d2fe 100644 --- a/src/Gvas/Serialisers/TextProperty.h +++ b/src/Gvas/Serialisers/TextProperty.h @@ -22,7 +22,7 @@ #include "../Types/TextProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class TextProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class TextProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/UnrealProperty.h b/src/Gvas/Serialisers/UnrealProperty.h index 208a00f..3b96f15 100644 --- a/src/Gvas/Serialisers/UnrealProperty.h +++ b/src/Gvas/Serialisers/UnrealProperty.h @@ -25,7 +25,7 @@ #include "AbstractUnrealProperty.h" #include "../Types/StructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { template class UnrealProperty : public AbstractUnrealProperty { @@ -73,4 +73,4 @@ class UnrealProperty : public AbstractUnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) = 0; }; -}} +} diff --git a/src/Gvas/Serialisers/Vector2DProperty.cpp b/src/Gvas/Serialisers/Vector2DProperty.cpp index e1eea29..97d228f 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.cpp +++ b/src/Gvas/Serialisers/Vector2DProperty.cpp @@ -20,7 +20,7 @@ #include "Vector2DProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, @@ -53,4 +53,4 @@ Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s return true; } -}} +} diff --git a/src/Gvas/Serialisers/Vector2DProperty.h b/src/Gvas/Serialisers/Vector2DProperty.h index eb1935a..def656b 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.h +++ b/src/Gvas/Serialisers/Vector2DProperty.h @@ -22,7 +22,7 @@ #include "../Types/Vector2DStructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class Vector2DProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class Vector2DProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Serialisers/VectorProperty.cpp b/src/Gvas/Serialisers/VectorProperty.cpp index 964097c..3243a1f 100644 --- a/src/Gvas/Serialisers/VectorProperty.cpp +++ b/src/Gvas/Serialisers/VectorProperty.cpp @@ -21,7 +21,7 @@ #include "VectorProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { Types::UnrealPropertyBase::ptr VectorProperty::deserialiseProperty(Containers::StringView name, Containers::StringView type, std::size_t value_length, @@ -54,4 +54,4 @@ VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz return true; } -}} +} diff --git a/src/Gvas/Serialisers/VectorProperty.h b/src/Gvas/Serialisers/VectorProperty.h index 94ce181..72cea55 100644 --- a/src/Gvas/Serialisers/VectorProperty.h +++ b/src/Gvas/Serialisers/VectorProperty.h @@ -22,7 +22,7 @@ #include "../Types/VectorStructProperty.h" -namespace Gvas { namespace Serialisers { +namespace Gvas::Serialisers { class VectorProperty : public UnrealProperty { public: @@ -36,4 +36,4 @@ class VectorProperty : public UnrealProperty { BinaryIo::Writer& writer, PropertySerialiser& serialiser) override; }; -}} +} diff --git a/src/Gvas/Types/ArrayProperty.h b/src/Gvas/Types/ArrayProperty.h index 2453443..d5a9f1d 100644 --- a/src/Gvas/Types/ArrayProperty.h +++ b/src/Gvas/Types/ArrayProperty.h @@ -23,7 +23,7 @@ #include "UnrealPropertyBase.h" -namespace Gvas { namespace Types { +namespace Gvas::Types { struct ArrayProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -47,4 +47,4 @@ struct ArrayProperty : public UnrealPropertyBase { Containers::Array items; }; -}} +} diff --git a/src/Gvas/Types/BoolProperty.h b/src/Gvas/Types/BoolProperty.h index b32c888..9c19ea7 100644 --- a/src/Gvas/Types/BoolProperty.h +++ b/src/Gvas/Types/BoolProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct BoolProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -34,4 +34,4 @@ struct BoolProperty : public UnrealProperty { } }; -}} +} diff --git a/src/Gvas/Types/ByteProperty.h b/src/Gvas/Types/ByteProperty.h index ec95ac4..4257261 100644 --- a/src/Gvas/Types/ByteProperty.h +++ b/src/Gvas/Types/ByteProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct ByteProperty : public UnrealProperty> { using ptr = Containers::Pointer; @@ -41,4 +41,4 @@ struct ByteProperty : public UnrealProperty> { Containers::String enumValue; }; -}} +} diff --git a/src/Gvas/Types/ColourStructProperty.h b/src/Gvas/Types/ColourStructProperty.h index f614db4..92a174c 100644 --- a/src/Gvas/Types/ColourStructProperty.h +++ b/src/Gvas/Types/ColourStructProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct ColourStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -34,4 +34,4 @@ struct ColourStructProperty : public StructProperty { float r = 0.0f, g = 0.0f, b = 0.0f, a = 0.0f; }; -}} +} diff --git a/src/Gvas/Types/DateTimeStructProperty.h b/src/Gvas/Types/DateTimeStructProperty.h index b20604d..0f05a4b 100644 --- a/src/Gvas/Types/DateTimeStructProperty.h +++ b/src/Gvas/Types/DateTimeStructProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct DateTimeStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -36,4 +36,4 @@ struct DateTimeStructProperty : public StructProperty { std::int64_t timestamp = 0; }; -}} +} diff --git a/src/Gvas/Types/EnumProperty.h b/src/Gvas/Types/EnumProperty.h index e042578..50a9ac3 100644 --- a/src/Gvas/Types/EnumProperty.h +++ b/src/Gvas/Types/EnumProperty.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct EnumProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -37,4 +37,4 @@ struct EnumProperty : public UnrealProperty { Containers::String enumType; }; -}} +} diff --git a/src/Gvas/Types/FloatProperty.h b/src/Gvas/Types/FloatProperty.h index 433d7d8..6a99b6d 100644 --- a/src/Gvas/Types/FloatProperty.h +++ b/src/Gvas/Types/FloatProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct FloatProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -34,4 +34,4 @@ struct FloatProperty : public UnrealProperty { } }; -}} +} diff --git a/src/Gvas/Types/GenericStructProperty.h b/src/Gvas/Types/GenericStructProperty.h index 67028e9..c46e8c4 100644 --- a/src/Gvas/Types/GenericStructProperty.h +++ b/src/Gvas/Types/GenericStructProperty.h @@ -26,7 +26,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct GenericStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -56,4 +56,4 @@ struct GenericStructProperty : public StructProperty { Containers::Array properties; }; -}} +} diff --git a/src/Gvas/Types/GuidStructProperty.h b/src/Gvas/Types/GuidStructProperty.h index e822273..85f83f6 100644 --- a/src/Gvas/Types/GuidStructProperty.h +++ b/src/Gvas/Types/GuidStructProperty.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct GuidStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -37,4 +37,4 @@ struct GuidStructProperty : public StructProperty { Containers::StaticArray<16, char> guid{ValueInit}; }; -}} +} diff --git a/src/Gvas/Types/IntProperty.h b/src/Gvas/Types/IntProperty.h index 6ca3de3..947fc02 100644 --- a/src/Gvas/Types/IntProperty.h +++ b/src/Gvas/Types/IntProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct IntProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -34,4 +34,4 @@ struct IntProperty : public UnrealProperty { } }; -}} +} diff --git a/src/Gvas/Types/MapProperty.h b/src/Gvas/Types/MapProperty.h index 0d8575a..3ba902c 100644 --- a/src/Gvas/Types/MapProperty.h +++ b/src/Gvas/Types/MapProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct MapProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -46,4 +46,4 @@ struct MapProperty : public UnrealPropertyBase { Containers::Array map; }; -}} +} diff --git a/src/Gvas/Types/NoneProperty.h b/src/Gvas/Types/NoneProperty.h index e8e339c..26727c1 100644 --- a/src/Gvas/Types/NoneProperty.h +++ b/src/Gvas/Types/NoneProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct NoneProperty : UnrealPropertyBase { using ptr = Containers::Pointer; @@ -35,4 +35,4 @@ struct NoneProperty : UnrealPropertyBase { } }; -}} +} diff --git a/src/Gvas/Types/ResourceItemValue.h b/src/Gvas/Types/ResourceItemValue.h index 5ae9683..f196e14 100644 --- a/src/Gvas/Types/ResourceItemValue.h +++ b/src/Gvas/Types/ResourceItemValue.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct ResourceItemValue : public StructProperty { using ptr = Containers::Pointer; @@ -41,4 +41,4 @@ struct ResourceItemValue : public StructProperty { std::int32_t quantity = 0; }; -}} +} diff --git a/src/Gvas/Types/RotatorStructProperty.h b/src/Gvas/Types/RotatorStructProperty.h index ad2d676..26d353f 100644 --- a/src/Gvas/Types/RotatorStructProperty.h +++ b/src/Gvas/Types/RotatorStructProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct RotatorStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -36,4 +36,4 @@ struct RotatorStructProperty : public StructProperty { float x = 0.0f, y = 0.0f, z = 0.0f; }; -}} +} diff --git a/src/Gvas/Types/SetProperty.h b/src/Gvas/Types/SetProperty.h index dac31d1..63599dc 100644 --- a/src/Gvas/Types/SetProperty.h +++ b/src/Gvas/Types/SetProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct SetProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -47,4 +47,4 @@ struct SetProperty : public UnrealPropertyBase { Containers::Array items; }; -}} +} diff --git a/src/Gvas/Types/StringProperty.h b/src/Gvas/Types/StringProperty.h index d29f7cb..79b452b 100644 --- a/src/Gvas/Types/StringProperty.h +++ b/src/Gvas/Types/StringProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; using namespace Containers::Literals; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct StringProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -35,4 +35,4 @@ struct StringProperty : public UnrealProperty { } }; -}} +} diff --git a/src/Gvas/Types/StructProperty.h b/src/Gvas/Types/StructProperty.h index bcb48a8..0ddbb3e 100644 --- a/src/Gvas/Types/StructProperty.h +++ b/src/Gvas/Types/StructProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct StructProperty : public UnrealPropertyBase { using ptr = Containers::Pointer; @@ -39,4 +39,4 @@ struct StructProperty : public UnrealPropertyBase { Containers::String structType; }; -}} +} diff --git a/src/Gvas/Types/TextProperty.h b/src/Gvas/Types/TextProperty.h index 15a4432..75420e3 100644 --- a/src/Gvas/Types/TextProperty.h +++ b/src/Gvas/Types/TextProperty.h @@ -25,7 +25,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct TextProperty : public UnrealProperty { using ptr = Containers::Pointer; @@ -40,4 +40,4 @@ struct TextProperty : public UnrealProperty { Containers::Array data; }; -}} +} diff --git a/src/Gvas/Types/Types.h b/src/Gvas/Types/Types.h index 584f8c6..628e565 100644 --- a/src/Gvas/Types/Types.h +++ b/src/Gvas/Types/Types.h @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -namespace Gvas { namespace Types { +namespace Gvas::Types { struct UnrealPropertyBase; template @@ -42,4 +42,4 @@ struct TextProperty; struct Vector2DStructProperty; struct VectorStructProperty; -}} +} diff --git a/src/Gvas/Types/UnrealProperty.h b/src/Gvas/Types/UnrealProperty.h index ce1fd3e..f812cf5 100644 --- a/src/Gvas/Types/UnrealProperty.h +++ b/src/Gvas/Types/UnrealProperty.h @@ -22,7 +22,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { template struct UnrealProperty : public UnrealPropertyBase { @@ -31,4 +31,4 @@ struct UnrealProperty : public UnrealPropertyBase { T value; }; -}} +} diff --git a/src/Gvas/Types/UnrealPropertyBase.h b/src/Gvas/Types/UnrealPropertyBase.h index 2cf2883..31fb8f6 100644 --- a/src/Gvas/Types/UnrealPropertyBase.h +++ b/src/Gvas/Types/UnrealPropertyBase.h @@ -24,7 +24,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct UnrealPropertyBase { using ptr = Containers::Pointer; @@ -36,4 +36,4 @@ struct UnrealPropertyBase { std::size_t valueLength = 0; }; -}} +} diff --git a/src/Gvas/Types/Vector2DStructProperty.h b/src/Gvas/Types/Vector2DStructProperty.h index 3ad8338..f6a7e1f 100644 --- a/src/Gvas/Types/Vector2DStructProperty.h +++ b/src/Gvas/Types/Vector2DStructProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct Vector2DStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -36,4 +36,4 @@ struct Vector2DStructProperty : public StructProperty { float x = 0.0f, y = 0.0f; }; -}} +} diff --git a/src/Gvas/Types/VectorStructProperty.h b/src/Gvas/Types/VectorStructProperty.h index 1960d17..c65c117 100644 --- a/src/Gvas/Types/VectorStructProperty.h +++ b/src/Gvas/Types/VectorStructProperty.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace Gvas { namespace Types { +namespace Gvas::Types { struct VectorStructProperty : public StructProperty { using ptr = Containers::Pointer; @@ -36,4 +36,4 @@ struct VectorStructProperty : public StructProperty { float x = 0.0f, y = 0.0f, z = 0.0f; }; -}} +} diff --git a/src/ImportExport/Export.cpp b/src/ImportExport/Export.cpp index 44d4309..30ca77a 100644 --- a/src/ImportExport/Export.cpp +++ b/src/ImportExport/Export.cpp @@ -26,7 +26,7 @@ #include "Export.h" -namespace mbst { namespace ImportExport { +namespace mbst::ImportExport { static Containers::String last_export_error; @@ -124,4 +124,4 @@ exportStyle(Containers::StringView mass_name, mbst::GameObjects::CustomStyle& st return true; } -}} +} diff --git a/src/ImportExport/Export.h b/src/ImportExport/Export.h index e869a9f..40eda62 100644 --- a/src/ImportExport/Export.h +++ b/src/ImportExport/Export.h @@ -22,10 +22,10 @@ using namespace Corrade; -namespace mbst { namespace ImportExport { +namespace mbst::ImportExport { auto lastExportError() -> Containers::StringView; bool exportStyle(Containers::StringView mass_name, GameObjects::CustomStyle& style); -}} +} diff --git a/src/ImportExport/Import.cpp b/src/ImportExport/Import.cpp index d07a863..decdf35 100644 --- a/src/ImportExport/Import.cpp +++ b/src/ImportExport/Import.cpp @@ -30,7 +30,7 @@ #include "Import.h" -namespace mbst { namespace ImportExport { +namespace mbst::ImportExport { static Containers::String last_import_error; @@ -183,4 +183,4 @@ importStyle(Containers::StringView filename) { return Utility::move(style); } -}} +} diff --git a/src/ImportExport/Import.h b/src/ImportExport/Import.h index d16990a..61d0b77 100644 --- a/src/ImportExport/Import.h +++ b/src/ImportExport/Import.h @@ -22,10 +22,10 @@ using namespace Corrade; -namespace mbst { namespace ImportExport { +namespace mbst::ImportExport { auto lastImportError() -> Containers::StringView; auto importStyle(Containers::StringView filename) -> Containers::Optional; -}} +} diff --git a/src/ImportExport/Keys.h b/src/ImportExport/Keys.h index 0ea1228..eefc2a4 100644 --- a/src/ImportExport/Keys.h +++ b/src/ImportExport/Keys.h @@ -18,19 +18,19 @@ #include -namespace mbst { namespace ImportExport { namespace Keys { +namespace mbst::ImportExport::Keys { enum CustomStyle: std::uint8_t { - Name = 0, // type: string - Colour = 1, // type: Magnum::Color4 - Metallic = 2, // type: float - Gloss = 3, // type: float - Glow = 4, // type: bool - PatternId = 5, // type: std::int32_t - PatternOpacity = 6, // type: float - PatternOffset = 7, // type: Magnum::Vector2 + Name = 0, // type: string + Colour = 1, // type: Magnum::Color4 + Metallic = 2, // type: float + Gloss = 3, // type: float + Glow = 4, // type: bool + PatternId = 5, // type: std::int32_t + PatternOpacity = 6, // type: float + PatternOffset = 7, // type: Magnum::Vector2 PatternRotation = 8, // type: float - PatternScale = 9, // type: float + PatternScale = 9, // type: float }; -}}} +} diff --git a/src/Managers/Backup.h b/src/Managers/Backup.h index db8b014..c644610 100644 --- a/src/Managers/Backup.h +++ b/src/Managers/Backup.h @@ -23,7 +23,7 @@ using namespace Corrade; -namespace mbst { namespace Managers { +namespace mbst::Managers { struct Backup { Containers::String filename; @@ -40,4 +40,4 @@ struct Backup { Containers::Array includedFiles; }; -}} +} diff --git a/src/Managers/BackupManager.cpp b/src/Managers/BackupManager.cpp index 6d7a5b2..be5941a 100644 --- a/src/Managers/BackupManager.cpp +++ b/src/Managers/BackupManager.cpp @@ -33,7 +33,7 @@ #include "BackupManager.h" -namespace mbst { namespace Managers { +namespace mbst::Managers { BackupManager::BackupManager(): _root{""} @@ -335,4 +335,4 @@ BackupManager::scanSubdir(Containers::StringView subdir) { depth--; } -}} +} diff --git a/src/Managers/BackupManager.h b/src/Managers/BackupManager.h index cc7678f..2f48e89 100644 --- a/src/Managers/BackupManager.h +++ b/src/Managers/BackupManager.h @@ -29,7 +29,7 @@ using namespace Corrade; -namespace mbst { namespace Managers { +namespace mbst::Managers { class BackupManager { public: @@ -60,4 +60,4 @@ class BackupManager { Vfs::Directory _root; }; -}} +} diff --git a/src/Managers/MassManager.cpp b/src/Managers/MassManager.cpp index eeb6f8d..19736cc 100644 --- a/src/Managers/MassManager.cpp +++ b/src/Managers/MassManager.cpp @@ -26,7 +26,7 @@ using namespace Containers::Literals; -namespace mbst { namespace Managers { +namespace mbst::Managers { MassManager::MassManager(Containers::StringView account, bool demo): _account{account}, _demo{demo} @@ -268,4 +268,4 @@ MassManager::deleteStagedMass(Containers::StringView filename) { return true; } -}} +} diff --git a/src/Managers/MassManager.h b/src/Managers/MassManager.h index d4e8b71..8135012 100644 --- a/src/Managers/MassManager.h +++ b/src/Managers/MassManager.h @@ -26,7 +26,7 @@ using namespace Corrade; -namespace mbst { namespace Managers { +namespace mbst::Managers { class MassManager { public: @@ -60,4 +60,4 @@ class MassManager { std::map _stagedMasses; }; -}} +} diff --git a/src/Managers/ProfileManager.cpp b/src/Managers/ProfileManager.cpp index 85c1784..6dc724e 100644 --- a/src/Managers/ProfileManager.cpp +++ b/src/Managers/ProfileManager.cpp @@ -29,7 +29,7 @@ using namespace Containers::Literals; -namespace mbst { namespace Managers { +namespace mbst::Managers { ProfileManager::ProfileManager() { _ready = refreshProfiles(); @@ -129,4 +129,4 @@ ProfileManager::deleteProfile(std::size_t index, bool delete_builds) { return true; } -}} +} diff --git a/src/Managers/ProfileManager.h b/src/Managers/ProfileManager.h index 6116518..8418ddf 100644 --- a/src/Managers/ProfileManager.h +++ b/src/Managers/ProfileManager.h @@ -16,10 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include - -#include - #include #include @@ -27,7 +23,7 @@ using namespace Corrade; -namespace mbst { namespace Managers { +namespace mbst::Managers { class ProfileManager { public: @@ -49,4 +45,4 @@ class ProfileManager { Containers::Array _profiles; }; -}} +} diff --git a/src/Managers/Vfs/Directory.h b/src/Managers/Vfs/Directory.h index 5fd600f..afc8fd7 100644 --- a/src/Managers/Vfs/Directory.h +++ b/src/Managers/Vfs/Directory.h @@ -22,7 +22,7 @@ using namespace Corrade; -namespace mbst { namespace Managers { namespace Vfs { +namespace mbst::Managers::Vfs { CORRADE_HAS_TYPE(HasFilename, decltype(T::filename)); @@ -99,4 +99,4 @@ class Directory { Containers::Array _files; }; -}}} +} diff --git a/src/Utilities/Crc32.cpp b/src/Utilities/Crc32.cpp index f293d98..38378db 100644 --- a/src/Utilities/Crc32.cpp +++ b/src/Utilities/Crc32.cpp @@ -16,7 +16,7 @@ #include "Crc32.h" -namespace mbst { namespace Utilities { +namespace mbst::Utilities { std::uint32_t crc32(std::uint32_t initial, Containers::ArrayView data) { @@ -53,4 +53,4 @@ crc32(std::uint32_t initial, Containers::ArrayView data) { return c ^ 0xFFFFFFFF; } -}} +} diff --git a/src/Utilities/Crc32.h b/src/Utilities/Crc32.h index d3dc1cf..a0d56e3 100644 --- a/src/Utilities/Crc32.h +++ b/src/Utilities/Crc32.h @@ -23,8 +23,8 @@ using namespace Corrade; -namespace mbst { namespace Utilities { +namespace mbst::Utilities { auto crc32(std::uint32_t initial, Containers::ArrayView data) -> std::uint32_t; -}} +} diff --git a/src/Utilities/Temp.cpp b/src/Utilities/Temp.cpp index 0a3900f..3e0cdbe 100644 --- a/src/Utilities/Temp.cpp +++ b/src/Utilities/Temp.cpp @@ -23,7 +23,7 @@ #include "Temp.h" -namespace mbst { namespace Utilities { +namespace mbst::Utilities { Containers::String getTempPath(Containers::StringView filename) { @@ -85,4 +85,4 @@ emptyTempDir() { } } -}} +} diff --git a/src/Utilities/Temp.h b/src/Utilities/Temp.h index b7e13ba..80ff65a 100644 --- a/src/Utilities/Temp.h +++ b/src/Utilities/Temp.h @@ -22,7 +22,7 @@ using namespace Corrade; -namespace mbst { namespace Utilities { +namespace mbst::Utilities { auto getTempPath(Containers::StringView filename) -> Containers::String; auto copyToTemp(Containers::StringView path) -> Containers::Optional; @@ -31,4 +31,4 @@ bool moveFromTemp(Containers::StringView filename, Containers::StringView destin bool deleteTempFile(Containers::StringView filename); void emptyTempDir(); -}} +} -- 2.39.5 From 8b8fbee6ba3580d99fc9bf56d72fed40d7e07ef4 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Jul 2024 19:26:12 +0200 Subject: [PATCH 115/126] Gvas,GameObjects,Application: fix UE5 builds. --- src/Application/Application.cpp | 100 +++++++++ src/Application/Application.h | 18 +- src/Application/Application_MassViewer.cpp | 206 +++++++++++------- .../Application_MassViewer_Armour.cpp | 110 ++++++---- .../Application_MassViewer_Frame.cpp | 2 + src/GameObjects/Accessory.h | 14 +- src/GameObjects/BulletLauncherAttachment.h | 14 +- src/GameObjects/Decal.h | 13 +- src/GameObjects/Mass_Armour.cpp | 30 +-- src/GameObjects/Mass_DecalsAccessories.cpp | 53 ++--- src/Gvas/Serialisers/RotatorProperty.cpp | 40 +++- src/Gvas/Serialisers/Vector2DProperty.cpp | 37 +++- src/Gvas/Serialisers/VectorProperty.cpp | 40 +++- src/Gvas/Types/RotatorStructProperty.h | 9 +- src/Gvas/Types/Vector2DStructProperty.h | 9 +- src/Gvas/Types/VectorStructProperty.h | 9 +- 16 files changed, 484 insertions(+), 220 deletions(-) diff --git a/src/Application/Application.cpp b/src/Application/Application.cpp index 33f67d0..eaa712d 100644 --- a/src/Application/Application.cpp +++ b/src/Application/Application.cpp @@ -27,6 +27,8 @@ #include +#include + #include #include #include @@ -419,6 +421,104 @@ Application::drawCheckbox(Containers::StringView label, bool value) { return ImGui::Checkbox(label.data(), &value); } +void +Application::drawVector3Drag(Containers::StringView id, Vector3& vec, float speed, Vector3 min, Vector3 max, + const char* x_format, const char* y_format, const char* z_format, ImGuiSliderFlags_ flags) +{ + ImGui::PushID(id.cbegin()); + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::DragFloat("##X", &vec.x(), speed, min.x(), max.x(), x_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragFloat("##Y", &vec.y(), speed, min.y(), max.y(), y_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragFloat("##Z", &vec.z(), speed, min.z(), max.z(), z_format, flags); + ImGui::PopItemWidth(); + ImGui::PopID(); +} + +void +Application::drawVector3dDrag(Containers::StringView id, Vector3d& vec, float speed, Vector3d min, Vector3d max, + const char* x_format, const char* y_format, const char* z_format, + ImGuiSliderFlags_ flags) +{ + ImGui::PushID(id.cbegin()); + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::DragScalar("##X", ImGuiDataType_Double, &vec.x(), speed, &min.x(), &max.x(), x_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragScalar("##Y", ImGuiDataType_Double, &vec.y(), speed, &min.y(), &max.y(), y_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::DragScalar("##X", ImGuiDataType_Double, &vec.x(), speed, &min.z(), &max.z(), z_format, flags); + ImGui::PopItemWidth(); + ImGui::PopID(); +} + +void +Application::drawVector3Slider(Containers::StringView id, Vector3& vec, Vector3 min, Vector3 max, const char* x_format, + const char* y_format, const char* z_format, ImGuiSliderFlags_ flags) +{ + ImGui::PushID(id.cbegin()); + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::SliderFloat("##X", &vec.x(), min.x(), max.x(), x_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##Y", &vec.y(), min.y(), max.y(), y_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##Z", &vec.z(), min.z(), max.z(), z_format, flags); + ImGui::PopItemWidth(); + ImGui::PopID(); +} + +void +Application::drawVector3dSlider(Containers::StringView id, Vector3d& vec, Vector3d min, Vector3d max, + const char* x_format, const char* y_format, const char* z_format, + ImGuiSliderFlags_ flags) +{ + ImGui::PushID(id.cbegin()); + ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); + ImGui::SliderScalar("##X", ImGuiDataType_Double, &vec.x(), &min.x(), &max.x(), x_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderScalar("##Y", ImGuiDataType_Double, &vec.y(), &min.y(), &max.y(), y_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderScalar("##X", ImGuiDataType_Double, &vec.x(), &min.z(), &max.z(), z_format, flags); + ImGui::PopItemWidth(); + ImGui::PopID(); +} + +void +Application::drawVector2Slider(Containers::StringView id, Vector2& vec, Vector2 min, Vector2 max, const char* x_format, + const char* y_format, ImGuiSliderFlags_ flags) +{ + ImGui::PushID(id.cbegin()); + ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); + ImGui::SliderFloat("##X", &vec.x(), min.x(), max.x(), x_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderFloat("##Y", &vec.y(), min.y(), max.y(), y_format, flags); + ImGui::PopItemWidth(); + ImGui::PopID(); +} + +void +Application::drawVector2dSlider(Containers::StringView id, Vector2d& vec, Vector2d min, Vector2d max, + const char* x_format, const char* y_format, ImGuiSliderFlags_ flags) +{ + ImGui::PushID(id.cbegin()); + ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); + ImGui::SliderScalar("##X", ImGuiDataType_Double, &vec.x(), &min.x(), &max.x(), x_format, flags); + ImGui::PopItemWidth(); + ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); + ImGui::SliderScalar("##Y", ImGuiDataType_Double, &vec.y(), &min.y(), &max.y(), y_format, flags); + ImGui::PopItemWidth(); + ImGui::PopID(); +} + void Application::openUri(Containers::StringView uri) { if(!conf().isRunningInWine()) { diff --git a/src/Application/Application.h b/src/Application/Application.h index 00ce53a..12e9dbb 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -34,7 +34,6 @@ #include #include -#include #include @@ -167,6 +166,23 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawHelpMarker(Containers::StringView text, float wrap_pos = 0.0f); void drawTooltip(Containers::StringView text, float wrap_pos = 0.0f); bool drawCheckbox(Containers::StringView label, bool value); + void drawVector3Drag(Containers::StringView id, Vector3& vec, float speed, Vector3 min, Vector3 max, + const char* x_format, const char* y_format, const char* z_format, + ImGuiSliderFlags_ flags = ImGuiSliderFlags_None); + void drawVector3dDrag(Containers::StringView id, Vector3d& vec, float speed, Vector3d min, Vector3d max, + const char* x_format, const char* y_format, const char* z_format, + ImGuiSliderFlags_ flags = ImGuiSliderFlags_None); + void drawVector3Slider(Containers::StringView id, Vector3& vec, Vector3 min, Vector3 max, const char* x_format, + const char* y_format, const char* z_format, + ImGuiSliderFlags_ flags = ImGuiSliderFlags_None); + void drawVector3dSlider(Containers::StringView id, Vector3d& vec, Vector3d min, Vector3d max, + const char* x_format, const char* y_format, const char* z_format, + ImGuiSliderFlags_ flags = ImGuiSliderFlags_None); + void drawVector2Slider(Containers::StringView id, Vector2& vec, Vector2 min, Vector2 max, const char* x_format, + const char* y_format, ImGuiSliderFlags_ flags = ImGuiSliderFlags_None); + void drawVector2dSlider(Containers::StringView id, Vector2d& vec, Vector2d min, Vector2d max, + const char* x_format, const char* y_format, + ImGuiSliderFlags_ flags = ImGuiSliderFlags_None); template bool drawUnsafeWidget(Functor func, Args... args) { diff --git a/src/Application/Application_MassViewer.cpp b/src/Application/Application_MassViewer.cpp index 1cda5f6..1bd38b9 100644 --- a/src/Application/Application_MassViewer.cpp +++ b/src/Application/Application_MassViewer.cpp @@ -19,6 +19,8 @@ #include +#include + #include "../Configuration/Configuration.h" #include "../FontAwesome/IconsFontAwesome5.h" #include "../GameData/Accessories.h" @@ -450,12 +452,17 @@ Application::drawDecalEditor(GameObjects::Decal& decal) { ImGui::SameLine(); drawHelpMarker("Right-click for more option, click the coloured square for the full picker."); - ImGui::PushMultiItemsWidths(2, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##OffsetX", &decal.offset.x(), 0.0f, 1.0f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##OffsetY", &decal.offset.y(), 0.0f, 1.0f, "Y: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector2Slider("##Offset", arg, Vector2{0.0f}, Vector2{1.0f}, "X: %.3f", "Y: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector2dSlider("##Offset", arg, Vector2d{0.0}, Vector2d{1.0}, "X: %.3f", "Y: %.3f"); + } + }, decal.offset + ); ImGui::SameLine(); drawHelpMarker("0.0 = -100 in-game\n1.0 = 100 in-game"); @@ -489,35 +496,48 @@ Application::drawDecalEditor(GameObjects::Decal& decal) { ImGui::BeginGroup(); ImGui::PushItemWidth(-1.0f); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##PosX", &decal.position.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##PosY", &decal.position.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##PosZ", &decal.position.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##Position", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", + "Y: %.3f", "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##Position", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", + "Y: %.3f", "Z: %.3f"); + } + }, decal.position + ); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##UX", &decal.uAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##UY", &decal.uAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##UZ", &decal.uAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##U", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##U", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + }, decal.uAxis + ); + + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##V", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##V", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + }, decal.vAxis + ); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##VX", &decal.vAxis.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##VY", &decal.vAxis.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##VZ", &decal.vAxis.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); - ImGui::PopItemWidth(); ImGui::PopItemWidth(); ImGui::EndGroup(); } @@ -638,15 +658,15 @@ Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers:: ImGui::Separator(); if(ImGui::BeginListBox("##AccessoryListbox", {-1.0f, 0.0f})) { - for(const auto& acc : GameData::accessories) { - if(acc.first >= tab * 1000 && acc.first < ((tab + 1) * 1000) && (!size || *size == acc.second.size)) { - if(ImGui::Selectable(Utility::format("#{:.4d} - {} ({})", acc.first, acc.second.name, size_labels[acc.second.size]).data(), - acc.first == accessory.id)) + for(const auto& [id, acc] : GameData::accessories) { + if(id >= tab * 1000 && id < ((tab + 1) * 1000) && (!size || *size == acc.size)) { + if(ImGui::Selectable(Utility::format("#{:.4d} - {} ({})", id, acc.name, size_labels[acc.size]).data(), + id == accessory.id)) { - accessory.id = acc.first; + accessory.id = id; accessory.attachIndex = 0; } - if(acc.first == accessory.id) { + if(id == accessory.id) { ImGui::SetItemDefaultFocus(); } } @@ -706,60 +726,78 @@ Application::drawAccessoryEditor(GameObjects::Accessory& accessory, Containers:: ImGui::PopItemWidth(); if(conf().advancedMode()) { - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##PosX", &accessory.relativePosition.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##PosY", &accessory.relativePosition.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##PosZ", &accessory.relativePosition.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##RelativePosition", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", + "Y: %.3f", "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##RelativePosition", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, "X: %.3f", + "Y: %.3f", "Z: %.3f"); + } + }, accessory.relativePosition + ); } - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##PosOffsetX", &accessory.relativePositionOffset.x(), -500.0f, +500.0f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##PosOffsetY", &accessory.relativePositionOffset.y(), -500.0f, +500.0f, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##PosOffsetZ", &accessory.relativePositionOffset.z(), -500.0f, +500.0f, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Slider("##OffsetPosition", arg, Vector3{-500.0f}, Vector3{500.0f}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dSlider("##OffsetPosition", arg, Vector3d{-500.0}, Vector3d{500.0}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + }, accessory.relativePositionOffset + ); ImGui::SameLine(); drawHelpMarker("+/-500.0 = +/-250 in-game"); if(conf().advancedMode()) { - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##RotX", &accessory.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RotY", &accessory.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RotZ", &accessory.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##RelativeRotation", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "Roll: %.3f", + "Yaw: %.3f", "Pitch: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##RelativeRotation", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, + "Roll: %.3f", "Yaw: %.3f", "Pitch: %.3f"); + } + }, accessory.relativePosition + ); } - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##RotOffsetX", &accessory.relativeRotationOffset.x(), -180.0f, +180.0f, "Roll: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##RotOffsetY", &accessory.relativeRotationOffset.y(), -180.0f, +180.0f, "Yaw: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##RotOffsetZ", &accessory.relativeRotationOffset.z(), -180.0f, +180.0f, "Pitch: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Slider("##OffsetRotation", arg, Vector3{-180.0f}, Vector3{180.0f}, "Roll: %.3f", + "Yaw: %.3f", "Pitch: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dSlider("##OffsetRotation", arg, Vector3d{-180.0}, Vector3d{180.0}, "Roll: %.3f", + "Yaw: %.3f", "Pitch: %.3f"); + } + }, accessory.relativeRotationOffset + ); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##ScaleX", &accessory.localScale.x(), -3.0f, +3.0f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##ScaleY", &accessory.localScale.y(), -3.0f, +3.0f, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##ScaleZ", &accessory.localScale.z(), -3.0f, +3.0f, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Slider("##Scale", arg, Vector3{-3.0f}, Vector3{3.0f}, "X: %.3f", "Y: %.3f", "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dSlider("##Scale", arg, Vector3d{-3.0}, Vector3d{3.0}, "X: %.3f", "Y: %.3f", "Z: %.3f"); + } + }, accessory.localScale + ); ImGui::SameLine(); drawHelpMarker("+/-3.0 = +/-150 in-game"); ImGui::EndGroup(); diff --git a/src/Application/Application_MassViewer_Armour.cpp b/src/Application/Application_MassViewer_Armour.cpp index cc323d8..a6e5b3b 100644 --- a/src/Application/Application_MassViewer_Armour.cpp +++ b/src/Application/Application_MassViewer_Armour.cpp @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include "../FontAwesome/IconsFontAwesome5.h" #include "../GameData/ArmourSets.h" #include "../GameData/StyleNames.h" @@ -267,57 +269,75 @@ Application::drawBLAttachment() { ImGui::SameLine(); ImGui::BeginGroup(); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##RelPosX", &placement.relativeLocation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RelPosY", &placement.relativeLocation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RelPosZ", &placement.relativeLocation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##RelativePosition", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, "X: %.3f", + "Y: %.3f", "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##RelativePosition", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, + "X: %.3f", "Y: %.3f", "Z: %.3f"); + } + }, placement.relativeLocation + ); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##OffPosX", &placement.offsetLocation.x(), -500.0f, +500.0f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##OffPosY", &placement.offsetLocation.y(), -500.0f, +500.0f, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##OffPosZ", &placement.offsetLocation.z(), -500.0f, +500.0f, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Slider("##OffsetPosition", arg, Vector3{-500.0f}, Vector3{500.0f}, "X: %.3f", "Y: %.3f", + "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dSlider("##OffsetPosition", arg, Vector3d{-500.0}, Vector3d{500.0}, "X: %.3f", + "Y: %.3f", "Z: %.3f"); + } + }, placement.offsetLocation + ); ImGui::SameLine(); drawHelpMarker("+/-500.0 = +/-250 in-game"); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::DragFloat("##RotX", &placement.relativeRotation.x(), 1.0f, -FLT_MAX, +FLT_MAX, "Roll: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RotY", &placement.relativeRotation.y(), 1.0f, -FLT_MAX, +FLT_MAX, "Yaw: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::DragFloat("##RotZ", &placement.relativeRotation.z(), 1.0f, -FLT_MAX, +FLT_MAX, "Pitch: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Drag("##RelativeRotation", arg, 1.0f, Vector3{-FLT_MAX}, Vector3{FLT_MAX}, + "Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dDrag("##RelativeRotation", arg, 1.0f, Vector3d{-DBL_MAX}, Vector3d{DBL_MAX}, + "Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f"); + } + }, placement.relativeRotation + ); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##RotOffsetZ", &placement.offsetRotation.z(), -180.0f, +180.0f, "Roll: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##RotOffsetX", &placement.offsetRotation.x(), -30.0f, +30.0f, "Pitch: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##RotOffsetY", &placement.offsetRotation.y(), -30.0f, +30.0f, "Yaw: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Slider("##OffsetRotation", arg, Vector3{-30.0f, -30.0f, -180.0f}, + Vector3{30.0f, 30.0f, 180.0f}, "Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dSlider("##OffsetRotation", arg, Vector3d{-30.0, -30.0, -180.0}, + Vector3d{30.0, 30.0, 180.0}, "Pitch: %.3f", "Yaw: %.3f", "Roll: %.3f"); + } + }, placement.offsetRotation + ); - ImGui::PushMultiItemsWidths(3, ImGui::CalcItemWidth()); - ImGui::SliderFloat("##ScaleX", &placement.relativeScale.x(), 0.5f, 1.5f, "X: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##ScaleY", &placement.relativeScale.y(), 0.5f, 1.5f, "Y: %.3f"); - ImGui::PopItemWidth(); - ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x); - ImGui::SliderFloat("##ScaleZ", &placement.relativeScale.z(), 0.5f, 1.5f, "Z: %.3f"); - ImGui::PopItemWidth(); + std::visit( + [this](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + drawVector3Slider("##Scale", arg, Vector3{0.5f}, Vector3{1.5f}, "X: %.3f", "Y: %.3f", "Z: %.3f"); + } + else if constexpr (std::is_same_v) { + drawVector3dSlider("##Scale", arg, Vector3d{0.5}, Vector3d{1.5}, "X: %.3f", "Y: %.3f", "Z: %.3f"); + } + }, placement.relativeScale + ); ImGui::SameLine(); drawHelpMarker("0.5 = 50 in-game\n1.5 = 150 in-game"); ImGui::EndGroup(); diff --git a/src/Application/Application_MassViewer_Frame.cpp b/src/Application/Application_MassViewer_Frame.cpp index 49d4a71..2ccead1 100644 --- a/src/Application/Application_MassViewer_Frame.cpp +++ b/src/Application/Application_MassViewer_Frame.cpp @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include "../FontAwesome/IconsFontAwesome5.h" #include "../GameData/StyleNames.h" diff --git a/src/GameObjects/Accessory.h b/src/GameObjects/Accessory.h index d6e6cae..fbc967d 100644 --- a/src/GameObjects/Accessory.h +++ b/src/GameObjects/Accessory.h @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include @@ -24,17 +26,19 @@ using namespace Corrade; using namespace Magnum; +typedef std::variant Vector3Variant; + namespace mbst::GameObjects { struct Accessory { std::int32_t attachIndex = -1; std::int32_t id = -1; Containers::StaticArray<2, std::int32_t> styles{ValueInit}; - Vector3 relativePosition{0.0f}; - Vector3 relativePositionOffset{0.0f}; - Vector3 relativeRotation{0.0f}; - Vector3 relativeRotationOffset{0.0f}; - Vector3 localScale{1.0f}; + Vector3Variant relativePosition{Vector3{}}; + Vector3Variant relativePositionOffset{Vector3{}}; + Vector3Variant relativeRotation{Vector3{}}; + Vector3Variant relativeRotationOffset{Vector3{}}; + Vector3Variant localScale{Vector3{1.0f}}; }; } diff --git a/src/GameObjects/BulletLauncherAttachment.h b/src/GameObjects/BulletLauncherAttachment.h index a83ffda..6f0234a 100644 --- a/src/GameObjects/BulletLauncherAttachment.h +++ b/src/GameObjects/BulletLauncherAttachment.h @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include +#include #include #include @@ -24,6 +24,8 @@ using namespace Corrade; using namespace Magnum; +typedef std::variant Vector3Variant; + namespace mbst::GameObjects { enum class BulletLauncherAttachmentStyle { @@ -39,11 +41,11 @@ struct BulletLauncherAttachment { #undef c }; Socket socket = Socket::Auto; - Vector3 relativeLocation; - Vector3 offsetLocation; - Vector3 relativeRotation; - Vector3 offsetRotation; - Vector3 relativeScale; + Vector3Variant relativeLocation; + Vector3Variant offsetLocation; + Vector3Variant relativeRotation; + Vector3Variant offsetRotation; + Vector3Variant relativeScale; }; } diff --git a/src/GameObjects/Decal.h b/src/GameObjects/Decal.h index 7d75670..ed11afc 100644 --- a/src/GameObjects/Decal.h +++ b/src/GameObjects/Decal.h @@ -16,6 +16,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include #include @@ -23,15 +25,18 @@ using namespace Magnum; +typedef std::variant Vector2Variant; +typedef std::variant Vector3Variant; + namespace mbst::GameObjects { struct Decal { std::int32_t id = -1; Color4 colour{0.0f}; - Vector3 position{0.0f}; - Vector3 uAxis{0.0f}; - Vector3 vAxis{0.0f}; - Vector2 offset{0.5f}; + Vector3Variant position{Vector3{}}; + Vector3Variant uAxis{Vector3{}}; + Vector3Variant vAxis{Vector3{}}; + Vector2Variant offset{Vector2{0.5f}}; float scale = 0.5f; float rotation = 0.0f; bool flip = false; diff --git a/src/GameObjects/Mass_Armour.cpp b/src/GameObjects/Mass_Armour.cpp index 2de6d08..6a27f0a 100644 --- a/src/GameObjects/Mass_Armour.cpp +++ b/src/GameObjects/Mass_Armour.cpp @@ -255,15 +255,15 @@ Mass::getBulletLauncherAttachments() { } auto rel_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELLOC); - attachment.relativeLocation = Vector3{rel_loc_prop->x, rel_loc_prop->y, rel_loc_prop->z}; + attachment.relativeLocation = rel_loc_prop->vector; auto off_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFLOC); - attachment.offsetLocation = Vector3{off_loc_prop->x, off_loc_prop->y, off_loc_prop->z}; + attachment.offsetLocation = off_loc_prop->vector; auto rel_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELROT); - attachment.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z}; + attachment.relativeRotation = rel_rot_prop->vector; auto off_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFROT); - attachment.offsetRotation = Vector3{off_rot_prop->x, off_rot_prop->y, off_rot_prop->z}; + attachment.offsetRotation = off_rot_prop->vector; auto rel_scale_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELSCALE); - attachment.relativeScale = Vector3{rel_scale_prop->x, rel_scale_prop->y, rel_scale_prop->z}; + attachment.relativeScale = rel_scale_prop->vector; } } @@ -331,25 +331,15 @@ Mass::writeBulletLauncherAttachments() { } auto rel_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELLOC); - rel_loc_prop->x = attachment.relativeLocation.x(); - rel_loc_prop->y = attachment.relativeLocation.y(); - rel_loc_prop->z = attachment.relativeLocation.z(); + rel_loc_prop->vector = attachment.relativeLocation; auto off_loc_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFLOC); - off_loc_prop->x = attachment.offsetLocation.x(); - off_loc_prop->y = attachment.offsetLocation.y(); - off_loc_prop->z = attachment.offsetLocation.z(); + off_loc_prop->vector = attachment.offsetLocation; auto rel_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELROT); - rel_rot_prop->x = attachment.relativeRotation.x(); - rel_rot_prop->y = attachment.relativeRotation.y(); - rel_rot_prop->z = attachment.relativeRotation.z(); + rel_rot_prop->vector = attachment.relativeRotation; auto off_rot_prop = attachment_prop->at(MASS_BL_ATTACHMENT_OFFROT); - off_rot_prop->x = attachment.offsetRotation.x(); - off_rot_prop->y = attachment.offsetRotation.y(); - off_rot_prop->z = attachment.offsetRotation.z(); + off_rot_prop->vector = attachment.offsetRotation; auto rel_scale_prop = attachment_prop->at(MASS_BL_ATTACHMENT_RELSCALE); - rel_scale_prop->x = attachment.relativeScale.x(); - rel_scale_prop->y = attachment.relativeScale.y(); - rel_scale_prop->z = attachment.relativeScale.z(); + rel_scale_prop->vector = attachment.relativeScale; } } diff --git a/src/GameObjects/Mass_DecalsAccessories.cpp b/src/GameObjects/Mass_DecalsAccessories.cpp index 6b94fc5..02ed1b2 100644 --- a/src/GameObjects/Mass_DecalsAccessories.cpp +++ b/src/GameObjects/Mass_DecalsAccessories.cpp @@ -42,13 +42,13 @@ Mass::getDecals(Containers::ArrayView decals, Gvas::Types::ArrayProperty* auto colour_prop = decal_prop->at(MASS_DECAL_COLOUR); decal.colour = Color4{colour_prop->r, colour_prop->g, colour_prop->b, colour_prop->a}; auto pos_prop = decal_prop->at(MASS_DECAL_POSITION); - decal.position = Vector3{pos_prop->x, pos_prop->y, pos_prop->z}; + decal.position = pos_prop->vector; auto u_prop = decal_prop->at(MASS_DECAL_UAXIS); - decal.uAxis = Vector3{u_prop->x, u_prop->y, u_prop->z}; + decal.uAxis = u_prop->vector; auto v_prop = decal_prop->at(MASS_DECAL_VAXIS); - decal.vAxis = Vector3{v_prop->x, v_prop->y, v_prop->z}; + decal.vAxis = v_prop->vector; auto offset_prop = decal_prop->at(MASS_DECAL_OFFSET); - decal.offset = Vector2{offset_prop->x, offset_prop->y}; + decal.offset = offset_prop->vector; decal.scale = decal_prop->at(MASS_DECAL_SCALE)->value; decal.rotation = decal_prop->at(MASS_DECAL_ROTATION)->value; decal.flip = decal_prop->at(MASS_DECAL_FLIP)->value; @@ -70,20 +70,13 @@ Mass::writeDecals(Containers::ArrayView decals, Gvas::Types::ArrayPropert colour_prop->b = decal.colour.b(); colour_prop->a = decal.colour.a(); auto pos_prop = decal_prop->at(MASS_DECAL_POSITION); - pos_prop->x = decal.position.x(); - pos_prop->y = decal.position.y(); - pos_prop->z = decal.position.z(); + pos_prop->vector = decal.position; auto u_prop = decal_prop->at(MASS_DECAL_UAXIS); - u_prop->x = decal.uAxis.x(); - u_prop->y = decal.uAxis.y(); - u_prop->z = decal.uAxis.z(); + u_prop->vector = decal.uAxis; auto v_prop = decal_prop->at(MASS_DECAL_VAXIS); - v_prop->x = decal.vAxis.x(); - v_prop->y = decal.vAxis.y(); - v_prop->z = decal.vAxis.z(); + v_prop->vector = decal.vAxis; auto offset_prop = decal_prop->at(MASS_DECAL_OFFSET); - offset_prop->x = decal.offset.x(); - offset_prop->y = decal.offset.y(); + offset_prop->vector = decal.offset; decal_prop->at(MASS_DECAL_SCALE)->value = decal.scale; decal_prop->at(MASS_DECAL_ROTATION)->value = decal.rotation; decal_prop->at(MASS_DECAL_FLIP)->value = decal.flip; @@ -105,15 +98,15 @@ Mass::getAccessories(Containers::ArrayView accessories, Gvas::Types:: accessory.styles[j] = acc_styles->at(j)->value; } auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); - accessory.relativePosition = Vector3{rel_pos_prop->x, rel_pos_prop->y, rel_pos_prop->z}; + accessory.relativePosition = rel_pos_prop->vector; auto rel_pos_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFPOS); - accessory.relativePositionOffset = Vector3{rel_pos_offset_prop->x, rel_pos_offset_prop->y, rel_pos_offset_prop->z}; + accessory.relativePositionOffset = rel_pos_offset_prop->vector; auto rel_rot_prop = acc_prop->at(MASS_ACCESSORY_RELROT); - accessory.relativeRotation = Vector3{rel_rot_prop->x, rel_rot_prop->y, rel_rot_prop->z}; + accessory.relativeRotation = rel_rot_prop->vector; auto rel_rot_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFROT); - accessory.relativeRotationOffset = Vector3{rel_rot_offset_prop->x, rel_rot_offset_prop->y, rel_rot_offset_prop->z}; + accessory.relativeRotationOffset = rel_rot_offset_prop->vector; auto local_scale_prop = acc_prop->at(MASS_ACCESSORY_SCALE); - accessory.localScale = Vector3{local_scale_prop->x, local_scale_prop->y, local_scale_prop->z}; + accessory.localScale = local_scale_prop->vector; } } @@ -131,25 +124,15 @@ Mass::writeAccessories(Containers::ArrayView accessories, Gvas::Types acc_styles->at(j)->value = accessory.styles[j]; } auto rel_pos_prop = acc_prop->at(MASS_ACCESSORY_RELPOS); - rel_pos_prop->x = accessory.relativePosition.x(); - rel_pos_prop->y = accessory.relativePosition.y(); - rel_pos_prop->z = accessory.relativePosition.z(); + rel_pos_prop->vector = accessory.relativePosition; auto rel_pos_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFPOS); - rel_pos_offset_prop->x = accessory.relativePositionOffset.x(); - rel_pos_offset_prop->y = accessory.relativePositionOffset.y(); - rel_pos_offset_prop->z = accessory.relativePositionOffset.z(); + rel_pos_offset_prop->vector = accessory.relativePositionOffset; auto rel_rot_prop = acc_prop->at(MASS_ACCESSORY_RELROT); - rel_rot_prop->x = accessory.relativeRotation.x(); - rel_rot_prop->y = accessory.relativeRotation.y(); - rel_rot_prop->z = accessory.relativeRotation.z(); + rel_rot_prop->vector = accessory.relativeRotation; auto rel_rot_offset_prop = acc_prop->at(MASS_ACCESSORY_OFFROT); - rel_rot_offset_prop->x = accessory.relativeRotationOffset.x(); - rel_rot_offset_prop->y = accessory.relativeRotationOffset.y(); - rel_rot_offset_prop->z = accessory.relativeRotationOffset.z(); + rel_rot_offset_prop->vector = accessory.relativeRotationOffset; auto local_scale_prop = acc_prop->at(MASS_ACCESSORY_SCALE); - local_scale_prop->x = accessory.localScale.x(); - local_scale_prop->y = accessory.localScale.y(); - local_scale_prop->z = accessory.localScale.z(); + local_scale_prop->vector = accessory.localScale; } } diff --git a/src/Gvas/Serialisers/RotatorProperty.cpp b/src/Gvas/Serialisers/RotatorProperty.cpp index bb495d9..380a618 100644 --- a/src/Gvas/Serialisers/RotatorProperty.cpp +++ b/src/Gvas/Serialisers/RotatorProperty.cpp @@ -28,9 +28,25 @@ RotatorProperty::deserialiseProperty(Containers::StringView name, Containers::St { auto prop = Containers::pointer(); - if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) { - LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name); - return nullptr; + if(value_length == 12) { // UE4 + float x, y, z; + + if(!reader.readFloat(x) || !reader.readFloat(y) || !reader.readFloat(z)) { + LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name); + return nullptr; + } + + prop->vector = Vector3{x, y, z}; + } + else if(value_length == 24) { // UE5 + double x, y, z; + + if(!reader.readDouble(x) || !reader.readDouble(y) || !reader.readDouble(z)) { + LOG_ERROR_FORMAT("Couldn't read rotator property {}'s value.", name); + return nullptr; + } + + prop->vector = Vector3d{x, y, z}; } return prop; @@ -46,9 +62,21 @@ RotatorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::si return false; } - bytes_written += writer.writeValueToArray(rotator->x) + - writer.writeValueToArray(rotator->y) + - writer.writeValueToArray(rotator->z); + std::visit( + [&bytes_written, &writer](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + bytes_written += writer.writeValueToArray(arg.x()) + + writer.writeValueToArray(arg.y()) + + writer.writeValueToArray(arg.z()); + } + else if constexpr (std::is_same_v) { + bytes_written += writer.writeValueToArray(arg.x()) + + writer.writeValueToArray(arg.y()) + + writer.writeValueToArray(arg.z()); + } + }, rotator->vector + ); return true; } diff --git a/src/Gvas/Serialisers/Vector2DProperty.cpp b/src/Gvas/Serialisers/Vector2DProperty.cpp index 97d228f..48adf80 100644 --- a/src/Gvas/Serialisers/Vector2DProperty.cpp +++ b/src/Gvas/Serialisers/Vector2DProperty.cpp @@ -29,9 +29,25 @@ Vector2DProperty::deserialiseProperty(Containers::StringView name, Containers::S { auto prop = Containers::pointer(); - if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y)) { - LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name); - return nullptr; + if(value_length == 8) { // UE4 + float x, y; + + if(!reader.readFloat(x) || !reader.readFloat(y)) { + LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name); + return nullptr; + } + + prop->vector = Vector2{x, y}; + } + else if(value_length == 16) { // UE5 + double x, y; + + if(!reader.readDouble(x) || !reader.readDouble(y)) { + LOG_ERROR_FORMAT("Couldn't read 2D vector property {}'s value.", name); + return nullptr; + } + + prop->vector = Vector2d{x, y}; } return prop; @@ -47,8 +63,19 @@ Vector2DProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::s return false; } - bytes_written += writer.writeValueToArray(vector->x) + - writer.writeValueToArray(vector->y); + std::visit( + [&bytes_written, &writer](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + bytes_written += writer.writeValueToArray(arg.x()) + + writer.writeValueToArray(arg.y()); + } + else if constexpr (std::is_same_v) { + bytes_written += writer.writeValueToArray(arg.x()) + + writer.writeValueToArray(arg.y()); + } + }, vector->vector + ); return true; } diff --git a/src/Gvas/Serialisers/VectorProperty.cpp b/src/Gvas/Serialisers/VectorProperty.cpp index 3243a1f..b66a64f 100644 --- a/src/Gvas/Serialisers/VectorProperty.cpp +++ b/src/Gvas/Serialisers/VectorProperty.cpp @@ -29,9 +29,25 @@ VectorProperty::deserialiseProperty(Containers::StringView name, Containers::Str { auto prop = Containers::pointer(); - if(!reader.readFloat(prop->x) || !reader.readFloat(prop->y) || !reader.readFloat(prop->z)) { - LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name); - return nullptr; + if(value_length == 12) { // UE4 + float x, y, z; + + if(!reader.readFloat(x) || !reader.readFloat(y) || !reader.readFloat(z)) { + LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name); + return nullptr; + } + + prop->vector = Vector3{x, y, z}; + } + else if(value_length == 24) { // UE5 + double x, y, z; + + if(!reader.readDouble(x) || !reader.readDouble(y) || !reader.readDouble(z)) { + LOG_ERROR_FORMAT("Couldn't read vector property {}'s value.", name); + return nullptr; + } + + prop->vector = Vector3d{x, y, z}; } return prop; @@ -47,9 +63,21 @@ VectorProperty::serialiseProperty(Types::UnrealPropertyBase::ptr& prop, std::siz return false; } - bytes_written += writer.writeValueToArray(vector->x) + - writer.writeValueToArray(vector->y) + - writer.writeValueToArray(vector->z); + std::visit( + [&bytes_written, &writer](auto& arg){ + using T = std::decay_t; + if constexpr (std::is_same_v) { + bytes_written += writer.writeValueToArray(arg.x()) + + writer.writeValueToArray(arg.y()) + + writer.writeValueToArray(arg.z()); + } + else if constexpr (std::is_same_v) { + bytes_written += writer.writeValueToArray(arg.x()) + + writer.writeValueToArray(arg.y()) + + writer.writeValueToArray(arg.z()); + } + }, vector->vector + ); return true; } diff --git a/src/Gvas/Types/RotatorStructProperty.h b/src/Gvas/Types/RotatorStructProperty.h index 26d353f..7260930 100644 --- a/src/Gvas/Types/RotatorStructProperty.h +++ b/src/Gvas/Types/RotatorStructProperty.h @@ -16,12 +16,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include +#include + #include "StructProperty.h" using namespace Corrade; +using namespace Magnum; + +typedef std::variant Vector3Variant; namespace Gvas::Types { @@ -33,7 +40,7 @@ struct RotatorStructProperty : public StructProperty { structType = "Rotator"_s; } - float x = 0.0f, y = 0.0f, z = 0.0f; + Vector3Variant vector; }; } diff --git a/src/Gvas/Types/Vector2DStructProperty.h b/src/Gvas/Types/Vector2DStructProperty.h index f6a7e1f..6a2afeb 100644 --- a/src/Gvas/Types/Vector2DStructProperty.h +++ b/src/Gvas/Types/Vector2DStructProperty.h @@ -16,12 +16,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include +#include + #include "StructProperty.h" using namespace Corrade; +using namespace Magnum; + +typedef std::variant Vector2Variant; namespace Gvas::Types { @@ -33,7 +40,7 @@ struct Vector2DStructProperty : public StructProperty { structType = "Vector2D"_s; } - float x = 0.0f, y = 0.0f; + Vector2Variant vector; }; } diff --git a/src/Gvas/Types/VectorStructProperty.h b/src/Gvas/Types/VectorStructProperty.h index c65c117..e9bda3e 100644 --- a/src/Gvas/Types/VectorStructProperty.h +++ b/src/Gvas/Types/VectorStructProperty.h @@ -16,12 +16,19 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include #include +#include + #include "StructProperty.h" using namespace Corrade; +using namespace Magnum; + +typedef std::variant Vector3Variant; namespace Gvas::Types { @@ -33,7 +40,7 @@ struct VectorStructProperty : public StructProperty { structType = "Vector"_s; } - float x = 0.0f, y = 0.0f, z = 0.0f; + Vector3Variant vector{Vector3{}}; }; } -- 2.39.5 From c30334543773a08beaef1bf73ec786de5b45bd64 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Jul 2024 19:38:08 +0200 Subject: [PATCH 116/126] CMakeLists: mark 0.11 support as official. Some of the new stuff still isn't supported yet, but it'll be when the release happens. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 548639c..c7dd92f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -235,7 +235,7 @@ target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_VERSION_PATCH=0 SAVETOOL_VERSION_PRERELEASE=true SAVETOOL_CODENAME="Friendly Valkyrie" - SAVETOOL_SUPPORTED_GAME_VERSION="0.10.x" + SAVETOOL_SUPPORTED_GAME_VERSION="0.11.x" ) if(CMAKE_BUILD_TYPE STREQUAL Debug) -- 2.39.5 From d975dd972363cdc0bdb14547b9ec8f6a22b8d241 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Jul 2024 20:34:32 +0200 Subject: [PATCH 117/126] GameData: add the IDs for the Zenith set. --- src/GameData/ArmourSets.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GameData/ArmourSets.h b/src/GameData/ArmourSets.h index b88a83d..97daa02 100644 --- a/src/GameData/ArmourSets.h +++ b/src/GameData/ArmourSets.h @@ -56,6 +56,9 @@ static const std::map armour_sets { {25, {"Axial Core R-Type"_s, true}}, {26, {"Axial Core S-Type"_s, false}}, {27, {"Axial Core X-Type"_s, false}}, + {28, {"Zenith-X"_s, true}}, + {29, {"Zenith-Y"_s, false}}, + {30, {"Zenith-Z"_s, false}}, }; } -- 2.39.5 From f2927acd506a74caccb1b9137348e9d739a6a93b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sun, 14 Jul 2024 20:35:03 +0200 Subject: [PATCH 118/126] Maps: reorder the armour slots. --- src/Maps/ArmourSlots.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Maps/ArmourSlots.hpp b/src/Maps/ArmourSlots.hpp index 46fbabb..cb51f0b 100644 --- a/src/Maps/ArmourSlots.hpp +++ b/src/Maps/ArmourSlots.hpp @@ -22,6 +22,7 @@ c(Neck, "enuArmorSlots::NewEnumerator3"_s, "Neck"_s) c(UpperBody, "enuArmorSlots::NewEnumerator4"_s, "Upper body"_s) c(MiddleBody, "enuArmorSlots::NewEnumerator5"_s, "Middle body"_s) c(LowerBody, "enuArmorSlots::NewEnumerator6"_s, "Lower body"_s) +c(Backpack, "enuArmorSlots::NewEnumerator23"_s, "Backpack"_s) c(FrontWaist, "enuArmorSlots::NewEnumerator7"_s, "Front waist"_s) c(LeftFrontSkirt, "enuArmorSlots::NewEnumerator8"_s, "Left front skirt"_s) c(RightFrontSkirt, "enuArmorSlots::NewEnumerator9"_s, "Right front skirt"_s) @@ -38,7 +39,6 @@ c(LeftElbow, "enuArmorSlots::NewEnumerator19"_s, "Left elbow"_s) c(RightElbow, "enuArmorSlots::NewEnumerator20"_s, "Right elbow"_s) c(LeftLowerArm, "enuArmorSlots::NewEnumerator21"_s, "Left lower arm"_s) c(RightLowerArm, "enuArmorSlots::NewEnumerator22"_s, "Right lower arm"_s) -c(Backpack, "enuArmorSlots::NewEnumerator23"_s, "Backpack"_s) c(LeftHand, "enuArmorSlots::NewEnumerator24"_s, "Left hand"_s) c(RightHand, "enuArmorSlots::NewEnumerator25"_s, "Right hand"_s) c(LeftUpperLeg, "enuArmorSlots::NewEnumerator26"_s, "Left upper leg"_s) -- 2.39.5 From ce2a8df6a157bb6af41c3f89566c6e5d42ef7a39 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 15 Jul 2024 12:57:36 +0200 Subject: [PATCH 119/126] GameData: add the new weapon parts. --- src/GameData/WeaponParts.h | 52 +++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/src/GameData/WeaponParts.h b/src/GameData/WeaponParts.h index 0f8c8f4..36451eb 100644 --- a/src/GameData/WeaponParts.h +++ b/src/GameData/WeaponParts.h @@ -37,6 +37,7 @@ static const std::map melee_grips { {5, "Guardian Grip (1H)"_s}, {6, "Knight Guard Grip (1H)"_s}, {7, "Saber Guard Grip (1H)"_s}, + {8, "Base Grip (1H)"_s}, {100, "Combat Side Grip (1H)"_s}, {101, "Hollowed Side Grip (1H)"_s}, @@ -44,39 +45,60 @@ static const std::map melee_grips { {103, "Plated Side Grip (1H)"_s}, {104, "Locked Side Grip (1H)"_s}, {105, "Longpoint Side Grip (1H)"_s}, + {106, "Concave Side Grip (1H)"_s}, + {107, "Polehead Side Grip (1H)"_s}, + {108, "Base Side Grip (1H)"_s}, {200, "Combat Dual Grip (1H)"_s}, {201, "Hollowed Dual Grip (1H)"_s}, {202, "Plated Dual Grip (1H)"_s}, + {203, "Concave Dual Grip (1H)"_s}, + {204, "Polehead Dual Grip (1H)"_s}, {400, "Combat Twin Grip (1H)"_s}, {401, "Sepal Twin Grip (1H)"_s}, {402, "Hollowed Twin Grip (1H)"_s}, {403, "Knuckle Guard Twin Grip (1H)"_s}, {404, "Arched Twin Grip (1H)"_s}, + {405, "Handguard Twin Grip (1H)"_s}, + {406, "Fullguard Twin Grip (1H)"_s}, + {407, "Base Twin Grip (1H)"_s}, {1000, "Combat Knuckle (R/L)"_s}, {1001, "Battle Fist (R/L)"_s}, {1002, "Guard Knuckle (R/L)"_s}, + {1003, "Heavy Fist (R/L)"_s}, + {1004, "Thick Fist (R/L)"_s}, + {1005, "Base Fist (R/L)"_s}, {2000, "Combat Polearm (2H)"_s}, {2001, "Dual Guard Polearm (2H)"_s}, {2002, "Sepal Polearm (2H)"_s}, {2003, "Fin Polearm (2H)"_s}, {2004, "Arched Polearm (2H)"_s}, + {2005, "Sharp Polearm (2H)"_s}, + {2006, "Ring Polearm (2H)"_s}, + {2007, "Base Polearm (2H)"_s}, {2100, "Combat Side Polearm (2H)"_s}, {2101, "Plated Side Polearm (2H)"_s}, {2102, "Locked Side Polearm (2H)"_s}, {2103, "Fin Side Polearm (2H)"_s}, + {2104, "Heavy Side Polearm (2H)"_s}, + {2105, "Base Side Polearm (2H)"_s}, {2200, "Combat Dual Polearm (2H)"_s}, + {2201, "Studded Dual Polearm (2H)"_s}, + {2202, "Circular Dual Polearm (2H)"_s}, {2400, "Combat Twin Blade (2H)"_s}, {2401, "Guard Twin Blade (2H)"_s}, {2402, "Sepal Twin Blade (2H)"_s}, {2403, "Fin Twin Blade (2H)"_s}, {2404, "Arched Twin Blade (2H)"_s}, + {2405, "Holder Twin Blade (2H)"_s}, + {2406, "Ring Twin Blade (2H)"_s}, + {2407, "Base Twin Blade (2H)"_s}, }; static const std::map melee_assaulters { @@ -92,6 +114,7 @@ static const std::map melee_assaulters { {9, "Long Flat Gouger"_s}, {10, "Long Curved Blade"_s}, {11, "Long Broad Blade"_s}, + {12, "Base L Sword"_s}, {20, "Long Combat Edge"_s}, {21, "Long Attached Edge"_s}, @@ -105,6 +128,7 @@ static const std::map melee_assaulters { {100, "Short Metal Blade"_s}, {101, "Short Assault Blade"_s}, {102, "Short Fin Blade"_s}, + {103, "Base S Sword"_s}, {120, "Short Combat Edge"_s}, @@ -120,6 +144,7 @@ static const std::map melee_assaulters { {200, "Bracer"_s}, {201, "Custom Bracer"_s}, + {202, "Base Hammer"_s}, {210, "Expanded Bracer"_s}, {211, "Expanded Custom Bracer"_s}, @@ -127,10 +152,18 @@ static const std::map melee_assaulters { {300, "Heavy Smasher"_s}, {301, "Heavy Basher"_s}, {302, "Heavy Torch Mace"_s}, + {303, "Heavy Spike Club"_s}, + {304, "Heavy Diamond Smasher"_s}, + {305, "Heavy Spinning Smasher (Motion)"_s}, + {306, "Base L Mace"_s}, {400, "Light Smasher"_s}, {401, "Light Basher"_s}, {402, "Light Torch Mace"_s}, + {403, "Light Spike Club"_s}, + {404, "Light Diamond Smasher"_s}, + {405, "Light Spinning Smasher"_s}, + {406, "Base S Mace"_s}, {420, "War Hammer"_s}, {421, "Great Hammer"_s}, @@ -142,13 +175,16 @@ static const std::map melee_assaulters { {500, "Combat Lance"_s}, {501, "Gouger Lance"_s}, - + {502, "Pointy Lance"_s}, + {503, "Spinning Pointy Lance (Motion)"_s}, + {504, "Crystal Lance"_s}, {510, "Piercer"_s}, {600, "Short Combat Lance"_s}, - + {601, "Short Pointy Lance"_s}, + {602, "Short Spinning Pointy Lance (Motion)"_s}, + {603, "Short Crystal Lance"_s}, {605, "Short Combat Drill (Motion)"_s}, - {610, "Short Piercer"_s}, {700, "Combat Axe"_s}, @@ -264,6 +300,11 @@ static const std::map bshooter_barrels { {397, "Short D Base Barrel (Detonate)"_s}, {398, "Medium D Base Barrel (Detonate)"_s}, {399, "Long D Base Barrel (Detonate)"_s}, + + {400, "Heavy Burst Barrel (Pile Bunker) (Motion)"_s}, + {401, "Under Guard Barrel (Pile Bunker) (Motion)"_s}, + {402, "Facthold Barrel (Pile Bunker) (Motion)"_s}, + {499, "Long P Base Barrel (Pile Bunker) (Motion)"_s}, }; // endregion @@ -318,6 +359,11 @@ static const std::map eshooter_busters { {397, "Short W Base Buster (Wave)"_s}, {398, "Medium W Base Buster (Wave)"_s}, {399, "Long W Base Buster (Wave)"_s}, + + {400, "Wiredcharge Buster (Prism) (Motion)"_s}, + {402, "Heavyclamp Buster (Prism) (Motion)"_s}, + {402, "Curlescent Buster (Prism) (Motion)"_s}, + {499, "Long P Base Buster (Prism) (Motion)"_s}, }; // endregion -- 2.39.5 From 380f77cc804ff370f736f1efc16a9b6b4e6a5285 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 15 Jul 2024 15:30:32 +0200 Subject: [PATCH 120/126] Application,Game{Data,Objects}: support 0.11 materials. --- src/Application/Application.h | 1 - src/Application/Application_MainManager.cpp | 31 +++++++-------------- src/GameData/ResourceIDs.h | 16 +++++++---- src/GameObjects/Profile.cpp | 16 +++++++---- 4 files changed, 30 insertions(+), 34 deletions(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index 12e9dbb..aea11f5 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -125,7 +125,6 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe void drawGeneralInfo(); void drawResearchInventory(); void drawMaterialRow(Containers::StringView name, std::int32_t tier, GameData::MaterialID id); - void drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier); void drawMassManager(); void drawDeleteMassPopup(int mass_index); void drawDeleteStagedMassPopup(Containers::StringView filename); diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index ba55ea8..2df0abc 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -313,7 +313,7 @@ Application::drawResearchInventory() { drawMaterialRow("Lunarite", 4, GameData::MaterialID::Lunarite); drawMaterialRow("Asterite", 5, GameData::MaterialID::Asterite); drawMaterialRow("Hallite fragma", 6, GameData::MaterialID::HalliteFragma); - drawUnavailableMaterialRow("Unnoctinium", 7); + drawMaterialRow("Unnoctinium", 7, GameData::MaterialID::Unnoctinium); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); @@ -325,19 +325,19 @@ Application::drawResearchInventory() { drawMaterialRow("Soldus", 4, GameData::MaterialID::Soldus); drawMaterialRow("Synthesized N", 5, GameData::MaterialID::SynthesisedN); drawMaterialRow("Nanoc", 6, GameData::MaterialID::Nanoc); - drawUnavailableMaterialRow("Abyssillite", 7); + drawMaterialRow("Abyssillite", 7, GameData::MaterialID::Abyssillite); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted("Architect materials"); - drawMaterialRow("Alcarbonite", 1, GameData::MaterialID::Alcarbonite); - drawMaterialRow("Keriphene", 2, GameData::MaterialID::Keriphene); - drawMaterialRow("Nitinol-CM", 3, GameData::MaterialID::NitinolCM); - drawMaterialRow("Quarkium", 4, GameData::MaterialID::Quarkium); - drawMaterialRow("Alterene", 5, GameData::MaterialID::Alterene); - drawMaterialRow("Cosmium", 6, GameData::MaterialID::Cosmium); - drawUnavailableMaterialRow("Purified quarkium", 7); + drawMaterialRow("Alcarbonite", 1, GameData::MaterialID::Alcarbonite); + drawMaterialRow("Keriphene", 2, GameData::MaterialID::Keriphene); + drawMaterialRow("Nitinol-CM", 3, GameData::MaterialID::NitinolCM); + drawMaterialRow("Quarkium", 4, GameData::MaterialID::Quarkium); + drawMaterialRow("Alterene", 5, GameData::MaterialID::Alterene); + drawMaterialRow("Cosmium", 6, GameData::MaterialID::Cosmium); + drawMaterialRow("Purified quarkium", 7, GameData::MaterialID::PurifiedQuarkium); ImGui::TableNextRow(ImGuiTableRowFlags_Headers); ImGui::TableSetColumnIndex(1); @@ -349,7 +349,7 @@ Application::drawResearchInventory() { drawMaterialRow("Mineral exoskeletology", 4, GameData::MaterialID::MineralExoskeletology); drawMaterialRow("Carbonized skin", 5, GameData::MaterialID::CarbonisedSkin); drawMaterialRow("Isolated void particle", 6, GameData::MaterialID::IsolatedVoidParticle); - drawUnavailableMaterialRow("Weaponised physiology", 7); + drawMaterialRow("Weaponised physiology", 7, GameData::MaterialID::WeaponisedPhysiology); ImGui::EndTable(); } @@ -382,17 +382,6 @@ Application::drawMaterialRow(Containers::StringView name, std::int32_t tier, Gam } } -void -Application::drawUnavailableMaterialRow(Containers::StringView name, std::int32_t tier) { - ImGui::TableNextRow(); - ImGui::TableSetColumnIndex(0); - ImGui::Text("T%i", tier); - ImGui::TableSetColumnIndex(1); - ImGui::TextUnformatted(name.cbegin(), name.cend()); - ImGui::TableSetColumnIndex(2); - ImGui::TextDisabled("Unavailable as of game version " SAVETOOL_SUPPORTED_GAME_VERSION); -} - void Application::drawMassManager() { if(!_massManager) { diff --git a/src/GameData/ResourceIDs.h b/src/GameData/ResourceIDs.h index 1affa75..7f8095e 100644 --- a/src/GameData/ResourceIDs.h +++ b/src/GameData/ResourceIDs.h @@ -25,6 +25,7 @@ enum MaterialID : std::int32_t { Lunarite = 0xC3503, Asterite = 0xC3504, HalliteFragma = 0xC3505, + Unnoctinium = 0xC3506, Ednil = 0xC350A, Nuflalt = 0xC350B, @@ -32,13 +33,15 @@ enum MaterialID : std::int32_t { Soldus = 0xC350D, SynthesisedN = 0xC350E, Nanoc = 0xC350F, + Abyssillite = 0xC3510, - Alcarbonite = 0xC3514, - Keriphene = 0xC3515, - NitinolCM = 0xC3516, - Quarkium = 0xC3517, - Alterene = 0xC3518, - Cosmium = 0xC3519, + Alcarbonite = 0xC3514, + Keriphene = 0xC3515, + NitinolCM = 0xC3516, + Quarkium = 0xC3517, + Alterene = 0xC3518, + Cosmium = 0xC3519, + PurifiedQuarkium = 0xC351A, MixedComposition = 0xDBBA0, VoidResidue = 0xDBBA1, @@ -46,6 +49,7 @@ enum MaterialID : std::int32_t { MineralExoskeletology = 0xDBBA3, CarbonisedSkin = 0xDBBA4, IsolatedVoidParticle = 0xDBBA5, + WeaponisedPhysiology = 0xDBBA6, }; } diff --git a/src/GameObjects/Profile.cpp b/src/GameObjects/Profile.cpp index a83e6ee..fe5f38b 100644 --- a/src/GameObjects/Profile.cpp +++ b/src/GameObjects/Profile.cpp @@ -141,6 +141,7 @@ Profile::refreshValues() { _materials[GameData::MaterialID::Lunarite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Lunarite); _materials[GameData::MaterialID::Asterite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Asterite); _materials[GameData::MaterialID::HalliteFragma] = getResource(PROFILE_MATERIAL, GameData::MaterialID::HalliteFragma); + _materials[GameData::MaterialID::Unnoctinium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Unnoctinium); _materials[GameData::MaterialID::Ednil] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Ednil); _materials[GameData::MaterialID::Nuflalt] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Nuflalt); @@ -148,13 +149,15 @@ Profile::refreshValues() { _materials[GameData::MaterialID::Soldus] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Soldus); _materials[GameData::MaterialID::SynthesisedN] = getResource(PROFILE_MATERIAL, GameData::MaterialID::SynthesisedN); _materials[GameData::MaterialID::Nanoc] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Nanoc); + _materials[GameData::MaterialID::Abyssillite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Abyssillite); - _materials[GameData::MaterialID::Alcarbonite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Alcarbonite); - _materials[GameData::MaterialID::Keriphene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Keriphene); - _materials[GameData::MaterialID::NitinolCM] = getResource(PROFILE_MATERIAL, GameData::MaterialID::NitinolCM); - _materials[GameData::MaterialID::Quarkium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Quarkium); - _materials[GameData::MaterialID::Alterene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Alterene); - _materials[GameData::MaterialID::Cosmium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Cosmium); + _materials[GameData::MaterialID::Alcarbonite] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Alcarbonite); + _materials[GameData::MaterialID::Keriphene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Keriphene); + _materials[GameData::MaterialID::NitinolCM] = getResource(PROFILE_MATERIAL, GameData::MaterialID::NitinolCM); + _materials[GameData::MaterialID::Quarkium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Quarkium); + _materials[GameData::MaterialID::Alterene] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Alterene); + _materials[GameData::MaterialID::Cosmium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::Cosmium); + _materials[GameData::MaterialID::PurifiedQuarkium] = getResource(PROFILE_MATERIAL, GameData::MaterialID::PurifiedQuarkium); _materials[GameData::MaterialID::MixedComposition] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::MixedComposition); _materials[GameData::MaterialID::VoidResidue] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::VoidResidue); @@ -162,6 +165,7 @@ Profile::refreshValues() { _materials[GameData::MaterialID::MineralExoskeletology] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::MineralExoskeletology); _materials[GameData::MaterialID::CarbonisedSkin] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::CarbonisedSkin); _materials[GameData::MaterialID::IsolatedVoidParticle] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::IsolatedVoidParticle); + _materials[GameData::MaterialID::WeaponisedPhysiology] = getResource(PROFILE_QUARK_DATA, GameData::MaterialID::WeaponisedPhysiology); _valid = true; } -- 2.39.5 From 07832e6a89022aed6044d4576a02bb43b655ee29 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 15 Jul 2024 15:31:16 +0200 Subject: [PATCH 121/126] GameObjects: fix a condition. --- src/GameObjects/Profile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GameObjects/Profile.cpp b/src/GameObjects/Profile.cpp index fe5f38b..62a6c50 100644 --- a/src/GameObjects/Profile.cpp +++ b/src/GameObjects/Profile.cpp @@ -264,7 +264,7 @@ Profile::material(GameData::MaterialID id) const { bool Profile::setMaterial(GameData::MaterialID id, std::int32_t amount) { - Containers::StringView container = id > GameData::MaterialID::MixedComposition ? PROFILE_QUARK_DATA : PROFILE_MATERIAL; + Containers::StringView container = id >= GameData::MaterialID::MixedComposition ? PROFILE_QUARK_DATA : PROFILE_MATERIAL; auto mats_prop = _profile.at(container); if(!mats_prop) { -- 2.39.5 From fdb8704f005c1fc9507a06ade14712db3cc3f5f2 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Tue, 16 Jul 2024 13:01:06 +0200 Subject: [PATCH 122/126] GameData: fill missing story/mission data. --- src/GameData/LastMissionId.h | 8 ++++++++ src/GameData/StoryProgress.h | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/GameData/LastMissionId.h b/src/GameData/LastMissionId.h index 61c1e7f..b329b42 100644 --- a/src/GameData/LastMissionId.h +++ b/src/GameData/LastMissionId.h @@ -44,6 +44,12 @@ static const std::map mission_id_map {{ {114, "Mission 15 - Outposts Line of Defense"_s}, {115, "Mission 16 - Hidden in the Pass"_s}, {116, "Mission 17 - Homebase Security"_s}, + {117, "Mission 18 - Molewarp Protection Deal"_s}, + {118, "Mission 19 - Behind the Walls of Ice"_s}, + {119, "Mission 20 - Odin in the Sea of Flames"_s}, + {120, "Mission 21 - Retracing Ruined Shelter"_s}, + {121, "Mission 22 - The Traitor"_s}, + {122, "Mission 23 - Duel of Aces"_s}, // Hunting grounds {200, "Hunt 1 - Desert Pathway Safety"_s}, @@ -52,6 +58,8 @@ static const std::map mission_id_map {{ {203, "Hunt 4 - Depths of the Machineries"_s}, {204, "Hunt 5 - Crater Crashers"_s}, {205, "Hunt 6 - Prototype Performance Tests"_s}, + {206, "Hunt 7 - A Mess in Manufacturing"_s}, + {207, "Hunt 8 - Visitors in Volcanic Fissures"_s}, // Challenges {300, "Challenge 1 - Redline Battlefront"_s}, diff --git a/src/GameData/StoryProgress.h b/src/GameData/StoryProgress.h index 9a891cf..5973afa 100644 --- a/src/GameData/StoryProgress.h +++ b/src/GameData/StoryProgress.h @@ -108,7 +108,27 @@ static const Corrade::Containers::Array story_progress {0x06A5, "Chapter 3"_s, "Returned to hangar"_s, "After mission 16"_s}, {0x06A6, "Chapter 3"_s, "Got mission 17 briefing"_s, "After mission 16"_s}, {0x0708, "Chapter 3"_s, "Debriefing"_s, "After mission 17"_s}, + {0x0709, "Chapter 3"_s, "Returned to hangar"_s, "After mission 17"_s}, {0x070A, "Chapter 3"_s, "Got hunt 6 briefing"_s, "After mission 17"_s}, + {0x070B, "Chapter 3"_s, "Returned to hangar"_s, "After mission 17"_s}, + {0x070C, "Chapter 3"_s, "Got mission 18 briefing"_s, "After mission 17"_s}, + {0x076C, "Chapter 3"_s, "Debriefing"_s, "After mission 18"_s}, + {0x076D, "Chapter 3"_s, "Returned to hangar"_s, "After mission 18"_s}, + {0x076E, "Chapter 3"_s, "Got hunt 7 and mission 19 briefing"_s, "After mission 18"_s}, + + {0x07D0, "Chapter 4"_s, "Debriefing"_s, "After mission 19"_s}, + {0x07D1, "Chapter 4"_s, "Returned to hangar"_s, "After mission 19"_s}, + {0x07D2, "Chapter 4"_s, "Got mission 20 briefing"_s, "After mission 19"_s}, + {0x0834, "Chapter 4"_s, "Debriefing"_s, "After mission 20"_s}, + {0x0835, "Chapter 4"_s, "Returned to hangar"_s, "After mission 20"_s}, + {0x0836, "Chapter 4"_s, "Got hunt 8 and mission 21 briefing"_s, "After mission 20"_s}, + {0x0898, "Chapter 4"_s, "Debriefing"_s, "After mission 21"_s}, + {0x0899, "Chapter 4"_s, "Returned to hangar"_s, "After mission 21"_s}, + {0x089A, "Chapter 4"_s, "Got mission 22 briefing"_s, "After mission 21"_s}, + {0x08FC, "Chapter 4"_s, "Debriefing"_s, "After mission 22"_s}, + {0x08FD, "Chapter 4"_s, "Returned to hangar"_s, "After mission 22"_s}, + {0x08FE, "Chapter 4"_s, "Got mission 23 briefing"_s, "After mission 22"_s}, + {0x0960, "Chapter 4"_s, "Returned to hangar"_s, "After mission 23"_s}, } }; -- 2.39.5 From 478741543299a9d7e1154cd5eb77d0f07f213861 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Tue, 16 Jul 2024 13:01:39 +0200 Subject: [PATCH 123/126] CMakeLists: change the codename. --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c7dd92f..b57651c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -234,7 +234,7 @@ target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_VERSION_MINOR=5 SAVETOOL_VERSION_PATCH=0 SAVETOOL_VERSION_PRERELEASE=true - SAVETOOL_CODENAME="Friendly Valkyrie" + SAVETOOL_CODENAME="Fuckin' UE5..." SAVETOOL_SUPPORTED_GAME_VERSION="0.11.x" ) -- 2.39.5 From db4632182a46dc73fa059102d5837da1c2985710 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 20 Jul 2024 13:22:15 +0200 Subject: [PATCH 124/126] Managers: implement StagedMassManager. --- src/CMakeLists.txt | 3 + src/Managers/StagedMass.h | 30 ++++ src/Managers/StagedMassManager.cpp | 215 +++++++++++++++++++++++++++++ src/Managers/StagedMassManager.h | 52 +++++++ 4 files changed, 300 insertions(+) create mode 100644 src/Managers/StagedMass.h create mode 100644 src/Managers/StagedMassManager.cpp create mode 100644 src/Managers/StagedMassManager.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b57651c..c918b2c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,6 +199,9 @@ add_executable(MassBuilderSaveTool Managers/MassManager.cpp Managers/ProfileManager.h Managers/ProfileManager.cpp + Managers/StagedMass.h + Managers/StagedMassManager.h + Managers/StagedMassManager.cpp Managers/Vfs/Directory.h Maps/ArmourSlots.hpp Maps/BulletLauncherAttachmentStyles.hpp diff --git a/src/Managers/StagedMass.h b/src/Managers/StagedMass.h new file mode 100644 index 0000000..0d48fa9 --- /dev/null +++ b/src/Managers/StagedMass.h @@ -0,0 +1,30 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +using namespace Corrade; + +namespace mbst::Managers { + +struct StagedMass { + Containers::String filename; + Containers::String name; +}; + +} diff --git a/src/Managers/StagedMassManager.cpp b/src/Managers/StagedMassManager.cpp new file mode 100644 index 0000000..20bd5fa --- /dev/null +++ b/src/Managers/StagedMassManager.cpp @@ -0,0 +1,215 @@ +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include + +#include +#include + +#include "../Configuration/Configuration.h" +#include "../GameObjects/Mass.h" +#include "../Logger/Logger.h" +#include "../Utilities/Temp.h" + +#include "StagedMassManager.h" + + +namespace mbst::Managers { + +StagedMassManager::StagedMassManager() { + refresh(); +} + +Containers::StringView +StagedMassManager::lastError() { + return _lastError; +} + +Containers::ArrayView +StagedMassManager::stagedMasses() const { + return _stagedMasses; +} + +const StagedMass& +StagedMassManager::at(Containers::StringView filename) const { + for(const auto& mass : _stagedMasses) { + if(mass.filename == filename) { + return mass; + } + } + + CORRADE_ASSERT_UNREACHABLE("Invalid staged M.A.S.S.!", StagedMass{}); +} + +void +StagedMassManager::refresh() { + _stagedMasses = Containers::Array{}; + + LOG_INFO("Scanning for staged M.A.S.S.es..."); + + scanSubdir(""_s); +} + +void +StagedMassManager::refreshMass(Containers::StringView filename) { + LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); + + bool file_exists = Utility::Path::exists(Utility::Path::join(conf().directories().staging, filename)); + auto index = _stagedMasses.size(); + for(std::size_t i = 0; i < _stagedMasses.size(); ++i) { + if(_stagedMasses[i].filename == filename) { + index = i; + break; + } + } + + if(file_exists) { + if(auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(conf().directories().staging, filename))) { + arrayAppend(_stagedMasses, StagedMass{filename, *name}); + std::sort(_stagedMasses.begin(), _stagedMasses.end(), + [](const StagedMass& a, const StagedMass& b)->bool{ + if(a.filename.contains('/') && !b.filename.contains('/')) { + return true; + } + return a.filename < b.filename; + } + ); + } + else if(index != _stagedMasses.size()) { + arrayRemove(_stagedMasses, index); + } + } + else if(index != _stagedMasses.size()) { + arrayRemove(_stagedMasses, index); + } +} + +bool +StagedMassManager::import(Containers::StringView filename, int index, Containers::StringView new_account, bool demo) { + if(index < 0 || index >= 32) { + LOG_ERROR(_lastError = "Hangar index out of range."_s); + return false; + } + + bool found = false; + for(auto& mass : _stagedMasses) { + if(mass.filename == filename) { + found = true; + break; + } + } + + if(!found) { + LOG_ERROR(_lastError = "Couldn't find "_s + filename + " in the staged M.A.S.S.es."_s); + return false; + } + + auto source = Utility::Path::join(conf().directories().staging, filename); + auto temp_path = Utilities::getTempPath(Utility::Path::split(filename).second()); + Utility::Path::copy(source, temp_path); + + { + GameObjects::Mass mass{temp_path}; + if(!mass.updateAccount(new_account)) { + LOG_ERROR(_lastError = mass.lastError()); + Utility::Path::remove(temp_path); + return false; + } + } + + auto dest = Utility::Path::join(conf().directories().gameSaves, + Utility::format("{}Unit{}{}.sav", demo ? "Demo" : "", index, new_account)); + + if(Utility::Path::exists(dest)) { + Utility::Path::remove(dest); + } + + if(!Utility::Path::move(temp_path, dest)) { + _lastError = Utility::format("Couldn't move {} to hangar {:.2d}", filename, index + 1); + LOG_ERROR(_lastError); + return false; + } + + return true; +} + +bool +StagedMassManager::remove(Containers::StringView filename) { + bool found = false; + for(auto& mass : _stagedMasses) { + if(mass.filename == filename) { + found = true; + break; + } + } + + if(!found || !Utility::Path::remove(Utility::Path::join(conf().directories().staging, filename))) { + LOG_ERROR(_lastError = Utility::format("{} couldn't be found.", filename)); + return false; + } + + return true; +} + +void +StagedMassManager::scanSubdir(Containers::StringView subdir) { + static std::uint8_t depth = 0; + + auto full_subdir = Utility::Path::join(conf().directories().staging, subdir); + + using Flag = Utility::Path::ListFlag; + auto files = Utility::Path::list(full_subdir, Flag::SkipSpecial|Flag::SkipDirectories); + + if(!files) { + LOG_ERROR_FORMAT("{} couldn't be opened.", full_subdir); + return; + } + + auto iter = std::remove_if(files->begin(), files->end(), [](Containers::StringView file){ + return !file.hasSuffix(".sav"_s); + }); + + auto files_view = files->exceptSuffix(files->end() - iter); + + for(Containers::StringView file : files_view) { + if(auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(full_subdir, file))) { + LOG_INFO_FORMAT("Found staged M.A.S.S.: {}", *name); + arrayAppend(_stagedMasses, InPlaceInit, file, *name); + } + else { + LOG_WARNING_FORMAT("Skipped {}.", file); + } + } + + if(depth == 5) { + return; + } + + auto subdirs = Utility::Path::list(full_subdir, Flag::SkipFiles|Flag::SkipSpecial|Flag::SkipDotAndDotDot); + if(!subdirs) { + LOG_ERROR_FORMAT("Couldn't list contents of {}.", full_subdir); + } + + depth++; + + for(auto& dir : *subdirs) { + scanSubdir(Utility::Path::join(subdir, dir)); + } + + depth--; +} + +} diff --git a/src/Managers/StagedMassManager.h b/src/Managers/StagedMassManager.h new file mode 100644 index 0000000..87b1630 --- /dev/null +++ b/src/Managers/StagedMassManager.h @@ -0,0 +1,52 @@ +#pragma once + +// MassBuilderSaveTool +// Copyright (C) 2021-2024 Guillaume Jacquemin +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +#include +#include +#include +#include + +#include "StagedMass.h" + +using namespace Corrade; + +namespace mbst::Managers { + +class StagedMassManager { + public: + explicit StagedMassManager(); + + auto lastError() -> Containers::StringView; + + auto stagedMasses() const -> Containers::ArrayView; + auto at(Containers::StringView filename) const -> const StagedMass&; + + void refresh(); + void refreshMass(Containers::StringView filename); + bool import(Containers::StringView filename, int index, Containers::StringView new_account, bool demo); + bool remove(Containers::StringView filename); + + private: + void scanSubdir(Containers::StringView subdir); + + Containers::String _lastError; + + Containers::Array _stagedMasses; +}; + +} -- 2.39.5 From 57f6364b7f48446ee9b60222946bb5ff004d4c4b Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Sat, 20 Jul 2024 13:29:54 +0200 Subject: [PATCH 125/126] Managers,Application: adapt to StagedMassManager. --- src/Application/Application.h | 3 + src/Application/Application_FileWatcher.cpp | 2 +- .../Application_Initialisation.cpp | 2 + src/Application/Application_MainManager.cpp | 21 +-- src/Managers/MassManager.cpp | 121 ------------------ src/Managers/MassManager.h | 10 -- 6 files changed, 17 insertions(+), 142 deletions(-) diff --git a/src/Application/Application.h b/src/Application/Application.h index aea11f5..9c16709 100644 --- a/src/Application/Application.h +++ b/src/Application/Application.h @@ -40,6 +40,7 @@ #include "../Managers/BackupManager.h" #include "../Managers/MassManager.h" #include "../Managers/ProfileManager.h" +#include "../Managers/StagedMassManager.h" #include "../ToastQueue/ToastQueue.h" #include "../UpdateChecker/UpdateChecker.h" @@ -260,6 +261,8 @@ class Application: public Platform::Sdl2Application, public efsw::FileWatchListe Containers::Pointer _massManager; GameObjects::Mass* _currentMass = nullptr; + Containers::Pointer _stagedMassManager; + GameObjects::Weapon* _currentWeapon = nullptr; Containers::Pointer _fileWatcher; diff --git a/src/Application/Application_FileWatcher.cpp b/src/Application/Application_FileWatcher.cpp index d5cf9a4..3348d8e 100644 --- a/src/Application/Application_FileWatcher.cpp +++ b/src/Application/Application_FileWatcher.cpp @@ -68,7 +68,7 @@ Application::fileUpdateEvent(SDL_Event& event) { std::strlen(static_cast(event.user.data1)), nullptr}; if((event.user.code & StagedUpdate) == StagedUpdate) { - _massManager->refreshStagedMass(filename); + _stagedMassManager->refreshMass(filename); return; } diff --git a/src/Application/Application_Initialisation.cpp b/src/Application/Application_Initialisation.cpp index 0e525ae..c692408 100644 --- a/src/Application/Application_Initialisation.cpp +++ b/src/Application/Application_Initialisation.cpp @@ -117,6 +117,8 @@ Application::initialiseManager() { _backupManager.emplace(); + _stagedMassManager.emplace(); + event.user.code = InitSuccess; SDL_PushEvent(&event); } diff --git a/src/Application/Application_MainManager.cpp b/src/Application/Application_MainManager.cpp index 2df0abc..38e52f6 100644 --- a/src/Application/Application_MainManager.cpp +++ b/src/Application/Application_MainManager.cpp @@ -438,7 +438,7 @@ Application::drawMassManager() { Containers::StringView file = *static_cast(payload->Data); - if(!_massManager->importMass(file, i)) { + if(!_stagedMassManager->import(file, i, _currentProfile->account(), _currentProfile->isDemo())) { _queue.addToast(Toast::Type::Error, _massManager->lastError()); } } @@ -530,26 +530,26 @@ Application::drawMassManager() { openUri(Utility::Path::toNativeSeparators(conf().directories().staging)); } - for(const auto& pair : _massManager->stagedMasses()) { + for(const auto& mass : _stagedMassManager->stagedMasses()) { ImGui::TableNextRow(); ImGui::TableSetColumnIndex(0); - Containers::String staged_formatted = Utility::format("{} ({})", pair.second, pair.first); + Containers::String staged_formatted = Utility::format("{} ({})", mass.name, mass.filename); ImGui::Selectable(staged_formatted.data()); if((ImGui::CalcTextSize(staged_formatted.data()).x + ImGui::GetStyle().FramePadding.x) > ImGui::GetContentRegionAvail().x) { drawTooltip(staged_formatted.data()); } if(ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceNoHoldToOpenOthers)) { - ImGui::SetDragDropPayload("StagedMass", &(pair.first), sizeof(Containers::String)); + ImGui::SetDragDropPayload("StagedMass", &(mass.filename), sizeof(Containers::String)); - ImGui::Text("%s - Staged", pair.second.data()); + ImGui::Text("%s - Staged", mass.name.cbegin()); ImGui::EndDragDropSource(); } ImGui::TableSetColumnIndex(1); - ImGui::PushID(pair.first.data()); + ImGui::PushID(mass.filename.data()); if(ImGui::SmallButton(ICON_FA_TRASH_ALT)) { - staged_mass_to_delete = pair.first; + staged_mass_to_delete = mass.filename; ImGui::OpenPopup("Confirmation##DeleteStagedMassConfirmation"); } drawTooltip("Delete"); @@ -644,7 +644,7 @@ Application::drawDeleteStagedMassPopup(Containers::StringView filename) { ImGui::PushTextWrapPos(float(windowSize().x()) * 0.40f); ImGui::Text("Are you sure you want to delete the staged M.A.S.S. named %s ? This operation is irreversible.", - _massManager->stagedMasses().at(filename).data()); + _stagedMassManager->at(filename).filename.cbegin()); ImGui::PopTextWrapPos(); if(ImGui::BeginTable("##DeleteStagedMassLayout", 2)) { @@ -655,8 +655,9 @@ Application::drawDeleteStagedMassPopup(Containers::StringView filename) { ImGui::TableSetColumnIndex(1); if(ImGui::Button("Yes")) { - if(!_massManager->deleteStagedMass(filename)) { - _queue.addToast(Toast::Type::Error, _massManager->lastError()); + if(!_stagedMassManager->remove(filename)) { + _queue.addToast(Toast::Type::Error, + "Couldn't delete the staged M.A.S.S. at " + filename + ": " + _stagedMassManager->lastError()); } ImGui::CloseCurrentPopup(); } diff --git a/src/Managers/MassManager.cpp b/src/Managers/MassManager.cpp index 19736cc..80c5f4a 100644 --- a/src/Managers/MassManager.cpp +++ b/src/Managers/MassManager.cpp @@ -37,8 +37,6 @@ MassManager::MassManager(Containers::StringView account, bool demo): Utility::format("{}Unit{:.2d}{}.sav", demo ? "Demo"_s : ""_s, i, _account)); new(&_hangars[i]) GameObjects::Mass{mass_filename}; } - - refreshStagedMasses(); } Containers::StringView @@ -65,49 +63,6 @@ MassManager::refreshHangar(std::int32_t hangar) { _hangars[hangar] = GameObjects::Mass{mass_filename}; } -bool -MassManager::importMass(Containers::StringView staged_fn, std::int32_t hangar) { - if(hangar < 0 || hangar >= 32) { - _lastError = "Hangar index out of range."; - LOG_ERROR(_lastError); - return false; - } - - auto it = _stagedMasses.find(Containers::String::nullTerminatedView(staged_fn)); - - if(it == _stagedMasses.end()) { - _lastError = "Couldn't find "_s + staged_fn + " in the staged M.A.S.S.es."_s; - LOG_ERROR(_lastError); - return false; - } - - Containers::String source = Utility::Path::join(conf().directories().staging, staged_fn); - Utility::Path::copy(source, source + ".tmp"_s); - - { - GameObjects::Mass mass{source + ".tmp"_s}; - if(!mass.updateAccount(_account)) { - _lastError = mass.lastError(); - Utility::Path::remove(source + ".tmp"_s); - return false; - } - } - - Containers::String dest = Utility::Path::join(conf().directories().gameSaves, _hangars[hangar].filename()); - - if(Utility::Path::exists(dest)) { - Utility::Path::remove(dest); - } - - if(!Utility::Path::move(source + ".tmp"_s, dest)) { - _lastError = Utility::format("Couldn't move {} to hangar {:.2d}", staged_fn, hangar + 1); - LOG_ERROR(_lastError); - return false; - } - - return true; -} - bool MassManager::exportMass(std::int32_t hangar) { if(hangar < 0 || hangar >= 32) { @@ -192,80 +147,4 @@ MassManager::deleteMass(std::int32_t hangar) { return true; } -const std::map& -MassManager::stagedMasses() { - return _stagedMasses; -} - -void -MassManager::refreshStagedMasses() { - _stagedMasses.clear(); - - using Utility::Path::ListFlag; - auto file_list = Utility::Path::list(conf().directories().staging, - ListFlag::SkipSpecial|ListFlag::SkipDirectories|ListFlag::SkipDotAndDotDot); - - if(!file_list) { - LOG_ERROR_FORMAT("{} couldn't be opened.", conf().directories().staging); - return; - } - - auto iter = std::remove_if(file_list->begin(), file_list->end(), [](Containers::StringView file){ - return !file.hasSuffix(".sav"_s); - }); - - auto list_view = file_list->exceptSuffix(file_list->end() - iter); - - LOG_INFO("Scanning for staged M.A.S.S.es..."); - for(Containers::StringView file : list_view) { - auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(conf().directories().staging, file)); - - if(name) { - LOG_INFO_FORMAT("Found staged M.A.S.S.: {}", *name); - _stagedMasses[file] = *name; - } - else { - LOG_WARNING_FORMAT("Skipped {}.", file); - } - } -} - -void -MassManager::refreshStagedMass(Containers::StringView filename) { - LOG_INFO_FORMAT("Refreshing staged unit with filename {}.", filename); - - bool file_exists = Utility::Path::exists(Utility::Path::join(conf().directories().staging, filename)); - auto it = _stagedMasses.find(filename); - - if(file_exists) { - auto name = GameObjects::Mass::getNameFromFile(Utility::Path::join(conf().directories().staging, filename)); - if(name) { - _stagedMasses[filename] = *name; - } - else if(it != _stagedMasses.cend()) { - _stagedMasses.erase(it); - } - } - else if(it != _stagedMasses.cend()) { - _stagedMasses.erase(it); - } -} - -bool -MassManager::deleteStagedMass(Containers::StringView filename) { - if(_stagedMasses.find(filename) == _stagedMasses.cend()) { - _lastError = "The file "_s + filename + " couldn't be found in the list of staged M.A.S.S.es."_s; - LOG_ERROR(_lastError); - return false; - } - - if(!Utility::Path::remove(Utility::Path::join(conf().directories().staging, filename))) { - _lastError = filename + " couldn't be deleted: " + std::strerror(errno); - LOG_ERROR(_lastError); - return false; - } - - return true; -} - } diff --git a/src/Managers/MassManager.h b/src/Managers/MassManager.h index 8135012..eda9a9a 100644 --- a/src/Managers/MassManager.h +++ b/src/Managers/MassManager.h @@ -16,8 +16,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -#include - #include #include #include @@ -38,17 +36,11 @@ class MassManager { void refreshHangar(int hangar); - bool importMass(Containers::StringView staged_fn, int hangar); bool exportMass(int hangar); bool moveMass(int source, int destination); bool deleteMass(int hangar); - auto stagedMasses() -> std::map const&; - void refreshStagedMasses(); - void refreshStagedMass(Containers::StringView filename); - bool deleteStagedMass(Containers::StringView filename); - private: Containers::StringView _account; bool _demo; @@ -56,8 +48,6 @@ class MassManager { Containers::String _lastError; Containers::StaticArray<32, GameObjects::Mass> _hangars{NoInit}; - - std::map _stagedMasses; }; } -- 2.39.5 From 40f2d884336f08538e6d1d722e01c9c510bd174d Mon Sep 17 00:00:00 2001 From: Guillaume Jacquemin Date: Mon, 22 Jul 2024 11:00:13 +0200 Subject: [PATCH 126/126] CMakeLists: bump version number --- src/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c918b2c..8fbd5ec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,7 +18,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(SAVETOOL_PROJECT_VERSION 1.5.0-pre) +set(SAVETOOL_PROJECT_VERSION 1.5.0) find_package(Corrade REQUIRED Containers Utility) if(CORRADE_TARGET_WINDOWS) @@ -236,7 +236,7 @@ target_compile_definitions(MassBuilderSaveTool PRIVATE SAVETOOL_VERSION_MAJOR=1 SAVETOOL_VERSION_MINOR=5 SAVETOOL_VERSION_PATCH=0 - SAVETOOL_VERSION_PRERELEASE=true + SAVETOOL_VERSION_PRERELEASE=false SAVETOOL_CODENAME="Fuckin' UE5..." SAVETOOL_SUPPORTED_GAME_VERSION="0.11.x" ) -- 2.39.5