mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2025-10-30 08:02:29 +00:00
Proper enum parsing.
This commit is contained in:
parent
843c1a1dcc
commit
240c3f566d
1 changed files with 6 additions and 2 deletions
|
|
@ -688,8 +688,12 @@ bool parse_mod_config_storage(const std::filesystem::path &path, const std::stri
|
||||||
|
|
||||||
switch (option.type) {
|
switch (option.type) {
|
||||||
case recomp::mods::ConfigOptionType::Enum:
|
case recomp::mods::ConfigOptionType::Enum:
|
||||||
if (get_to<int64_t>(*option_json, value_int64)) {
|
if (get_to<json::string_t>(*option_json, value_str)) {
|
||||||
config_storage.value_map[option.id] = uint32_t(value_int64);
|
const recomp::mods::ConfigOptionEnum &option_enum = std::get<recomp::mods::ConfigOptionEnum>(option.variant);
|
||||||
|
auto option_it = std::find(option_enum.options.begin(), option_enum.options.end(), value_str);
|
||||||
|
if (option_it != option_enum.options.end()) {
|
||||||
|
config_storage.value_map[option.id] = uint32_t(option_it - option_enum.options.begin());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue