diff --git a/plugins/windows/romfs/lang/en_US.json b/plugins/windows/romfs/lang/en_US.json index 4dc73b96e..d6d76bfa0 100644 --- a/plugins/windows/romfs/lang/en_US.json +++ b/plugins/windows/romfs/lang/en_US.json @@ -18,6 +18,7 @@ "hex.windows.provider.process_memory.utils.inject_dll.success": "Successfully injected DLL '{0}'!", "hex.windows.provider.process_memory.utils.inject_dll.failure": "Failed to inject DLL '{0}'!", "hex.builtin.setting.general.context_menu_entry": "Windows context menu entry", + "hex.builtin.setting.interface.show_resource_usage": "Show resource usage in footer", "hex.windows.view.tty_console.auto_scroll": "Auto scroll", "hex.windows.view.tty_console.baud": "Baud rate", "hex.windows.view.tty_console.clear": "Clear", diff --git a/plugins/windows/source/content/settings_entries.cpp b/plugins/windows/source/content/settings_entries.cpp index c4cbd0d72..531480e74 100644 --- a/plugins/windows/source/content/settings_entries.cpp +++ b/plugins/windows/source/content/settings_entries.cpp @@ -62,6 +62,8 @@ namespace hex::plugin::windows { widget.load(hasImHexContextMenuEntry()); }); + + ContentRegistry::Settings::add("hex.builtin.setting.interface", "hex.builtin.setting.interface.window", "hex.builtin.setting.interface.show_resource_usage", true); } } \ No newline at end of file diff --git a/plugins/windows/source/content/ui_items.cpp b/plugins/windows/source/content/ui_items.cpp index 65ff00b4f..dd8185498 100644 --- a/plugins/windows/source/content/ui_items.cpp +++ b/plugins/windows/source/content/ui_items.cpp @@ -9,12 +9,21 @@ #include #include +#include namespace hex::plugin::windows { void addFooterItems() { + static bool showResourceUsage = true; + EventManager::subscribe([]{ + showResourceUsage = ContentRegistry::Settings::read("hex.builtin.setting.interface", "hex.builtin.setting.interface.show_resource_usage", true); + }); + ContentRegistry::Interface::addFooterItem([] { + if (!showResourceUsage) + return; + static float cpuUsage = 0.0F; if (ImGuiExt::HasSecondPassed()) { @@ -65,6 +74,9 @@ namespace hex::plugin::windows { }); ContentRegistry::Interface::addFooterItem([] { + if (!showResourceUsage) + return; + static MEMORYSTATUSEX memInfo; static PROCESS_MEMORY_COUNTERS_EX pmc; @@ -81,4 +93,4 @@ namespace hex::plugin::windows { }); } -} \ No newline at end of file +}