MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / get_bytecode_version

Method get_bytecode_version

bytecode/bytecode_tester.cpp:156–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154*/
155
156int BytecodeTester::get_bytecode_version(const Vector<String> &bytecode_files) {
157 int bytecode_version = 0;
158 if (bytecode_files.size() == 0) {
159 return bytecode_version;
160 }
161 for (const String &file : bytecode_files) {
162 int this_ver = 0;
163 if (file.get_extension().to_lower() == "gde") {
164 this_ver = GDScriptDecomp::read_bytecode_version_encrypted(file, 3, GDRESettings::get_singleton()->get_encryption_key());
165 } else {
166 this_ver = GDScriptDecomp::read_bytecode_version(file);
167 }
168 if (this_ver == -2) {
169 return -2; // encryption error
170 }
171 if (this_ver == -1) {
172 // WARN_PRINT("Could not read bytecode version from file: " + file);
173 continue;
174 }
175 if (bytecode_version == 0) {
176 bytecode_version = this_ver;
177 } else if (this_ver != bytecode_version) {
178 // Hell no.
179 return -1;
180 }
181 }
182 return bytecode_version;
183}
184
185uint64_t BytecodeTester::generic_test(const Vector<String> &p_paths, int ver_major_hint, int ver_minor_hint, bool include_dev, bool print_log_on_fail) {
186 int detected_bytecode_version = get_bytecode_version(p_paths);

Callers 6

set_code_bufferMethod · 0.45
parse_code_stringMethod · 0.45
parse_code_stringMethod · 0.45
parse_code_stringMethod · 0.45
create_text_tokenizerMethod · 0.45

Calls 2

get_encryption_keyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected