mirror of
https://github.com/open-goal/jak-project
synced 2026-09-01 17:59:55 -04:00
config cleanup (#4146)
- jak 3 extractor config - validation that extractor expected game matches the provided ISO (no more drag and drop extractor for jak 2/3) - jak 3 bug report template
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
|
||||
// used for - decompiler_out/<jak1> and iso_data/<jak1>
|
||||
const std::unordered_map<std::string, std::string> data_subfolders = {{"jak1", "jak1"},
|
||||
{"jak2", "jak2"}};
|
||||
{"jak2", "jak2"},
|
||||
{"jak3", "jak3"}};
|
||||
|
||||
IsoFile extract_files(fs::path input_file_path, fs::path extracted_iso_path) {
|
||||
lg::info(
|
||||
@@ -32,6 +33,7 @@ IsoFile extract_files(fs::path input_file_path, fs::path extracted_iso_path) {
|
||||
}
|
||||
|
||||
std::tuple<std::optional<ISOMetadata>, ExtractorErrorCode> validate(
|
||||
const std::string& game_name,
|
||||
const fs::path& extracted_iso_path,
|
||||
const uint64_t expected_hash,
|
||||
const int expected_num_files) {
|
||||
@@ -78,6 +80,13 @@ std::tuple<std::optional<ISOMetadata>, ExtractorErrorCode> validate(
|
||||
lg::info("\tSerial - {}", dbEntry->first);
|
||||
lg::info("\tUses Decompiler Config Version - {}", version_info.decomp_config_version);
|
||||
|
||||
// Make sure the game provided matches the expected game (game arg must be provided for jak 2/3)
|
||||
if (version_info.game_name != game_name) {
|
||||
lg::error("Serial '{}' is for {}, expecting an ISO for {}", serial.value(),
|
||||
version_info.game_name, game_name);
|
||||
return {std::nullopt, ExtractorErrorCode::VALIDATION_SERIAL_MISSING_FROM_DB};
|
||||
}
|
||||
|
||||
// - Number of Files
|
||||
if (version_info.num_files != expected_num_files) {
|
||||
lg::error("Extracted an unexpected number of files. Expected '{}', Actual '{}'",
|
||||
@@ -290,7 +299,7 @@ int main(int argc, char** argv) {
|
||||
const auto [hash, file_count] = calculate_extraction_hash(iso_file);
|
||||
// Validate the result to determine the release
|
||||
const auto [version_info, validate_code] =
|
||||
validate(temp_iso_extract_location, hash, file_count);
|
||||
validate(game_name, temp_iso_extract_location, hash, file_count);
|
||||
if (validate_code == ExtractorErrorCode::VALIDATION_BAD_EXTRACTION ||
|
||||
(flag_fail_on_validation && validate_code != ExtractorErrorCode::SUCCESS)) {
|
||||
return static_cast<int>(validate_code);
|
||||
@@ -334,7 +343,7 @@ int main(int argc, char** argv) {
|
||||
// Get hash and file count
|
||||
const auto [hash, file_count] = calculate_extraction_hash(iso_data_path);
|
||||
// Validate
|
||||
auto [version_info, validate_code] = validate(iso_data_path, hash, file_count);
|
||||
auto [version_info, validate_code] = validate(game_name, iso_data_path, hash, file_count);
|
||||
if (validate_code == ExtractorErrorCode::VALIDATION_BAD_EXTRACTION ||
|
||||
(flag_fail_on_validation && validate_code != ExtractorErrorCode::SUCCESS)) {
|
||||
return static_cast<int>(validate_code);
|
||||
|
||||
Reference in New Issue
Block a user