read image RGNDATA structure

This commit is contained in:
Lily Tsuru 2024-07-09 18:59:11 -04:00
parent 5c3433461d
commit 64226599f8
2 changed files with 10 additions and 5 deletions

View file

@ -19,7 +19,7 @@ export class RECT {
}
export class RGNDATAHEADER {
size = 0x20; // I think?
size = 0x20;
type = 1;
count = 0;
rgnSize = 0;
@ -29,11 +29,11 @@ export class RGNDATAHEADER {
let hdr = new RGNDATAHEADER();
hdr.size = buffer.readU32LE();
//if(hdr.size != 0x20)
// throw new Error("Invalid RGNDATAHEADER!");
if(hdr.size != 0x20)
throw new Error("Invalid RGNDATAHEADER!");
hdr.type = buffer.readU32LE();
if (hdr.type != 1) throw new Error('Invalid RGNDATAHEADER type!');
if (hdr.type != 1) throw new Error('Invalid RGNDATAHEADER type (only rectangles are supported)!');
hdr.count = buffer.readU32LE();
hdr.rgnSize = buffer.readU32LE();

View file

@ -55,8 +55,13 @@ export class AcsImage {
image.data = data;
}
// this will be a rgndata (TODO) read this
//let temp = COMPRESSED_DATABLOCK.read(buffer);
let temp = COMPRESSED_DATABLOCK.read(buffer);
let tempBuffer = new BufferStream(temp.data);
image.regionData = RGNDATA.read(tempBuffer);
return image;
}