MangoHud/src/overlay_params.h

229 lines
8.6 KiB
C
Raw Normal View History

#pragma once
#ifndef MANGOHUD_OVERLAY_PARAMS_H
#define MANGOHUD_OVERLAY_PARAMS_H
#include <string>
2020-05-06 02:10:45 +00:00
#include <vector>
#include <unordered_map>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#ifndef KeySym
typedef unsigned long KeySym;
#endif
#define RGBGetBValue(rgb) (rgb & 0x000000FF)
#define RGBGetGValue(rgb) ((rgb >> 8) & 0x000000FF)
#define RGBGetRValue(rgb) ((rgb >> 16) & 0x000000FF)
#define ToRGBColor(r, g, b, a) ((r << 16) | (g << 8) | (b));
#define OVERLAY_PARAMS \
OVERLAY_PARAM_BOOL(fps) \
OVERLAY_PARAM_BOOL(frame_timing) \
OVERLAY_PARAM_BOOL(core_load) \
OVERLAY_PARAM_BOOL(cpu_temp) \
2020-11-12 21:27:35 +00:00
OVERLAY_PARAM_BOOL(cpu_power) \
OVERLAY_PARAM_BOOL(gpu_temp) \
2020-02-05 02:43:44 +00:00
OVERLAY_PARAM_BOOL(cpu_stats) \
OVERLAY_PARAM_BOOL(gpu_stats) \
OVERLAY_PARAM_BOOL(ram) \
OVERLAY_PARAM_BOOL(vram) \
2020-02-12 17:24:00 +00:00
OVERLAY_PARAM_BOOL(time) \
2020-02-12 15:52:54 +00:00
OVERLAY_PARAM_BOOL(full) \
2020-02-18 09:47:58 +00:00
OVERLAY_PARAM_BOOL(read_cfg) \
OVERLAY_PARAM_BOOL(io_read) \
OVERLAY_PARAM_BOOL(io_write) \
OVERLAY_PARAM_BOOL(io_stats) \
2020-03-01 21:01:59 +00:00
OVERLAY_PARAM_BOOL(gpu_mem_clock) \
OVERLAY_PARAM_BOOL(gpu_core_clock) \
OVERLAY_PARAM_BOOL(gpu_power) \
2020-03-23 19:11:53 +00:00
OVERLAY_PARAM_BOOL(arch) \
2020-02-03 22:31:44 +00:00
OVERLAY_PARAM_BOOL(media_player) \
2020-05-02 16:39:39 +00:00
OVERLAY_PARAM_BOOL(version) \
OVERLAY_PARAM_BOOL(vulkan_driver) \
2020-05-10 00:21:39 +00:00
OVERLAY_PARAM_BOOL(gpu_name) \
2020-05-23 21:16:08 +00:00
OVERLAY_PARAM_BOOL(engine_version) \
2020-05-24 15:17:17 +00:00
OVERLAY_PARAM_BOOL(histogram) \
2020-07-18 19:18:27 +00:00
OVERLAY_PARAM_BOOL(wine) \
2020-09-29 04:24:26 +00:00
OVERLAY_PARAM_BOOL(gpu_load_change) \
2020-10-05 23:41:59 +00:00
OVERLAY_PARAM_BOOL(cpu_load_change) \
2020-11-06 23:01:23 +00:00
OVERLAY_PARAM_BOOL(graphs) \
2020-11-09 00:33:38 +00:00
OVERLAY_PARAM_BOOL(legacy_layout) \
2020-11-11 22:11:21 +00:00
OVERLAY_PARAM_BOOL(cpu_mhz) \
OVERLAY_PARAM_BOOL(frametime) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
2020-08-15 13:14:55 +00:00
OVERLAY_PARAM_CUSTOM(output_folder) \
2020-08-16 13:11:53 +00:00
OVERLAY_PARAM_CUSTOM(output_file) \
OVERLAY_PARAM_CUSTOM(font_file) \
OVERLAY_PARAM_CUSTOM(font_file_text) \
OVERLAY_PARAM_CUSTOM(font_glyph_ranges) \
OVERLAY_PARAM_CUSTOM(no_small_font) \
OVERLAY_PARAM_CUSTOM(font_size) \
OVERLAY_PARAM_CUSTOM(font_size_text) \
OVERLAY_PARAM_CUSTOM(font_scale) \
OVERLAY_PARAM_CUSTOM(font_scale_media_player) \
OVERLAY_PARAM_CUSTOM(position) \
OVERLAY_PARAM_CUSTOM(width) \
OVERLAY_PARAM_CUSTOM(height) \
OVERLAY_PARAM_CUSTOM(no_display) \
OVERLAY_PARAM_CUSTOM(control) \
2020-02-07 11:14:59 +00:00
OVERLAY_PARAM_CUSTOM(fps_limit) \
2020-02-07 12:12:58 +00:00
OVERLAY_PARAM_CUSTOM(vsync) \
OVERLAY_PARAM_CUSTOM(gl_vsync) \
2020-02-09 11:10:41 +00:00
OVERLAY_PARAM_CUSTOM(toggle_hud) \
OVERLAY_PARAM_CUSTOM(toggle_fps_limit) \
2020-02-09 11:10:41 +00:00
OVERLAY_PARAM_CUSTOM(toggle_logging) \
2020-03-13 13:57:11 +00:00
OVERLAY_PARAM_CUSTOM(reload_cfg) \
2020-06-19 11:57:44 +00:00
OVERLAY_PARAM_CUSTOM(upload_log) \
2020-08-01 23:10:21 +00:00
OVERLAY_PARAM_CUSTOM(upload_logs) \
2020-02-10 16:37:37 +00:00
OVERLAY_PARAM_CUSTOM(offset_x) \
OVERLAY_PARAM_CUSTOM(offset_y) \
2020-02-12 03:51:08 +00:00
OVERLAY_PARAM_CUSTOM(background_alpha) \
OVERLAY_PARAM_CUSTOM(time_format) \
OVERLAY_PARAM_CUSTOM(io_read) \
OVERLAY_PARAM_CUSTOM(io_write) \
OVERLAY_PARAM_CUSTOM(cpu_color) \
OVERLAY_PARAM_CUSTOM(gpu_color) \
OVERLAY_PARAM_CUSTOM(vram_color) \
OVERLAY_PARAM_CUSTOM(ram_color) \
OVERLAY_PARAM_CUSTOM(engine_color) \
2020-03-10 05:30:37 +00:00
OVERLAY_PARAM_CUSTOM(frametime_color) \
2020-03-10 06:48:04 +00:00
OVERLAY_PARAM_CUSTOM(background_color) \
2020-03-10 04:01:31 +00:00
OVERLAY_PARAM_CUSTOM(io_color) \
2020-03-11 05:20:18 +00:00
OVERLAY_PARAM_CUSTOM(text_color) \
2020-11-06 23:01:23 +00:00
OVERLAY_PARAM_CUSTOM(wine_color) \
OVERLAY_PARAM_CUSTOM(alpha) \
OVERLAY_PARAM_CUSTOM(log_duration) \
OVERLAY_PARAM_CUSTOM(pci_dev) \
OVERLAY_PARAM_CUSTOM(media_player_name) \
OVERLAY_PARAM_CUSTOM(media_player_color) \
OVERLAY_PARAM_CUSTOM(media_player_order) \
2020-06-01 00:08:35 +00:00
OVERLAY_PARAM_CUSTOM(cpu_text) \
OVERLAY_PARAM_CUSTOM(gpu_text) \
OVERLAY_PARAM_CUSTOM(log_interval) \
2020-06-19 11:57:44 +00:00
OVERLAY_PARAM_CUSTOM(permit_upload) \
OVERLAY_PARAM_CUSTOM(benchmark_percentiles) \
2020-09-29 04:24:26 +00:00
OVERLAY_PARAM_CUSTOM(help) \
2020-10-20 05:11:26 +00:00
OVERLAY_PARAM_CUSTOM(gpu_load_value) \
OVERLAY_PARAM_CUSTOM(cpu_load_value) \
2020-11-06 23:01:23 +00:00
OVERLAY_PARAM_CUSTOM(gpu_load_color) \
OVERLAY_PARAM_CUSTOM(cpu_load_color) \
2020-11-16 11:53:38 +00:00
OVERLAY_PARAM_CUSTOM(cellpadding_y) \
2020-11-17 14:09:15 +00:00
OVERLAY_PARAM_CUSTOM(table_columns) \
OVERLAY_PARAM_CUSTOM(blacklist) \
2020-11-27 13:17:43 +00:00
OVERLAY_PARAM_CUSTOM(autostart_log) \
enum overlay_param_position {
LAYER_POSITION_TOP_LEFT,
LAYER_POSITION_TOP_RIGHT,
LAYER_POSITION_BOTTOM_LEFT,
LAYER_POSITION_BOTTOM_RIGHT,
2020-05-04 04:54:25 +00:00
LAYER_POSITION_TOP_CENTER,
};
2020-03-24 19:38:08 +00:00
enum overlay_plots {
OVERLAY_PLOTS_frame_timing,
OVERLAY_PLOTS_MAX,
};
enum media_player_order {
MP_ORDER_TITLE,
MP_ORDER_ARTIST,
MP_ORDER_ALBUM,
};
enum font_glyph_ranges {
FG_KOREAN = (1u << 0),
FG_CHINESE_FULL = (1u << 1),
FG_CHINESE_SIMPLIFIED = (1u << 2),
FG_JAPANESE = (1u << 3),
FG_CYRILLIC = (1u << 4),
FG_THAI = (1u << 5),
FG_VIETNAMESE = (1u << 6),
FG_LATIN_EXT_A = (1u << 7),
FG_LATIN_EXT_B = (1u << 8),
};
enum overlay_param_enabled {
#define OVERLAY_PARAM_BOOL(name) OVERLAY_PARAM_ENABLED_##name,
#define OVERLAY_PARAM_CUSTOM(name)
OVERLAY_PARAMS
#undef OVERLAY_PARAM_BOOL
#undef OVERLAY_PARAM_CUSTOM
OVERLAY_PARAM_ENABLED_MAX
};
struct overlay_params {
bool enabled[OVERLAY_PARAM_ENABLED_MAX];
enum overlay_param_position position;
int control;
uint32_t fps_sampling_period; /* us */
std::vector<std::uint32_t> fps_limit;
bool help;
bool no_display;
2020-02-12 15:52:54 +00:00
bool full;
bool io_read, io_write, io_stats;
unsigned width;
unsigned height;
int offset_x, offset_y;
2020-02-07 12:12:58 +00:00
unsigned vsync;
int gl_vsync;
uint64_t log_duration;
2020-07-18 19:18:27 +00:00
unsigned cpu_color, gpu_color, vram_color, ram_color, engine_color, io_color, frametime_color, background_color, text_color, wine_color;
2020-10-20 03:41:39 +00:00
std::vector<unsigned> gpu_load_color;
2020-10-20 04:06:10 +00:00
std::vector<unsigned> cpu_load_color;
2020-10-20 05:11:26 +00:00
std::vector<unsigned> gpu_load_value;
std::vector<unsigned> cpu_load_value;
unsigned media_player_color;
2020-11-17 14:09:15 +00:00
unsigned table_columns;
bool no_small_font;
float font_size, font_scale;
float font_size_text;
float font_scale_media_player;
float background_alpha, alpha;
2020-11-16 11:53:38 +00:00
float cellpadding_y;
2020-05-06 02:10:45 +00:00
std::vector<KeySym> toggle_hud;
std::vector<KeySym> toggle_fps_limit;
2020-05-06 02:10:45 +00:00
std::vector<KeySym> toggle_logging;
std::vector<KeySym> reload_cfg;
2020-06-19 11:57:44 +00:00
std::vector<KeySym> upload_log;
2020-08-01 23:10:21 +00:00
std::vector<KeySym> upload_logs;
2020-08-16 13:11:53 +00:00
std::string time_format, output_folder, output_file;
std::string pci_dev;
std::string media_player_name;
2020-06-01 00:08:35 +00:00
std::string cpu_text, gpu_text;
//std::string blacklist;
std::vector<std::string> blacklist;
2020-11-27 13:17:43 +00:00
unsigned log_interval, autostart_log;
std::vector<media_player_order> media_player_order;
std::vector<std::string> benchmark_percentiles;
std::string font_file, font_file_text;
uint32_t font_glyph_ranges;
std::string config_file_path;
std::unordered_map<std::string,std::string> options;
2020-06-19 11:57:44 +00:00
int permit_upload;
2020-11-16 13:51:37 +00:00
size_t font_params_hash;
};
const extern char *overlay_param_names[];
void parse_overlay_env(struct overlay_params *params,
const char *env);
void parse_overlay_config(struct overlay_params *params,
const char *env);
#ifdef __cplusplus
}
#endif
#endif /* MANGOHUD_OVERLAY_PARAMS_H */