| 336 | } |
| 337 | |
| 338 | uint64_t BytecodeTester::test_files_3_1(const Vector<String> &p_paths) { |
| 339 | uint64_t rev = 0; |
| 340 | bool _514a3fb_failed = false; |
| 341 | bool _1a36141_failed = false; |
| 342 | bool _1ca61a3_failed = false; |
| 343 | Vector<uint8_t> key = GDRESettings::get_singleton()->get_encryption_key(); |
| 344 | |
| 345 | Ref<GDScriptDecomp_514a3fb> decomp_514a3fb = memnew(GDScriptDecomp_514a3fb); |
| 346 | Ref<GDScriptDecomp_1a36141> decomp_1a36141 = memnew(GDScriptDecomp_1a36141); |
| 347 | Ref<GDScriptDecomp_1ca61a3> decomp_1ca61a3 = memnew(GDScriptDecomp_1ca61a3); |
| 348 | int func_max = 0; |
| 349 | int token_max = 0; |
| 350 | |
| 351 | for (String path : p_paths) { |
| 352 | Vector<uint8_t> data; |
| 353 | if (path.has_extension("gde")) { |
| 354 | Error err = GDScriptDecomp::get_buffer_encrypted(path, 3, key, data); |
| 355 | ERR_FAIL_COND_V_MSG(err == ERR_UNAUTHORIZED, 0, "Failed to decrypt file " + path + " (Did you set the correct key?)"); |
| 356 | ERR_FAIL_COND_V_MSG(err != OK, 0, "Failed to read file " + path); |
| 357 | } else { |
| 358 | data = FileAccess::get_file_as_bytes(path); |
| 359 | } |
| 360 | if (data.size() == 0) { |
| 361 | continue; |
| 362 | } |
| 363 | if (!_514a3fb_failed) { |
| 364 | auto test_result = decomp_514a3fb->_test_bytecode(data, token_max, func_max); |
| 365 | switch (test_result) { |
| 366 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_FAIL: |
| 367 | _514a3fb_failed = true; |
| 368 | break; |
| 369 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_CORRUPT: |
| 370 | WARN_PRINT("BYTECODE_TEST_CORRUPT test result for 514a3fb, script " + path); |
| 371 | _514a3fb_failed = true; |
| 372 | break; |
| 373 | default: |
| 374 | break; |
| 375 | } |
| 376 | } |
| 377 | if (!_1a36141_failed) { |
| 378 | auto test_result = decomp_1a36141->_test_bytecode(data, token_max, func_max); |
| 379 | switch (test_result) { |
| 380 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_FAIL: |
| 381 | _1a36141_failed = true; |
| 382 | break; |
| 383 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_CORRUPT: |
| 384 | WARN_PRINT("BYTECODE_TEST_CORRUPT test result for 1a36141, script " + path); |
| 385 | _1a36141_failed = true; |
| 386 | break; |
| 387 | default: |
| 388 | break; |
| 389 | } |
| 390 | } |
| 391 | if (!_1ca61a3_failed) { |
| 392 | auto test_result = decomp_1ca61a3->_test_bytecode(data, token_max, func_max); |
| 393 | switch (test_result) { |
| 394 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_FAIL: |
| 395 | _1ca61a3_failed = true; |
nothing calls this directly
no test coverage detected