diff options
Diffstat (limited to 'src/config.hpp')
-rw-r--r-- | src/config.hpp | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/src/config.hpp b/src/config.hpp index be58704..4cd0524 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -33,9 +33,16 @@ struct MainConfig { std::string framerate_mode; bool advanced_view = false; bool overclock = false; - bool show_notifications = true; + bool show_recording_started_notifications = false; + bool show_recording_stopped_notifications = false; + bool show_recording_saved_notifications = true; bool record_cursor = true; bool hide_window_when_recording = false; + bool software_encoding_warning_shown = false; + bool steam_deck_warning_shown = false; + bool hevc_amd_bug_warning_shown = false; + bool av1_amd_bug_warning_shown = false; + bool restore_portal_session = true; }; struct YoutubeStreamConfig { @@ -56,21 +63,21 @@ struct StreamingConfig { YoutubeStreamConfig youtube; TwitchStreamConfig twitch; CustomStreamConfig custom; - ConfigHotkey start_recording_hotkey; + ConfigHotkey start_stop_recording_hotkey; }; struct RecordConfig { std::string save_directory; std::string container; - ConfigHotkey start_recording_hotkey; - ConfigHotkey pause_recording_hotkey; + ConfigHotkey start_stop_recording_hotkey; + ConfigHotkey pause_unpause_recording_hotkey; }; struct ReplayConfig { std::string save_directory; std::string container; int32_t replay_time = 30; - ConfigHotkey start_recording_hotkey; + ConfigHotkey start_stop_recording_hotkey; ConfigHotkey save_recording_hotkey; }; @@ -288,7 +295,7 @@ static bool config_split_key_value(const StringView str, StringView &key, String value.str = str.str + index + 1; value.size = str.size - (index + 1); - + return true; } @@ -307,26 +314,33 @@ static std::map<std::string, ConfigValue> get_config_options(Config &config) { {"main.framerate_mode", {CONFIG_TYPE_STRING, &config.main_config.framerate_mode}}, {"main.advanced_view", {CONFIG_TYPE_BOOL, &config.main_config.advanced_view}}, {"main.overclock", {CONFIG_TYPE_BOOL, &config.main_config.overclock}}, - {"main.show_notifications", {CONFIG_TYPE_BOOL, &config.main_config.show_notifications}}, + {"main.show_recording_started_notifications", {CONFIG_TYPE_BOOL, &config.main_config.show_recording_started_notifications}}, + {"main.show_recording_stopped_notifications", {CONFIG_TYPE_BOOL, &config.main_config.show_recording_stopped_notifications}}, + {"main.show_recording_saved_notifications", {CONFIG_TYPE_BOOL, &config.main_config.show_recording_saved_notifications}}, {"main.record_cursor", {CONFIG_TYPE_BOOL, &config.main_config.record_cursor}}, {"main.hide_window_when_recording", {CONFIG_TYPE_BOOL, &config.main_config.hide_window_when_recording}}, + {"main.software_encoding_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.software_encoding_warning_shown}}, + {"main.steam_deck_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.steam_deck_warning_shown}}, + {"main.hevc_amd_bug_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.hevc_amd_bug_warning_shown}}, + {"main.av1_amd_bug_warning_shown", {CONFIG_TYPE_BOOL, &config.main_config.av1_amd_bug_warning_shown}}, + {"main.restore_portal_session", {CONFIG_TYPE_BOOL, &config.main_config.restore_portal_session}}, {"streaming.service", {CONFIG_TYPE_STRING, &config.streaming_config.streaming_service}}, {"streaming.youtube.key", {CONFIG_TYPE_STRING, &config.streaming_config.youtube.stream_key}}, {"streaming.twitch.key", {CONFIG_TYPE_STRING, &config.streaming_config.twitch.stream_key}}, {"streaming.custom.url", {CONFIG_TYPE_STRING, &config.streaming_config.custom.url}}, {"streaming.custom.container", {CONFIG_TYPE_STRING, &config.streaming_config.custom.container}}, - {"streaming.start_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.streaming_config.start_recording_hotkey}}, + {"streaming.start_stop_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.streaming_config.start_stop_recording_hotkey}}, {"record.save_directory", {CONFIG_TYPE_STRING, &config.record_config.save_directory}}, {"record.container", {CONFIG_TYPE_STRING, &config.record_config.container}}, - {"record.start_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.record_config.start_recording_hotkey}}, - {"record.pause_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.record_config.pause_recording_hotkey}}, + {"record.start_stop_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.record_config.start_stop_recording_hotkey}}, + {"record.pause_unpause_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.record_config.pause_unpause_recording_hotkey}}, {"replay.save_directory", {CONFIG_TYPE_STRING, &config.replay_config.save_directory}}, {"replay.container", {CONFIG_TYPE_STRING, &config.replay_config.container}}, {"replay.time", {CONFIG_TYPE_I32, &config.replay_config.replay_time}}, - {"replay.start_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.replay_config.start_recording_hotkey}}, + {"replay.start_stop_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.replay_config.start_stop_recording_hotkey}}, {"replay.save_recording_hotkey", {CONFIG_TYPE_HOTKEY, &config.replay_config.save_recording_hotkey}} }; } @@ -349,13 +363,13 @@ static Config read_config(bool &config_empty) { auto config_options = get_config_options(config); string_split_char(file_content, '\n', [&](StringView line) { - StringView key, value; - if(!config_split_key_value(line, key, value)) { + StringView key, sv_val; + if(!config_split_key_value(line, key, sv_val)) { fprintf(stderr, "Warning: Invalid config option format: %.*s\n", (int)line.size, line.str); return true; } - if(key.size == 0 || value.size == 0) + if(key.size == 0 || sv_val.size == 0) return true; auto it = config_options.find(std::string(key.str, key.size)); @@ -364,15 +378,15 @@ static Config read_config(bool &config_empty) { switch(it->second.type) { case CONFIG_TYPE_BOOL: { - *(bool*)it->second.data = value == "true"; + *(bool*)it->second.data = sv_val == "true"; break; } case CONFIG_TYPE_STRING: { - ((std::string*)it->second.data)->assign(value.str, value.size); + ((std::string*)it->second.data)->assign(sv_val.str, sv_val.size); break; } case CONFIG_TYPE_I32: { - std::string value_str(value.str, value.size); + std::string value_str(sv_val.str, sv_val.size); int32_t *value = (int32_t*)it->second.data; if(sscanf(value_str.c_str(), FORMAT_I32, value) != 1) { fprintf(stderr, "Warning: Invalid config option value for %.*s\n", (int)key.size, key.str); @@ -381,7 +395,7 @@ static Config read_config(bool &config_empty) { break; } case CONFIG_TYPE_HOTKEY: { - std::string value_str(value.str, value.size); + std::string value_str(sv_val.str, sv_val.size); ConfigHotkey *config_hotkey = (ConfigHotkey*)it->second.data; if(sscanf(value_str.c_str(), FORMAT_I64 " " FORMAT_U32, &config_hotkey->keysym, &config_hotkey->modifiers) != 2) { fprintf(stderr, "Warning: Invalid config option value for %.*s\n", (int)key.size, key.str); @@ -391,7 +405,7 @@ static Config read_config(bool &config_empty) { break; } case CONFIG_TYPE_STRING_ARRAY: { - std::string array_value(value.str, value.size); + std::string array_value(sv_val.str, sv_val.size); ((std::vector<std::string>*)it->second.data)->push_back(std::move(array_value)); break; } |