| 232 | } |
| 233 | |
| 234 | uint64_t BytecodeTester::test_files_2_1(const Vector<String> &p_paths) { |
| 235 | uint64_t rev = 0; |
| 236 | bool ed80f45_failed = false; |
| 237 | bool _85585c7_failed = false; |
| 238 | bool _7124599_failed = false; |
| 239 | Vector<uint8_t> key = GDRESettings::get_singleton()->get_encryption_key(); |
| 240 | |
| 241 | Ref<GDScriptDecomp_ed80f45> decomp_ed80f45 = memnew(GDScriptDecomp_ed80f45); |
| 242 | Ref<GDScriptDecomp_85585c7> decomp_85585c7 = memnew(GDScriptDecomp_85585c7); |
| 243 | Ref<GDScriptDecomp_7124599> decomp_7124599 = memnew(GDScriptDecomp_7124599); |
| 244 | int func_max = 0; |
| 245 | int token_max = 0; |
| 246 | for (String path : p_paths) { |
| 247 | Vector<uint8_t> data; |
| 248 | if (path.has_extension("gde")) { |
| 249 | Error err = GDScriptDecomp::get_buffer_encrypted(path, 3, key, data); |
| 250 | ERR_FAIL_COND_V_MSG(err == ERR_UNAUTHORIZED, 0, "Failed to decrypt file " + path + " (Did you set the correct key?)"); |
| 251 | ERR_FAIL_COND_V_MSG(err != OK, 0, "Failed to read file " + path); |
| 252 | } else { |
| 253 | data = FileAccess::get_file_as_bytes(path); |
| 254 | } |
| 255 | if (data.size() == 0) { |
| 256 | continue; |
| 257 | } |
| 258 | if (!ed80f45_failed) { |
| 259 | auto test_result = decomp_ed80f45->_test_bytecode(data, token_max, func_max); |
| 260 | switch (test_result) { |
| 261 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_FAIL: |
| 262 | ed80f45_failed = true; |
| 263 | break; |
| 264 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_CORRUPT: |
| 265 | WARN_PRINT("BYTECODE_TEST_CORRUPT test result for ed80f45, script " + path); |
| 266 | ed80f45_failed = true; |
| 267 | break; |
| 268 | default: |
| 269 | break; |
| 270 | } |
| 271 | } |
| 272 | if (!_85585c7_failed) { |
| 273 | auto test_result = decomp_85585c7->_test_bytecode(data, token_max, func_max); |
| 274 | switch (test_result) { |
| 275 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_FAIL: |
| 276 | _85585c7_failed = true; |
| 277 | break; |
| 278 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_CORRUPT: |
| 279 | WARN_PRINT("BYTECODE_TEST_CORRUPT test result for 85585c7, script " + path); |
| 280 | _85585c7_failed = true; |
| 281 | break; |
| 282 | default: |
| 283 | break; |
| 284 | } |
| 285 | } |
| 286 | if (!_7124599_failed) { |
| 287 | auto test_result = decomp_7124599->_test_bytecode(data, token_max, func_max); |
| 288 | switch (test_result) { |
| 289 | case GDScriptDecomp::BytecodeTestResult::BYTECODE_TEST_FAIL: |
| 290 | _7124599_failed = true; |
| 291 | break; |
nothing calls this directly
no test coverage detected