MCPcopy Create free account
hub / github.com/crosire/reshade / ReShadeGetConfigValue

Function ReShadeGetConfigValue

source/addon.cpp:43–78  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43bool ReShadeGetConfigValue(void *, reshade::api::effect_runtime *runtime, const char *section, const char *key, char *value, size_t *size)
44{
45 reshade::ini_file &config = (runtime != nullptr) ? reshade::ini_file::load_cache(static_cast<reshade::runtime *>(runtime)->get_config_path()) : reshade::global_config();
46
47 std::vector<std::string> elements;
48 config.get(section != nullptr ? section : std::string(), key != nullptr ? key : std::string(), elements);
49
50 if (size != nullptr || value != nullptr)
51 {
52 std::string value_string;
53 for (const std::string &element : elements)
54 {
55 value_string += element;
56 value_string += '\0';
57 }
58
59 if (size != nullptr)
60 {
61 if (elements.empty())
62 {
63 *size = 0;
64 }
65 else if (value == nullptr)
66 {
67 *size = value_string.size() + 1;
68 }
69 else if (*size != 0)
70 {
71 *size = value_string.copy(value, *size - 1);
72 value[*size] = '\0';
73 }
74 }
75 }
76
77 return !elements.empty();
78}
79
80void ReShadeSetConfigValue(void *module, reshade::api::effect_runtime *runtime, const char *section, const char *key, const char *value)
81{

Callers 1

get_config_valueFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected