Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
This commit is contained in:
@@ -22,6 +22,10 @@ class KeyLayouts:
|
||||
extends RefCounted
|
||||
var strings: Dictionary = {}
|
||||
var names: Dictionary = {}
|
||||
# Bounded per-call immutable scalar encodings; never retain mutable containers.
|
||||
var integers: Dictionary = {}
|
||||
var text_values: Dictionary = {}
|
||||
var name_values: Dictionary = {}
|
||||
|
||||
|
||||
|
||||
@@ -56,14 +60,19 @@ static func _encode_value(value: Variant, output: PackedByteArray, depth: int, l
|
||||
TYPE_BOOL:
|
||||
_append_ascii(output, "b1" if bool(value) else "b0")
|
||||
TYPE_INT:
|
||||
_append_ascii(output, "i%d;" % int(value))
|
||||
if layouts.integers.has(value):
|
||||
output.append_array(layouts.integers[value])
|
||||
else:
|
||||
var encoded := ("i%d;" % int(value)).to_utf8_buffer()
|
||||
output.append_array(encoded)
|
||||
if layouts.integers.size() < 512: layouts.integers[value] = encoded
|
||||
TYPE_FLOAT:
|
||||
_append_ascii(output, "f")
|
||||
return _append_float64(output, float(value))
|
||||
TYPE_STRING:
|
||||
_append_sized_bytes(output, "s", String(value).to_utf8_buffer())
|
||||
_append_cached_text(output, "s", String(value), layouts.text_values)
|
||||
TYPE_STRING_NAME:
|
||||
_append_sized_bytes(output, "q", String(value).to_utf8_buffer())
|
||||
_append_cached_text(output, "q", String(value), layouts.name_values)
|
||||
TYPE_VECTOR2:
|
||||
var vector: Vector2 = value
|
||||
_append_ascii(output, "v2")
|
||||
@@ -290,3 +299,15 @@ static func _append_sized_bytes(output: PackedByteArray, tag: String, value: Pac
|
||||
|
||||
static func _append_ascii(output: PackedByteArray, value: String) -> void:
|
||||
output.append_array(value.to_utf8_buffer())
|
||||
|
||||
|
||||
static func _append_cached_text(output: PackedByteArray, tag: String, value: String, cache: Dictionary) -> void:
|
||||
if cache.has(value):
|
||||
output.append_array(cache[value])
|
||||
return
|
||||
var bytes := value.to_utf8_buffer()
|
||||
var encoded := ("%s%d:" % [tag, bytes.size()]).to_utf8_buffer()
|
||||
encoded.append_array(bytes)
|
||||
output.append_array(encoded)
|
||||
if value.length() <= 128 and cache.size() < 256:
|
||||
cache[value] = encoded
|
||||
|
||||
Reference in New Issue
Block a user