mirror of https://github.com/WerWolv/ImHex.git
ui: Added used memory footer item on Windows
This commit is contained in:
parent
8423f78586
commit
af444999bf
|
@ -13,6 +13,8 @@ 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
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#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,6 +9,8 @@ namespace hex::plugin::builtin {
|
|||
void registerSettings();
|
||||
void registerDataProcessorNodes();
|
||||
|
||||
void addFooterItems();
|
||||
|
||||
void registerLanguageEnUS();
|
||||
void registerLanguageDeDE();
|
||||
void registerLanguageItIT();
|
||||
|
@ -26,6 +28,8 @@ IMHEX_PLUGIN_SETUP("Built-in", "WerWolv", "Default ImHex functionality") {
|
|||
registerSettings();
|
||||
registerDataProcessorNodes();
|
||||
|
||||
addFooterItems();
|
||||
|
||||
registerLanguageEnUS();
|
||||
registerLanguageDeDE();
|
||||
registerLanguageItIT();
|
||||
|
|
Loading…
Reference in New Issue