| 454 | } |
| 455 | |
| 456 | Vector<Ref<GDScriptDecomp>> get_possibles_from_set(const Vector<String> &bytecode_files, const Vector<Ref<GDScriptDecomp>> &decomps, bool print_verbosely = false) { |
| 457 | Vector<Ref<GDScriptDecomp>> passed; |
| 458 | |
| 459 | for (const auto &decomp : decomps) { |
| 460 | bool failed = false; |
| 461 | for (const String &file : bytecode_files) { |
| 462 | Vector<uint8_t> buffer; |
| 463 | if (file.get_extension().to_lower() == "gde") { |
| 464 | Error err = GDScriptDecomp::get_buffer_encrypted(file, 3, GDRESettings::get_singleton()->get_encryption_key(), buffer); |
| 465 | if (err) { |
| 466 | WARN_PRINT("Could not read encrypted bytecode file: " + file); |
| 467 | continue; |
| 468 | } |
| 469 | } else { |
| 470 | buffer = FileAccess::get_file_as_bytes(file); |
| 471 | if (buffer.size() == 0) { |
| 472 | WARN_PRINT("Could not read bytecode file: " + file); |
| 473 | continue; |
| 474 | } |
| 475 | } |
| 476 | auto result = decomp->test_bytecode(buffer, print_verbosely); |
| 477 | if (result == GDScriptDecomp::BYTECODE_TEST_FAIL || result == GDScriptDecomp::BYTECODE_TEST_CORRUPT) { |
| 478 | if (print_verbosely) { |
| 479 | print_line("\t Test failed on file " + file); |
| 480 | } |
| 481 | failed = true; |
| 482 | break; |
| 483 | } |
| 484 | } |
| 485 | if (!failed) { |
| 486 | passed.append(decomp); |
| 487 | } |
| 488 | } |
| 489 | return passed; |
| 490 | } |
| 491 | |
| 492 | Vector<Ref<GDScriptDecomp>> BytecodeTester::get_possible_decomps(Vector<String> bytecode_files, bool include_dev, bool print_verbosely) { |
| 493 | int bytecode_version = get_bytecode_version(bytecode_files); |
no test coverage detected