Allow users to add a new item to the blacklist from config file

pull/398/head
Alessandro Toia 4 years ago
parent 0474c93800
commit 7c80dc53ef

@ -188,6 +188,7 @@ Parameters that are enabled by default have to be explicitly disabled. These (cu
| `cellpadding_y` | Set the vertical cellpadding, default is `-0.085` |
| `frametime` | Display frametime next to fps text |
| `table_columns` | Set the number of table columns for ImGui, defaults to 3 |
| `blacklist` | Add a program to the blacklist. e.g `blacklist=vkcube,WatchDogs2.exe` |
Example: `MANGOHUD_CONFIG=cpu_temp,gpu_temp,position=top-right,height=500,font_size=32`

@ -132,6 +132,9 @@ background_alpha=0.5
### Set to 'domain:bus:slot.function'
# pci_dev = 0:0a:0.0
### Blacklist
#blacklist =
################## INTERACTION #################
### Change toggle keybinds for the hud & logging

@ -22,27 +22,28 @@ static std::string get_proc_name() {
return proc_name;
}
static bool check_blacklisted() {
static const std::vector<std::string> blacklist {
"Battle.net.exe",
"BethesdaNetLauncher.exe",
"EpicGamesLauncher.exe",
"IGOProxy.exe",
"IGOProxy64.exe",
"Origin.exe",
"OriginThinSetupInternal.exe",
"steam",
"steamwebhelper",
"gldriverquery",
"vulkandriverquery",
"Steam.exe",
"ffxivlauncher.exe",
"ffxivlauncher64.exe",
"LeagueClient.exe",
"LeagueClientUxRender.exe",
"SocialClubHelper.exe",
};
static std::vector<std::string> blacklist {
"Battle.net.exe",
"BethesdaNetLauncher.exe",
"EpicGamesLauncher.exe",
"IGOProxy.exe",
"IGOProxy64.exe",
"Origin.exe",
"OriginThinSetupInternal.exe",
"steam",
"steamwebhelper",
"gldriverquery",
"vulkandriverquery",
"Steam.exe",
"ffxivlauncher.exe",
"ffxivlauncher64.exe",
"LeagueClient.exe",
"LeagueClientUxRender.exe",
"SocialClubHelper.exe",
};
static bool check_blacklisted() {
std::string proc_name = get_proc_name();
bool blacklisted = std::find(blacklist.begin(), blacklist.end(), proc_name) != blacklist.end();
@ -59,3 +60,9 @@ bool is_blacklisted(bool force_recheck) {
blacklisted = check_blacklisted();
return blacklisted;
}
void add_blacklist(std::string new_item) {
blacklist.push_back (new_item);
is_blacklisted(true);
}

@ -1,7 +1,9 @@
#pragma once
#ifndef MANGOHUD_BLACKLIST_H
#define MANGOHUD_BLACKLIST_H
#include<string>
bool is_blacklisted(bool force_recheck = false);
void add_blacklist(std::string);
#endif //MANGOHUD_BLACKLIST_H

@ -362,6 +362,7 @@ parse_font_glyph_ranges(const char *str)
#define parse_cpu_load_color(s) parse_load_color(s)
#define parse_gpu_load_value(s) parse_load_value(s)
#define parse_cpu_load_value(s) parse_load_value(s)
#define parse_blacklist(s) parse_str(s)
static bool
parse_help(const char *str)

@ -117,6 +117,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_CUSTOM(cpu_load_color) \
OVERLAY_PARAM_CUSTOM(cellpadding_y) \
OVERLAY_PARAM_CUSTOM(table_columns) \
OVERLAY_PARAM_CUSTOM(blacklist) \
enum overlay_param_position {
LAYER_POSITION_TOP_LEFT,
@ -197,6 +198,7 @@ struct overlay_params {
std::string pci_dev;
std::string media_player_name;
std::string cpu_text, gpu_text;
std::string blacklist;
unsigned log_interval;
std::vector<media_player_order> media_player_order;
std::vector<std::string> benchmark_percentiles;

@ -2079,8 +2079,17 @@ static VkResult overlay_CreateInstance(
&instance_data->vtable);
instance_data_map_physical_devices(instance_data, true);
parse_overlay_config(&instance_data->params, getenv("MANGOHUD_CONFIG"));
//check for blacklist item in the config file
std::stringstream ss(instance_data->params.blacklist);
std::string token;
while (std::getline(ss, token, ',')) {
trim(token);
add_blacklist(token);
}
if (!is_blacklisted()) {
parse_overlay_config(&instance_data->params, getenv("MANGOHUD_CONFIG"));
#ifdef __gnu_linux__
instance_data->notifier.params = &instance_data->params;
start_notifier(instance_data->notifier);

Loading…
Cancel
Save