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();
|
let hdr = new RGNDATAHEADER();
|
||||||
|
|
||||||
hdr.size = buffer.readU32LE();
|
hdr.size = buffer.readU32LE();
|
||||||
if(hdr.size != 0x20)
|
if (hdr.size != 0x20) throw new Error('Invalid RGNDATAHEADER!');
|
||||||
throw new Error("Invalid RGNDATAHEADER!");
|
|
||||||
|
|
||||||
hdr.type = buffer.readU32LE();
|
hdr.type = buffer.readU32LE();
|
||||||
if (hdr.type != 1) throw new Error('Invalid RGNDATAHEADER type (only rectangles are supported)!');
|
if (hdr.type != 1) throw new Error('Invalid RGNDATAHEADER type (only rectangles are supported)!');
|
||||||
|
@ -125,8 +124,7 @@ export class COMPRESSED_DATABLOCK {
|
||||||
let compressedSize = buffer.readU32LE();
|
let compressedSize = buffer.readU32LE();
|
||||||
let uncompressedSize = buffer.readU32LE();
|
let uncompressedSize = buffer.readU32LE();
|
||||||
|
|
||||||
if(compressedSize == 0)
|
if (compressedSize == 0) compressed.data = buffer.subBuffer(uncompressedSize).raw();
|
||||||
compressed.data = buffer.subBuffer(uncompressedSize).raw();
|
|
||||||
else {
|
else {
|
||||||
let data = buffer.subBuffer(compressedSize).raw();
|
let data = buffer.subBuffer(compressedSize).raw();
|
||||||
compressed.data = new Uint8Array(uncompressedSize);
|
compressed.data = new Uint8Array(uncompressedSize);
|
||||||
|
|
|
@ -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 { BufferStream } from '../buffer';
|
||||||
import { compressDecompress } from '../decompress';
|
import { compressDecompress } from '../decompress';
|
||||||
import { COMPRESSED_DATABLOCK, LOCATION, RGNDATA } from './core';
|
import { COMPRESSED_DATABLOCK, LOCATION, RGNDATA } from './core';
|
||||||
|
@ -55,9 +29,6 @@ export class AcsImage {
|
||||||
image.data = data;
|
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);
|
let tempBuffer = new BufferStream(temp.data);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue