mirror of
https://github.com/N64Recomp/N64ModernRuntime.git
synced 2025-10-30 08:02:29 +00:00
Address warnings
This commit is contained in:
parent
31462bf08b
commit
bf05c8d9a5
2 changed files with 7 additions and 32 deletions
|
|
@ -148,9 +148,6 @@ void Config::add_enum_option(
|
||||||
|
|
||||||
ConfigOptionEnum option_enum = {{}, default_value};
|
ConfigOptionEnum option_enum = {{}, default_value};
|
||||||
|
|
||||||
// Note: this is a bit too predictive since this calls add_option
|
|
||||||
size_t option_index = schema.options.size();
|
|
||||||
|
|
||||||
for (const auto &option : options) {
|
for (const auto &option : options) {
|
||||||
assert(option_enum.can_add_option(option.key, option.value) && "Duplicate enum option key or value.");
|
assert(option_enum.can_add_option(option.key, option.value) && "Duplicate enum option key or value.");
|
||||||
option_enum.options.push_back(option);
|
option_enum.options.push_back(option);
|
||||||
|
|
@ -338,6 +335,9 @@ nlohmann::json Config::get_storage_json() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (option.type) {
|
switch (option.type) {
|
||||||
|
case ConfigOptionType::None: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ConfigOptionType::Enum: {
|
case ConfigOptionType::Enum: {
|
||||||
auto &option_enum = std::get<ConfigOptionEnum>(option.variant);
|
auto &option_enum = std::get<ConfigOptionEnum>(option.variant);
|
||||||
auto found_opt = option_enum.find_option_from_value(std::get<uint32_t>(value));
|
auto found_opt = option_enum.find_option_from_value(std::get<uint32_t>(value));
|
||||||
|
|
|
||||||
|
|
@ -6,35 +6,6 @@
|
||||||
#include "librecomp/files.hpp"
|
#include "librecomp/files.hpp"
|
||||||
#include "librecomp/mods.hpp"
|
#include "librecomp/mods.hpp"
|
||||||
|
|
||||||
static bool read_json(std::ifstream input_file, nlohmann::json &json_out) {
|
|
||||||
if (!input_file.good()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
input_file >> json_out;
|
|
||||||
}
|
|
||||||
catch (nlohmann::json::parse_error &) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool read_json_with_backups(const std::filesystem::path &path, nlohmann::json &json_out) {
|
|
||||||
// Try reading and parsing the base file.
|
|
||||||
if (read_json(std::ifstream{ path }, json_out)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try reading and parsing the backup file.
|
|
||||||
if (read_json(recomp::open_input_backup_file(path), json_out)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Both reads failed.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
recomp::mods::ZipModFileHandle::~ZipModFileHandle() {
|
recomp::mods::ZipModFileHandle::~ZipModFileHandle() {
|
||||||
if (file_handle) {
|
if (file_handle) {
|
||||||
fclose(file_handle);
|
fclose(file_handle);
|
||||||
|
|
@ -1048,6 +1019,10 @@ std::string recomp::mods::error_to_string(ModOpenError error) {
|
||||||
return "Duplicate mod found";
|
return "Duplicate mod found";
|
||||||
case ModOpenError::WrongGame:
|
case ModOpenError::WrongGame:
|
||||||
return "Mod is for a different game";
|
return "Mod is for a different game";
|
||||||
|
case ModOpenError::InvalidDisableOptionDependency:
|
||||||
|
return "Invalid disable option dependency in mod.json";
|
||||||
|
case ModOpenError::InvalidHiddenOptionDependency:
|
||||||
|
return "Invalid hidden option dependency in mod.json";
|
||||||
case ModOpenError::DuplicateEnumStrings:
|
case ModOpenError::DuplicateEnumStrings:
|
||||||
return "Duplicate enum strings found in mod.json (enum strings are case insensitive)";
|
return "Duplicate enum strings found in mod.json (enum strings are case insensitive)";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue