diff --git a/plugins/libimhex/include/hex/helpers/shared_data.hpp b/plugins/libimhex/include/hex/helpers/shared_data.hpp index fa2a6b494..19c720722 100644 --- a/plugins/libimhex/include/hex/helpers/shared_data.hpp +++ b/plugins/libimhex/include/hex/helpers/shared_data.hpp @@ -53,6 +53,8 @@ namespace hex { static std::vector views; static std::vector toolsEntries; static std::vector dataInspectorEntries; + static u32 patternPaletteOffset; + static std::string errorPopupMessage; static int mainArgc; static char **mainArgv; diff --git a/plugins/libimhex/include/hex/lang/pattern_data.hpp b/plugins/libimhex/include/hex/lang/pattern_data.hpp index b8ab1185a..561c6ed51 100644 --- a/plugins/libimhex/include/hex/lang/pattern_data.hpp +++ b/plugins/libimhex/include/hex/lang/pattern_data.hpp @@ -45,10 +45,10 @@ namespace hex::lang { if (color != 0) return; - this->m_color = Palette[PatternData::s_paletteOffset++]; + this->m_color = Palette[SharedData::patternPaletteOffset++]; - if (PatternData::s_paletteOffset >= (sizeof(Palette) / sizeof(u32))) - PatternData::s_paletteOffset = 0; + if (SharedData::patternPaletteOffset >= (sizeof(Palette) / sizeof(u32))) + SharedData::patternPaletteOffset = 0; } virtual ~PatternData() = default; @@ -143,7 +143,7 @@ namespace hex::lang { return false; } - static void resetPalette() { PatternData::s_paletteOffset = 0; } + static void resetPalette() { SharedData::patternPaletteOffset = 0; } protected: void createDefaultEntry(std::string_view value) const { @@ -179,9 +179,6 @@ namespace hex::lang { u32 m_color; std::string m_variableName; std::string m_typeName; - - static inline u8 s_paletteOffset = 0; - }; class PatternDataPadding : public PatternData { diff --git a/plugins/libimhex/include/hex/views/view.hpp b/plugins/libimhex/include/hex/views/view.hpp index 9e5a9d023..c6ab1f3aa 100644 --- a/plugins/libimhex/include/hex/views/view.hpp +++ b/plugins/libimhex/include/hex/views/view.hpp @@ -51,8 +51,6 @@ namespace hex { private: std::string m_viewName; bool m_windowOpen = false; - - static inline std::string s_errorMessage; }; } \ No newline at end of file diff --git a/plugins/libimhex/source/helpers/shared_data.cpp b/plugins/libimhex/source/helpers/shared_data.cpp index 2328ec7b8..bca02e73c 100644 --- a/plugins/libimhex/source/helpers/shared_data.cpp +++ b/plugins/libimhex/source/helpers/shared_data.cpp @@ -14,6 +14,8 @@ namespace hex { std::vector SharedData::views; std::vector SharedData::toolsEntries; std::vector SharedData::dataInspectorEntries; + u32 SharedData::patternPaletteOffset; + std::string SharedData::errorPopupMessage; int SharedData::mainArgc; char **SharedData::mainArgv; diff --git a/plugins/libimhex/source/views/view.cpp b/plugins/libimhex/source/views/view.cpp index 6bbe3dd41..90a254ae2 100644 --- a/plugins/libimhex/source/views/view.cpp +++ b/plugins/libimhex/source/views/view.cpp @@ -28,8 +28,8 @@ namespace hex { if (ImGui::BeginPopupModal("Error", nullptr, ImGuiWindowFlags_NoResize)) { ImGui::NewLine(); if (ImGui::BeginChild("##scrolling", ImVec2(300, 100))) { - ImGui::SetCursorPosX((300 - ImGui::CalcTextSize(View::s_errorMessage.c_str(), nullptr, false).x) / 2.0F); - ImGui::TextWrapped("%s", View::s_errorMessage.c_str()); + ImGui::SetCursorPosX((300 - ImGui::CalcTextSize(SharedData::errorPopupMessage.c_str(), nullptr, false).x) / 2.0F); + ImGui::TextWrapped("%s", SharedData::errorPopupMessage.c_str()); ImGui::EndChild(); } ImGui::NewLine(); @@ -41,7 +41,7 @@ namespace hex { } void View::showErrorPopup(std::string_view errorMessage) { - View::s_errorMessage = errorMessage; + SharedData::errorPopupMessage = errorMessage; ImGui::OpenPopup("Error"); }