| 1516 | // Error get_script_strings(const Vector<uint8_t> &p_buffer, Vector<String> &r_strings, bool include_identifiers = false); |
| 1517 | |
| 1518 | Error GDScriptDecomp::get_script_strings(const String &p_path, int bytecode_revision, Vector<String> &r_strings, bool p_include_identifiers) { |
| 1519 | Vector<uint8_t> p_buffer; |
| 1520 | Error err = OK; |
| 1521 | auto decomp = GDScriptDecomp::create_decomp_for_commit(bytecode_revision); |
| 1522 | if (decomp.is_null()) { |
| 1523 | return ERR_INVALID_PARAMETER; |
| 1524 | } |
| 1525 | if (p_path.get_extension().to_lower() == "gde") { |
| 1526 | err = get_buffer_encrypted(p_path, 3, GDRESettings::get_singleton()->get_encryption_key(), p_buffer); |
| 1527 | ERR_FAIL_COND_V_MSG(err != OK, err, "Error reading encrypted file: " + p_path); |
| 1528 | } else if (p_path.get_extension().to_lower() == "gd") { |
| 1529 | String text = FileAccess::get_file_as_string(p_path, &err); |
| 1530 | ERR_FAIL_COND_V_MSG(err != OK, err, "Error reading file: " + p_path); |
| 1531 | p_buffer = decomp->compile_code_string(text); |
| 1532 | ERR_FAIL_COND_V_MSG(p_buffer.size() == 0, ERR_PARSE_ERROR, "Error compiling code: " + p_path); |
| 1533 | } else { |
| 1534 | p_buffer = FileAccess::get_file_as_bytes(p_path, &err); |
| 1535 | ERR_FAIL_COND_V_MSG(err != OK, err, "Error reading file: " + p_path); |
| 1536 | } |
| 1537 | return decomp->get_script_strings_from_buf(p_buffer, r_strings, p_include_identifiers); |
| 1538 | } |
| 1539 | |
| 1540 | Error GDScriptDecomp::get_script_strings_from_buf(const Vector<uint8_t> &p_buffer, Vector<String> &r_strings, bool p_include_identifiers) { |
| 1541 | ScriptState script_state; |
nothing calls this directly
no test coverage detected