presets param: inherit

This option is only for presets. It inherits the default preset.
This allows you to modify an existing preset without having to rewrite it
pull/1124/head
FlightlessMango 8 months ago
parent 5c6278baf7
commit 1a0abc65df

@ -967,6 +967,7 @@ bool parse_preset_config(int preset, struct overlay_params *params){
char preset_string[20];
snprintf(preset_string, sizeof(preset_string), "[preset %d]\n", preset);
bool found_preset = false;
if (preset_file == NULL)
return false;
@ -980,6 +981,14 @@ bool parse_preset_config(int preset, struct overlay_params *params){
if(strcmp(line, "preset") == 0 || line[0] == '\n' || line[0] == '\0')
break;
printf("line: %s\n", line);
std::string s;
s = line;
trim(s);
if (strcmp(s.c_str(), "inherit") == 0)
presets(preset, params, true);
parseConfigLine(line, params->options);
}
}
@ -993,9 +1002,10 @@ void add_to_options(struct overlay_params *params, std::string option, std::stri
params->options[option] = value;
}
void presets(int preset, struct overlay_params *params) {
if (parse_preset_config(preset, params))
return;
int i = 0;
void presets(int preset, struct overlay_params *params, bool inherit) {
if (!inherit && parse_preset_config(preset, params))
return;
switch(preset) {
case 0:

@ -104,6 +104,7 @@ typedef unsigned long KeySym;
OVERLAY_PARAM_BOOL(temp_fahrenheit) \
OVERLAY_PARAM_BOOL(dynamic_frame_timing) \
OVERLAY_PARAM_BOOL(duration) \
OVERLAY_PARAM_BOOL(inherit) \
OVERLAY_PARAM_CUSTOM(fps_sampling_period) \
OVERLAY_PARAM_CUSTOM(output_folder) \
OVERLAY_PARAM_CUSTOM(output_file) \
@ -310,7 +311,7 @@ const extern char *overlay_param_names[];
void parse_overlay_config(struct overlay_params *params,
const char *env, bool ignore_preset);
void presets(int preset, struct overlay_params *params);
void presets(int preset, struct overlay_params *params, bool inherit=false);
bool parse_preset_config(int preset, struct overlay_params *params);
void add_to_options(struct overlay_params *params, std::string option, std::string value);

Loading…
Cancel
Save