MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / write_manifest

Function write_manifest

RecompModTool/main.cpp:506–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

504}
505
506void write_manifest(const std::filesystem::path& path, const ModManifest& manifest) {
507 toml::table output_data{};
508
509 output_data.emplace("game_id", manifest.game_id);
510 output_data.emplace("id", manifest.mod_id);
511 output_data.emplace("version", manifest.version_string);
512 output_data.emplace("display_name", manifest.display_name);
513
514 if (!manifest.description.empty()) {
515 output_data.emplace("description", manifest.description);
516 }
517
518 if (!manifest.short_description.empty()) {
519 output_data.emplace("short_description", manifest.short_description);
520 }
521
522 output_data.emplace("authors", string_vector_to_toml(manifest.authors));
523
524 output_data.emplace("minimum_recomp_version", manifest.minimum_recomp_version);
525
526 if (!manifest.native_libraries.empty()) {
527 toml::table libraries_table{};
528
529 size_t library_index = 0;
530 for (const auto& [library, funcs] : manifest.native_libraries) {
531 libraries_table.emplace(library, string_vector_to_toml(funcs));
532 }
533
534 output_data.emplace("native_libraries", std::move(libraries_table));
535 }
536
537 if (!manifest.full_dependency_strings.empty()) {
538 output_data.emplace("dependencies", string_vector_to_toml(manifest.full_dependency_strings));
539 }
540
541 if (!manifest.full_optional_dependency_strings.empty()) {
542 output_data.emplace("optional_dependencies", string_vector_to_toml(manifest.full_optional_dependency_strings));
543 }
544
545 if (!manifest.config_options.empty()) {
546 toml::array options_array{};
547 for (const auto& option : manifest.config_options) {
548 options_array.emplace_back(option);
549 }
550 output_data.emplace("config_schema", toml::table{{"options", std::move(options_array)}});
551 }
552
553 if (manifest.custom_gamemode) {
554 output_data.emplace("custom_gamemode", manifest.custom_gamemode);
555 }
556
557 toml::json_formatter formatter{output_data, toml::format_flags::indentation | toml::format_flags::indentation};
558 std::ofstream output_file(path);
559
560 output_file << formatter << std::endl;
561}
562
563N64Recomp::Context build_mod_context(const N64Recomp::Context& input_context, bool& good) {

Callers 1

mainFunction · 0.85

Calls 1

string_vector_to_tomlFunction · 0.85

Tested by

no test coverage detected