GDScript: Enable compression on export

Besides the regular option to export GDScript as binary tokens, this
also includes a compression option on top of it. The binary format
needs to encode some information which generally makes it bigger than
the source text. This option reduces that difference by using Zstandard
compression on the buffer.
This commit is contained in:
George Marques 2024-01-26 14:49:31 -03:00
parent b4d0a09f15
commit 72e5f8c31e
No known key found for this signature in database
GPG key ID: 046BD46A3201E43D
11 changed files with 93 additions and 44 deletions

View file

@ -365,6 +365,7 @@ Error GDScriptParser::parse(const String &p_source_code, const String &p_script_
pop_multiline();
memdelete(text_tokenizer);
tokenizer = nullptr;
#ifdef DEBUG_ENABLED
if (multiline_stack.size() > 0) {
@ -384,6 +385,7 @@ Error GDScriptParser::parse_binary(const Vector<uint8_t> &p_binary, const String
Error err = buffer_tokenizer->set_code_buffer(p_binary);
if (err) {
memdelete(buffer_tokenizer);
return err;
}
@ -404,6 +406,7 @@ Error GDScriptParser::parse_binary(const Vector<uint8_t> &p_binary, const String
pop_multiline();
memdelete(buffer_tokenizer);
tokenizer = nullptr;
if (errors.is_empty()) {
return OK;