diff --git a/plugins/builtin/CMakeLists.txt b/plugins/builtin/CMakeLists.txt index ca00aac7a..c521a3e3f 100644 --- a/plugins/builtin/CMakeLists.txt +++ b/plugins/builtin/CMakeLists.txt @@ -13,8 +13,6 @@ add_library(${PROJECT_NAME} SHARED source/content/tools_entries.cpp source/content/data_processor_nodes.cpp - source/content/footer_items.cpp - source/math_evaluator.cpp source/lang/en_US.cpp diff --git a/plugins/builtin/source/content/footer_items.cpp b/plugins/builtin/source/content/footer_items.cpp deleted file mode 100644 index 061a7def9..000000000 --- a/plugins/builtin/source/content/footer_items.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include - -#if defined(OS_WINDOWS) - #include - #include -#endif - -namespace hex::plugin::builtin { - - void addFooterItems() { - - #if defined(OS_WINDOWS) - ContentRegistry::Interface::addFooterItem([] { - static MEMORYSTATUSEX memInfo; - static PROCESS_MEMORY_COUNTERS_EX pmc; - - if (ImGui::GetFrameCount() % 60 == 0) { - memInfo.dwLength = sizeof(MEMORYSTATUSEX); - GlobalMemoryStatusEx(&memInfo); - GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast(&pmc), sizeof(pmc)); - } - - auto totalMem = memInfo.ullTotalPhys; - auto usedMem = pmc.PrivateUsage; - - ImGui::TextUnformatted(hex::format("{0} / {1}", hex::toByteString(usedMem), hex::toByteString(totalMem)).c_str()); - }); - #endif - } - -} \ No newline at end of file diff --git a/plugins/builtin/source/plugin_builtin.cpp b/plugins/builtin/source/plugin_builtin.cpp index 58fae7bdc..271094347 100644 --- a/plugins/builtin/source/plugin_builtin.cpp +++ b/plugins/builtin/source/plugin_builtin.cpp @@ -9,8 +9,6 @@ namespace hex::plugin::builtin { void registerSettings(); void registerDataProcessorNodes(); - void addFooterItems(); - void registerLanguageEnUS(); void registerLanguageDeDE(); void registerLanguageItIT(); @@ -28,8 +26,6 @@ IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") { registerSettings(); registerDataProcessorNodes(); - addFooterItems(); - registerLanguageEnUS(); registerLanguageDeDE(); registerLanguageItIT(); diff --git a/plugins/windows/CMakeLists.txt b/plugins/windows/CMakeLists.txt index b8750fda8..456a2a64b 100644 --- a/plugins/windows/CMakeLists.txt +++ b/plugins/windows/CMakeLists.txt @@ -11,6 +11,8 @@ if (WIN32) source/views/view_tty_console.cpp source/lang/en_US.cpp + + source/content/footer_items.cpp ) # Add additional include directories here # diff --git a/plugins/windows/source/content/footer_items.cpp b/plugins/windows/source/content/footer_items.cpp new file mode 100644 index 000000000..391004aeb --- /dev/null +++ b/plugins/windows/source/content/footer_items.cpp @@ -0,0 +1,40 @@ +#include + +#include +#include + +namespace hex::plugin::windows { + + static ULONGLONG subtractTimes(const FILETIME &left, const FILETIME &right) { + LARGE_INTEGER a, b; + + a.LowPart = left.dwLowDateTime; + a.HighPart = left.dwHighDateTime; + + b.LowPart = right.dwLowDateTime; + b.HighPart = right.dwHighDateTime; + + return a.QuadPart - b.QuadPart; + } + + void addFooterItems() { + + ContentRegistry::Interface::addFooterItem([] { + static MEMORYSTATUSEX memInfo; + static PROCESS_MEMORY_COUNTERS_EX pmc; + + if (ImGui::GetFrameCount() % 60 == 0) { + memInfo.dwLength = sizeof(MEMORYSTATUSEX); + GlobalMemoryStatusEx(&memInfo); + GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast(&pmc), sizeof(pmc)); + } + + auto totalMem = memInfo.ullTotalPhys; + auto usedMem = pmc.PrivateUsage; + + ImGui::TextUnformatted(hex::format(ICON_FA_MICROCHIP " {0} / {1}", hex::toByteString(usedMem), hex::toByteString(totalMem)).c_str()); + }); + + } + +} \ No newline at end of file diff --git a/plugins/windows/source/plugin_windows.cpp b/plugins/windows/source/plugin_windows.cpp index f0f19a82f..4a310867d 100644 --- a/plugins/windows/source/plugin_windows.cpp +++ b/plugins/windows/source/plugin_windows.cpp @@ -8,6 +8,7 @@ namespace hex::plugin::windows { void registerLanguageEnUS(); + void addFooterItems(); } @@ -17,6 +18,8 @@ IMHEX_PLUGIN_SETUP("Windows", "WerWolv", "Windows-only features") { ContentRegistry::Views::add(); registerLanguageEnUS(); + + addFooterItems(); }