diff --git a/RSPRecomp/src/rsp_recomp.cpp b/RSPRecomp/src/rsp_recomp.cpp index b52cf96..fa32626 100644 --- a/RSPRecomp/src/rsp_recomp.cpp +++ b/RSPRecomp/src/rsp_recomp.cpp @@ -639,18 +639,27 @@ bool read_config(const std::filesystem::path& config_path, RSPRecompilerConfig& std::filesystem::path basedir = std::filesystem::path{ config_path }.parent_path(); std::optional text_offset = config_data["text_offset"].value(); - if (!text_offset.has_value()) { - throw toml::parse_error("Missing text_offset in config file", {}); + if (text_offset.has_value()) { + ret.text_offset = text_offset.value(); + } + else { + throw toml::parse_error("Missing text_offset in config file", config_data.source()); } std::optional text_size = config_data["text_size"].value(); - if (!text_size.has_value()) { - throw toml::parse_error("Missing text_size in config file", {}); + if (text_size.has_value()) { + ret.text_size = text_size.value(); + } + else { + throw toml::parse_error("Missing text_size in config file", config_data.source()); } std::optional text_address = config_data["text_address"].value(); - if (!text_address.has_value()) { - throw toml::parse_error("Missing text_address in config file", {}); + if (text_address.has_value()) { + ret.text_address = text_address.value(); + } + else { + throw toml::parse_error("Missing text_address in config file", config_data.source()); } std::optional rom_file_path = config_data["rom_file_path"].value(); @@ -658,7 +667,7 @@ bool read_config(const std::filesystem::path& config_path, RSPRecompilerConfig& ret.rom_file_path = concat_if_not_empty(basedir, rom_file_path.value()); } else { - throw toml::parse_error("Missing rom_file_path in config file", {}); + throw toml::parse_error("Missing rom_file_path in config file", config_data.source()); } std::optional output_file_path = config_data["output_file_path"].value(); @@ -666,7 +675,7 @@ bool read_config(const std::filesystem::path& config_path, RSPRecompilerConfig& ret.output_file_path = concat_if_not_empty(basedir, output_file_path.value()); } else { - throw toml::parse_error("Missing output_file_path in config file", {}); + throw toml::parse_error("Missing output_file_path in config file", config_data.source()); } std::optional output_function_name = config_data["output_function_name"].value(); @@ -674,7 +683,7 @@ bool read_config(const std::filesystem::path& config_path, RSPRecompilerConfig& ret.output_function_name = output_function_name.value(); } else { - throw toml::parse_error("Missing output_function_name in config file", {}); + throw toml::parse_error("Missing output_function_name in config file", config_data.source()); } // Extra indirect branch targets (optional) diff --git a/src/config.cpp b/src/config.cpp index b8e6748..b22f9bf 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -19,11 +19,11 @@ std::vector get_manual_funcs(const toml::array* manu if (func_name.has_value() && section_name.has_value() && vram_in.has_value() && size.has_value()) { ret.emplace_back(func_name.value(), section_name.value(), vram_in.value(), size.value()); } else { - throw toml::parse_error("Missing required value in manual_funcs array", {}); + throw toml::parse_error("Missing required value in manual_funcs array", el.source()); } } else { - throw toml::parse_error("Missing required value in manual_funcs array", {}); + throw toml::parse_error("Missing required value in manual_funcs array", el.source()); } }); @@ -279,7 +279,7 @@ RecompPort::Config::Config(const char* path) { output_func_path = concat_if_not_empty(basedir, output_func_path_opt.value()); } else { - throw toml::parse_error("Missing output_func_path in config file", {}); + throw toml::parse_error("Missing output_func_path in config file", input_data.node()->source()); } std::optional relocatable_sections_path_opt = input_data["relocatable_sections_path"].value();