|
102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
|
#include "config_internal.h"#include "sds.h"#include "yyjson.h"#include <dttr_log.h>#include <float.h>#include <limits.h>#include <math.h>#include <stdarg.h>#include <stdint.h>#include <string.h>#include "dttr_errors.h"Go to the source code of this file.
Data Structures | |
| struct | config_json_objects |
Functions | |
| static void | errors_clear () |
| static void | errors_addf (const char *fmt,...) |
| static bool | errors_show () |
| const char * | DTTR_Config_LastError () |
| Returns details from the most recent config load failure, or NULL when none exist. | |
| static void | errors_add_invalid_value (const char *section, const char *key, const char *value) |
| static void | config_apply_buttons (DTTR_Config *config, yyjson_val *buttons) |
| static void | config_apply_disabled_mods (DTTR_Config *config, yyjson_val *disabled_mods) |
| static bool | validate_schema_major_version (yyjson_val *root, const char *filename) |
| static bool | config_apply_json_value (DTTR_Config *config, const DTTR_ConfigFieldSpec *spec, yyjson_val *val) |
| static void | apply_section (yyjson_val *obj, const char *section) |
| bool | DTTR_Config_Load (const char *filename) |
| Loads config values from a strict JSON file into the global config object. | |
| static bool | obj_add_strcpy (yyjson_mut_doc *doc, yyjson_mut_val *obj, const char *key, const char *value) |
| static yyjson_mut_val * | config_object_for_section (const config_json_objects *objects, const char *section) |
| static const char * | config_format_field_string (const DTTR_Config *config, const DTTR_ConfigFieldSpec *spec) |
| static bool | config_add_schema_field (yyjson_mut_doc *doc, const config_json_objects *objects, const DTTR_Config *config, const DTTR_ConfigFieldSpec *spec) |
| static bool | config_add_schema_fields (yyjson_mut_doc *doc, const config_json_objects *objects, const DTTR_Config *config) |
| static bool | config_add_disabled_mods (yyjson_mut_doc *doc, yyjson_mut_val *modding, const DTTR_Config *config) |
| static bool | config_add_gamepad_buttons (yyjson_mut_doc *doc, yyjson_mut_val *buttons, const DTTR_Config *config) |
| bool | DTTR_Config_Save (const char *filename, const DTTR_Config *config) |
| Saves config values back to a strict JSON file. | |
Variables | |
| static sds | errors |
|
static |
Definition at line 228 of file io.c.
References config_apply_json_value(), config_schema_find(), dttr_config, and errors_add_invalid_value().
Referenced by DTTR_Config_Load().
|
static |
Definition at line 440 of file io.c.
References DTTR_Config::disabled_mod_count, and DTTR_Config::disabled_mods.
Referenced by DTTR_Config_Save().
|
static |
Definition at line 459 of file io.c.
References config_format_game_action(), config_format_gamepad_source(), DTTR_GAMEPAD_SOURCE_COUNT, DTTR_Config::gamepad_button_map, and obj_add_strcpy().
Referenced by DTTR_Config_Save().
|
static |
Definition at line 395 of file io.c.
References CONFIG_BOOL, CONFIG_FLOAT, config_format_field_string(), CONFIG_INT, config_object_for_section(), DTTR_ConfigFieldSpec::key, obj_add_strcpy(), DTTR_ConfigFieldSpec::offset, DTTR_ConfigFieldSpec::section, and DTTR_ConfigFieldSpec::value_type.
Referenced by config_add_schema_fields().
|
static |
Definition at line 424 of file io.c.
References config_add_schema_field(), count, DTTR_Config_SchemaCount(), and DTTR_Config_SchemaGet().
Referenced by DTTR_Config_Save().
|
static |
Definition at line 63 of file io.c.
References config_clear_button_map(), config_parse_game_action(), config_parse_gamepad_source(), DTTR_GAMEPAD_MAPPING_NONE, errors_addf(), DTTR_Config::gamepad_button_map, and source.
Referenced by DTTR_Config_Load().
|
static |
Definition at line 99 of file io.c.
References DTTR_Config::disabled_mod_count, DTTR_Config_SetModEnabled(), and errors_addf().
Referenced by DTTR_Config_Load().
|
static |
Definition at line 162 of file io.c.
References config_apply_entry(), CONFIG_BOOL, CONFIG_FLOAT, CONFIG_INT, CONFIG_STRING, DTTR_ConfigFieldSpec::key, DTTR_ConfigFieldSpec::offset, DTTR_ConfigFieldSpec::section, and DTTR_ConfigFieldSpec::value_type.
Referenced by apply_section().
|
static |
Definition at line 366 of file io.c.
References config_format_gamepad_axis(), config_format_graphics_api(), config_format_log_level(), config_format_minidump_type(), config_format_present_filter(), config_format_scaling_fit(), config_format_scaling_method(), config_format_vertex_precision(), CONFIG_GAMEPAD_AXIS, CONFIG_GRAPHICS_API, CONFIG_LOG_LEVEL, CONFIG_MINIDUMP_TYPE, CONFIG_PRESENT_FILTER, CONFIG_SCALING_FIT, CONFIG_SCALING_METHOD, CONFIG_STRING, CONFIG_VERTEX_PRECISION, NULL, DTTR_ConfigFieldSpec::offset, and DTTR_ConfigFieldSpec::value_type.
Referenced by config_add_schema_field().
|
static |
Definition at line 339 of file io.c.
References config_json_objects::audio, config_sections_match(), config_json_objects::gamepad, config_json_objects::graphics, config_json_objects::modding, NULL, and config_json_objects::root.
Referenced by config_add_schema_field().
| const char * DTTR_Config_LastError | ( | ) |
Returns details from the most recent config load failure, or NULL when none exist.
Definition at line 46 of file io.c.
Referenced by dttr_launcher_main(), and load_config().
| bool DTTR_Config_Load | ( | const char * | filename | ) |
Loads config values from a strict JSON file into the global config object.
Definition at line 259 of file io.c.
References apply_section(), config_apply_buttons(), config_apply_disabled_mods(), dttr_config, DTTR_Config_Save(), DTTR_Config_SetDefaults(), DTTR_LOG_ERROR, DTTR_LOG_WARN, errors_addf(), errors_clear(), errors_show(), NULL, and validate_schema_major_version().
Referenced by DTTR_Hook_WinMainCallback(), dttr_launcher_main(), and load_config().
| bool DTTR_Config_Save | ( | const char * | filename, |
| const DTTR_Config * | config ) |
Saves config values back to a strict JSON file.
Definition at line 483 of file io.c.
References config_json_objects::audio, config_add_disabled_mods(), config_add_gamepad_buttons(), config_add_schema_fields(), DTTR_LOG_ERROR, config_json_objects::gamepad, config_json_objects::graphics, config_json_objects::modding, and NULL.
Referenced by DTTR_Config_Load(), save_config(), and save_selected_path().
|
static |
|
static |
Definition at line 25 of file io.c.
Referenced by config_apply_buttons(), config_apply_disabled_mods(), DTTR_Config_Load(), errors_add_invalid_value(), and validate_schema_major_version().
|
static |
|
static |
Definition at line 37 of file io.c.
References DTTR_LOG_ERROR, and errors.
Referenced by DTTR_Config_Load(), and validate_schema_major_version().
|
static |
Definition at line 322 of file io.c.
Referenced by config_add_gamepad_buttons(), and config_add_schema_field().
|
static |
Definition at line 126 of file io.c.
References DTTR_CONFIG_SCHEMA_MAJOR_VERSION, errors_addf(), and errors_show().
Referenced by DTTR_Config_Load().
|
static |
Definition at line 15 of file io.c.
Referenced by DTTR_Config_LastError(), errors_addf(), errors_clear(), and errors_show().