Documentation cleanup and some feature improvements (#1155)

* ci: switch to codacy for coverage

* docs: update badges

* decomp: allow overriding config flags via CLI

* cleanup: top level file cleanup

* docs: big README overhaul

Attempt to close #1128 and #1086

* decomp: attempt to detect if `iso_data` is missing or wrongly extracted

* game: switch to `fpng` for screenshots, allow for compression

closes #1035

* game: switch vsync control to a checkbox

* lint: format cpp files

* lint: format json files

* docs/scripts: organize taskfile
This commit is contained in:
Tyler Wilding
2022-02-12 17:48:50 -05:00
committed by GitHub
parent 24578b64b9
commit ffb04ddd10
39 changed files with 4608 additions and 3170 deletions
+52 -3
View File
@@ -10,6 +10,7 @@
#include "decompiler/level_extractor/extract_level.h"
#include "decompiler/data/TextureDB.h"
#include "common/util/os.h"
#include "common/util/diff.h"
int main(int argc, char** argv) {
fmt::print("[Mem] Size of linked word: {}\n", sizeof(decompiler::LinkedWord));
@@ -25,8 +26,10 @@ int main(int argc, char** argv) {
file_util::init_crc();
init_opcode_info();
if (argc != 4) {
printf("Usage: decompiler <config_file> <in_folder> <out_folder>\n");
if (argc < 4) {
printf(
"Usage: decompiler <config_file> <in_folder> <out_folder> "
"[bool_flag_name=true/false...]\n");
return 1;
}
fmt::print("[Mem] After init: {} MB\n", get_peak_rss() / (1024 * 1024));
@@ -34,7 +37,44 @@ int main(int argc, char** argv) {
// collect all files to process
Config config;
try {
config = read_config_file(argv[1]);
// Allow overriding config boolean flags via CLI
// There are very minimum guard-rails here
//
// "<key>=<override>"
//
// This allows us to run scripts that deviate from the defaults
std::map<std::string, bool> overrides;
if (argc > 4) {
for (int i = 4; i < argc; i++) {
std::string val = argv[i];
if (val.find('=') == std::string::npos) {
printf("Aborting - invalid flag override syntax\n");
printf(
"Usage: decompiler <config_file> <in_folder> <out_folder> "
"[bool_flag_name=true/false...]\n");
return 1;
}
auto pair = split_string(argv[i], '=');
if (pair.size() > 2) {
printf("Aborting - invalid flag override syntax, provide pairs!\n");
printf(
"Usage: decompiler <config_file> <in_folder> <out_folder> "
"[bool_flag_name=true/false...]\n");
return 1;
}
if (pair.at(1) != "true" && pair.at(1) != "false") {
printf("Aborting - invalid flag override syntax, true|false only!\n");
printf(
"Usage: decompiler <config_file> <in_folder> <out_folder> "
"[bool_flag_name=true/false...]\n");
return 1;
}
overrides.insert({pair.at(0), pair.at(0) == "true"});
}
}
config = read_config_file(argv[1], overrides);
} catch (const std::exception& e) {
lg::error("Failed to parse config: {}", e.what());
return 1;
@@ -43,6 +83,15 @@ int main(int argc, char** argv) {
std::string in_folder = file_util::combine_path(argv[2], config.game_name);
std::string out_folder = file_util::combine_path(argv[3], config.game_name);
// Verify the in_folder is correct
// TODO - refactor to use ghc::filesystem, cleanup file_util
if (!file_util::file_exists(in_folder) ||
(!config.expected_elf_name.empty() &&
!file_util::file_exists(file_util::combine_path(in_folder, config.expected_elf_name)))) {
printf("Aborting - 'in_folder' does not exist or does not contain the expected files\n");
return 1;
}
std::vector<std::string> dgos, objs, strs;
for (const auto& dgo_name : config.dgo_names) {
dgos.push_back(file_util::combine_path(in_folder, dgo_name));