mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2026-02-26 00:53:27 +03:00
Fix typed arrays of scripts not being decoded properly (#731)
This commit is contained in:
committed by
GitHub
parent
4404b76006
commit
0a632d62b5
@@ -23,7 +23,10 @@ import {
|
||||
Projection,
|
||||
ENCODE_FLAG_64,
|
||||
ENCODE_FLAG_OBJECT_AS_ID,
|
||||
ENCODE_FLAG_TYPED_ARRAY,
|
||||
ENCODE_FLAG_TYPED_ARRAY_MASK,
|
||||
ENCODE_FLAG_TYPED_ARRAY_BUILTIN,
|
||||
ENCODE_FLAG_TYPED_ARRAY_CLASS_NAME,
|
||||
ENCODE_FLAG_TYPED_ARRAY_SCRIPT,
|
||||
RID,
|
||||
Callable,
|
||||
Signal,
|
||||
@@ -144,8 +147,10 @@ export class VariantDecoder {
|
||||
case GDScriptTypes.DICTIONARY:
|
||||
return this.decode_Dictionary(model);
|
||||
case GDScriptTypes.ARRAY:
|
||||
if (type & ENCODE_FLAG_TYPED_ARRAY) {
|
||||
return this.decode_TypedArray(model);
|
||||
if (type & ENCODE_FLAG_TYPED_ARRAY_MASK) {
|
||||
const with_script_name = (type & ENCODE_FLAG_TYPED_ARRAY_CLASS_NAME) != 0;
|
||||
const with_script_path = (type & ENCODE_FLAG_TYPED_ARRAY_SCRIPT) != 0;
|
||||
return this.decode_TypedArray(model, with_script_name || with_script_path);
|
||||
} else {
|
||||
return this.decode_Array(model);
|
||||
}
|
||||
@@ -231,13 +236,12 @@ export class VariantDecoder {
|
||||
return output;
|
||||
}
|
||||
|
||||
private decode_TypedArray(model: BufferModel) {
|
||||
private decode_TypedArray(model: BufferModel, with_scripts: boolean) {
|
||||
const output: Array<any> = [];
|
||||
|
||||
// TODO: the type information is currently discarded
|
||||
// it needs to be decoded and then packed into the output somehow
|
||||
|
||||
const type = this.decode_UInt32(model);
|
||||
const type = with_scripts ? this.decode_String(model) : this.decode_UInt32(model);
|
||||
const count = this.decode_UInt32(model);
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
|
||||
@@ -54,7 +54,10 @@ export enum GDScriptTypes {
|
||||
|
||||
export const ENCODE_FLAG_64 = 1 << 16;
|
||||
export const ENCODE_FLAG_OBJECT_AS_ID = 1 << 16;
|
||||
export const ENCODE_FLAG_TYPED_ARRAY = 1 << 16;
|
||||
export const ENCODE_FLAG_TYPED_ARRAY_MASK = 3 << 16;
|
||||
export const ENCODE_FLAG_TYPED_ARRAY_BUILTIN = 1 << 16;
|
||||
export const ENCODE_FLAG_TYPED_ARRAY_CLASS_NAME = 2 << 16;
|
||||
export const ENCODE_FLAG_TYPED_ARRAY_SCRIPT = 3 << 16;
|
||||
|
||||
export interface BufferModel {
|
||||
buffer: Buffer;
|
||||
|
||||
Reference in New Issue
Block a user