params: exec_name

pull/890/head
FlightlessMango 1 year ago
parent 8ea3f86dbf
commit 03d64e5afb

@ -7,6 +7,8 @@
#include "string_utils.h" #include "string_utils.h"
#include "file_utils.h" #include "file_utils.h"
std::string global_proc_name;
static std::string get_proc_name() { static std::string get_proc_name() {
// Note: It is possible to use GNU program_invocation_short_name. // Note: It is possible to use GNU program_invocation_short_name.
const std::string proc_name = get_wine_exe_name(/*keep_ext=*/true); const std::string proc_name = get_wine_exe_name(/*keep_ext=*/true);
@ -43,6 +45,7 @@ static std::vector<std::string> blacklist {
static bool check_blacklisted() { static bool check_blacklisted() {
std::string proc_name = get_proc_name(); std::string proc_name = get_proc_name();
global_proc_name = proc_name;
bool blacklisted = std::find(blacklist.begin(), blacklist.end(), proc_name) != blacklist.end(); bool blacklisted = std::find(blacklist.begin(), blacklist.end(), proc_name) != blacklist.end();
if(blacklisted) { if(blacklisted) {

@ -4,6 +4,6 @@
#include<string> #include<string>
bool is_blacklisted(bool force_recheck = false); bool is_blacklisted(bool force_recheck = false);
void add_blacklist(const std::string& proc); void add_blacklist(const std::string& proc);
extern std::string global_proc_name;
#endif //MANGOHUD_BLACKLIST_H #endif //MANGOHUD_BLACKLIST_H

@ -18,6 +18,7 @@
#include "app/mangoapp.h" #include "app/mangoapp.h"
#include <IconsForkAwesome.h> #include <IconsForkAwesome.h>
#include "version.h" #include "version.h"
#include "blacklist.h"
#define CHAR_CELSIUS "\xe2\x84\x83" #define CHAR_CELSIUS "\xe2\x84\x83"
#define CHAR_FAHRENHEIT "\xe2\x84\x89" #define CHAR_FAHRENHEIT "\xe2\x84\x89"
@ -1100,6 +1101,15 @@ void HudElements::graphs(){
ImGui::PopStyleColor(1); ImGui::PopStyleColor(1);
} }
void HudElements::exec_name(){
ImGui::PushFont(HUDElements.sw_stats->font1);
ImGui::TableNextColumn();
ImGui::TextColored(HUDElements.colors.engine, "%s", "Executable name");
ImGui::TableNextColumn();
right_aligned_text(HUDElements.colors.text, HUDElements.ralign_width, global_proc_name.c_str());
ImGui::PopFont();
}
void HudElements::sort_elements(const std::pair<std::string, std::string>& option){ void HudElements::sort_elements(const std::pair<std::string, std::string>& option){
const auto& param = option.first; const auto& param = option.first;
const auto& value = option.second; const auto& value = option.second;
@ -1142,6 +1152,7 @@ void HudElements::sort_elements(const std::pair<std::string, std::string>& optio
if (param == "frame_count") { ordered_functions.push_back({frame_count, value}); } if (param == "frame_count") { ordered_functions.push_back({frame_count, value}); }
if (param == "fan") { ordered_functions.push_back({fan, value}); } if (param == "fan") { ordered_functions.push_back({fan, value}); }
if (param == "throttling_status") { ordered_functions.push_back({throttling_status, value}); } if (param == "throttling_status") { ordered_functions.push_back({throttling_status, value}); }
if (param == "exec_name") { ordered_functions.push_back({exec_name, value}); }
if (param == "graphs"){ if (param == "graphs"){
if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs]) if (!HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs])
HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs] = true; HUDElements.params->enabled[OVERLAY_PARAM_ENABLED_graphs] = true;
@ -1197,6 +1208,7 @@ void HudElements::legacy_elements(){
#endif #endif
ordered_functions.push_back({gamepad_battery, value}); ordered_functions.push_back({gamepad_battery, value});
ordered_functions.push_back({media_player, value}); ordered_functions.push_back({media_player, value});
ordered_functions.push_back({exec_name, value});
} }
void HudElements::update_exec(){ void HudElements::update_exec(){

@ -66,6 +66,7 @@ class HudElements{
static void frame_count(); static void frame_count();
static void fan(); static void fan();
static void throttling_status(); static void throttling_status();
static void exec_name();
void convert_colors(const struct overlay_params& params); void convert_colors(const struct overlay_params& params);
void convert_colors(bool do_conv, const struct overlay_params& params); void convert_colors(bool do_conv, const struct overlay_params& params);

@ -542,6 +542,7 @@ parse_overlay_env(struct overlay_params *params,
params->enabled[OVERLAY_PARAM_ENABLED_hud_no_margin] = 0; params->enabled[OVERLAY_PARAM_ENABLED_hud_no_margin] = 0;
params->enabled[OVERLAY_PARAM_ENABLED_log_versioning] = 0; params->enabled[OVERLAY_PARAM_ENABLED_log_versioning] = 0;
params->enabled[OVERLAY_PARAM_ENABLED_hud_compact] = 0; params->enabled[OVERLAY_PARAM_ENABLED_hud_compact] = 0;
params->enabled[OVERLAY_PARAM_ENABLED_exec_name] = 0;
} }
#define OVERLAY_PARAM_BOOL(name) \ #define OVERLAY_PARAM_BOOL(name) \
if (!strcmp(#name, key)) { \ if (!strcmp(#name, key)) { \
@ -693,6 +694,7 @@ parse_overlay_config(struct overlay_params *params,
params->enabled[OVERLAY_PARAM_ENABLED_hud_no_margin] = 0; params->enabled[OVERLAY_PARAM_ENABLED_hud_no_margin] = 0;
params->enabled[OVERLAY_PARAM_ENABLED_log_versioning] = 0; params->enabled[OVERLAY_PARAM_ENABLED_log_versioning] = 0;
params->enabled[OVERLAY_PARAM_ENABLED_hud_compact] = 0; params->enabled[OVERLAY_PARAM_ENABLED_hud_compact] = 0;
params->enabled[OVERLAY_PARAM_ENABLED_exec_name] = 0;
params->options.erase("full"); params->options.erase("full");
} }
for (auto& it : params->options) { for (auto& it : params->options) {

@ -88,6 +88,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_BOOL(horizontal) \ OVERLAY_PARAM_BOOL(horizontal) \
OVERLAY_PARAM_BOOL(hud_no_margin) \ OVERLAY_PARAM_BOOL(hud_no_margin) \
OVERLAY_PARAM_BOOL(hud_compact) \ OVERLAY_PARAM_BOOL(hud_compact) \
OVERLAY_PARAM_BOOL(exec_name) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \ OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_folder) \ OVERLAY_PARAM_CUSTOM(output_folder) \
OVERLAY_PARAM_CUSTOM(output_file) \ OVERLAY_PARAM_CUSTOM(output_file) \

Loading…
Cancel
Save