| 2567 | } |
| 2568 | |
| 2569 | Dictionary GDScriptDecomp::to_json() const { |
| 2570 | Dictionary json; |
| 2571 | String engine_version = get_engine_version(); |
| 2572 | // bytecode_rev is a hex string without the 0x prefix |
| 2573 | json["bytecode_rev"] = String::num_int64(get_bytecode_rev(), 16).to_lower(); |
| 2574 | json["bytecode_version"] = get_bytecode_version(); |
| 2575 | json["date"] = get_date(); |
| 2576 | json["engine_version"] = engine_version; |
| 2577 | json["max_engine_version"] = get_max_engine_version(); |
| 2578 | json["engine_ver_major"] = get_engine_ver_major(); |
| 2579 | json["variant_ver_major"] = get_variant_ver_major(); |
| 2580 | json["parent"] = String::num_int64(get_parent(), 16).to_lower(); |
| 2581 | json["is_dev"] = engine_version.contains("-dev") || is_custom(); |
| 2582 | auto added_tokens = get_added_tokens(); |
| 2583 | auto added_tokens_str = PackedStringArray(); |
| 2584 | for (int i = 0; i < added_tokens.size(); i++) { |
| 2585 | added_tokens_str.append(g_token_str[added_tokens[i]]); |
| 2586 | } |
| 2587 | json["added_tokens"] = added_tokens_str; |
| 2588 | auto removed_tokens = get_removed_tokens(); |
| 2589 | auto removed_tokens_str = PackedStringArray(); |
| 2590 | for (int i = 0; i < removed_tokens.size(); i++) { |
| 2591 | removed_tokens_str.append(g_token_str[removed_tokens[i]]); |
| 2592 | } |
| 2593 | json["removed_tokens"] = removed_tokens_str; |
| 2594 | json["added_functions"] = get_added_functions(); |
| 2595 | json["removed_functions"] = get_removed_functions(); |
| 2596 | json["renamed_functions"] = get_renamed_functions(); |
| 2597 | json["arg_count_changed"] = get_function_arg_count_changed(); |
| 2598 | json["tokens_renamed"] = get_tokens_renamed(); |
| 2599 | |
| 2600 | Vector<String> func_names; |
| 2601 | for (int i = 0; i < get_function_count(); i++) { |
| 2602 | func_names.append(get_function_name(i)); |
| 2603 | } |
| 2604 | json["func_names"] = func_names; |
| 2605 | Vector<String> tk_names; |
| 2606 | for (int i = 0; i < get_token_max() + 1; i++) { |
| 2607 | auto val = get_global_token(i); |
| 2608 | tk_names.append(get_token_identifier(val)); |
| 2609 | } |
| 2610 | json["tk_names"] = tk_names; |
| 2611 | return json; |
| 2612 | } |
| 2613 | |
| 2614 | TypedArray<Dictionary> GDScriptDecomp::get_all_decomp_versions_json() { |
| 2615 | TypedArray<Dictionary> ret; |
no test coverage detected