sys: Move windows-only footer items to the windows plugin
This commit is contained in:
parent
1843db91af
commit
44000d2518
@ -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
|
||||
|
@ -1,31 +0,0 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
#if defined(OS_WINDOWS)
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
#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<PROCESS_MEMORY_COUNTERS*>(&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
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
|
@ -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 #
|
||||
|
40
plugins/windows/source/content/footer_items.cpp
Normal file
40
plugins/windows/source/content/footer_items.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
#include <hex/plugin.hpp>
|
||||
|
||||
#include <windows.h>
|
||||
#include <psapi.h>
|
||||
|
||||
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<PROCESS_MEMORY_COUNTERS*>(&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());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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<ViewTTYConsole>();
|
||||
|
||||
registerLanguageEnUS();
|
||||
|
||||
addFooterItems();
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user