clean up structures
This commit is contained in:
parent
64226599f8
commit
5d5f620fec
2 changed files with 14 additions and 45 deletions
|
@ -29,8 +29,7 @@ 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 (only rectangles are supported)!');
|
||||
|
@ -117,22 +116,21 @@ export class RGBAColor {
|
|||
}
|
||||
|
||||
export class COMPRESSED_DATABLOCK {
|
||||
data: Uint8Array = new Uint8Array();
|
||||
data: Uint8Array = new Uint8Array();
|
||||
|
||||
static read(buffer: BufferStream) {
|
||||
let compressed = new COMPRESSED_DATABLOCK();
|
||||
static read(buffer: BufferStream) {
|
||||
let compressed = new COMPRESSED_DATABLOCK();
|
||||
|
||||
let compressedSize = buffer.readU32LE();
|
||||
let uncompressedSize = buffer.readU32LE();
|
||||
let compressedSize = buffer.readU32LE();
|
||||
let uncompressedSize = buffer.readU32LE();
|
||||
|
||||
if(compressedSize == 0)
|
||||
compressed.data = buffer.subBuffer(uncompressedSize).raw();
|
||||
else {
|
||||
let data = buffer.subBuffer(compressedSize).raw();
|
||||
compressed.data = new Uint8Array(uncompressedSize);
|
||||
compressDecompress(data, compressed.data);
|
||||
if (compressedSize == 0) compressed.data = buffer.subBuffer(uncompressedSize).raw();
|
||||
else {
|
||||
let data = buffer.subBuffer(compressedSize).raw();
|
||||
compressed.data = new Uint8Array(uncompressedSize);
|
||||
compressDecompress(data, compressed.data);
|
||||
}
|
||||
|
||||
return compressed;
|
||||
}
|
||||
|
||||
return compressed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,29 +1,3 @@
|
|||
/*
|
||||
struct AcsImageInfo {
|
||||
u8 unkStart;
|
||||
u16 width;
|
||||
u16 height;
|
||||
bool isCompressed;
|
||||
|
||||
// This algorithm is the size used for allocating
|
||||
// the decompression buffer.
|
||||
// ((Width + 3) & 0xFC) * Height)
|
||||
|
||||
// Data
|
||||
DATABLOCK imageData;
|
||||
|
||||
// The data here is a Win32 RGNDATA
|
||||
COMPRESSED regionData;
|
||||
};
|
||||
|
||||
struct AcsImageInfoPointer {
|
||||
LOCATION imageInfoLocation;
|
||||
u32 checksumMaybe;
|
||||
|
||||
AcsImageInfo imageInfo @ imageInfoLocation.offset;
|
||||
};
|
||||
*/
|
||||
|
||||
import { BufferStream } from '../buffer';
|
||||
import { compressDecompress } from '../decompress';
|
||||
import { COMPRESSED_DATABLOCK, LOCATION, RGNDATA } from './core';
|
||||
|
@ -55,9 +29,6 @@ export class AcsImage {
|
|||
image.data = data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// this will be a rgndata (TODO) read this
|
||||
let temp = COMPRESSED_DATABLOCK.read(buffer);
|
||||
let tempBuffer = new BufferStream(temp.data);
|
||||
|
||||
|
|
Loading…
Reference in a new issue