Add variable 'filler byte' option. Compressed data is escaped/terminated with it. 0x20 for wtv- service, 0x00 for ROMFS.

This commit is contained in:
Eric MacDonald
2021-09-08 15:33:20 -04:00
parent 924d4bbe43
commit d6d2c75d72

View File

@@ -287,7 +287,8 @@ class WTVLzpf {
this.match_index = 0; this.match_index = 0;
this.type_index = 0; this.type_index = 0;
this.checksum = 0; this.checksum = 0;
this.ring_buffer.fill(0x00, 0, 0x2000) this.filler_byte = 0x20
this.ring_buffer.fill(this.filler_byte, 0, 0x2000)
this.flag_table.fill(0xFFFF, 0, 0x1000); this.flag_table.fill(0xFFFF, 0, 0x1000);
this.encoded_data = []; this.encoded_data = [];
} }
@@ -441,7 +442,7 @@ class WTVLzpf {
if (this.current_literal != 0x00) { if (this.current_literal != 0x00) {
this.AddByte((this.current_literal >>> 0x18) & 0xFF); this.AddByte((this.current_literal >>> 0x18) & 0xFF);
} }
this.AddByte(0x20); this.AddByte(this.filler_byte);
return Buffer.from(this.encoded_data); return Buffer.from(this.encoded_data);
} }