file_utils: add remove_parentheses function and use it for gpu_name

mangoconfig
Alessandro Toia 7 months ago
parent cd87e22dc3
commit 10c0f608fd

@ -201,4 +201,10 @@ bool lib_loaded(const std::string& lib) {
}
std::string remove_parentheses(const std::string& text) {
// Remove parentheses and text between them
std::regex pattern("\\([^)]*\\)");
return std::regex_replace(text, pattern, "");
}
#endif // __linux__

@ -4,7 +4,7 @@
#include <string>
#include <vector>
#include <regex>
enum LS_FLAGS
{
LS_DIRS = 0x01,
@ -24,5 +24,6 @@ std::string get_home_dir();
std::string get_data_dir();
std::string get_config_dir();
bool lib_loaded(const std::string& lib);
std::string remove_parentheses(const std::string&);
#endif //MANGOHUD_FILE_UTILS_H

@ -149,7 +149,7 @@ void imgui_create(void *ctx, const gl_wsi plat)
SPDLOG_DEBUG("GL device id: {:04X}", device_id);
init_gpu_stats(vendorID, device_id, params);
sw_stats.gpuName = gpu = deviceName;
sw_stats.gpuName = gpu = remove_parentheses(deviceName);
SPDLOG_DEBUG("gpu: {}", gpu);
// Setup Dear ImGui context
IMGUI_CHECKVERSION();

@ -50,6 +50,7 @@
#include "notify.h"
#include "blacklist.h"
#include "pci_ids.h"
#include "file_utils.h"
#ifdef __linux__
#include "implot.h"
#endif
@ -1550,7 +1551,7 @@ static VkResult overlay_CreateSwapchainKHR(
std::string deviceName = prop.deviceName;
if (!is_blacklisted()) {
#ifdef __linux__
swapchain_data->sw_stats.gpuName = deviceName;
swapchain_data->sw_stats.gpuName = remove_parentheses(deviceName);
#endif
}
swapchain_data->sw_stats.driverName = driverProps.driverInfo;

Loading…
Cancel
Save