"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ManifestBuffer = void 0;
class ManifestBuffer {
    buf;
    cur = 0;
    start;
    advance = 0x4;
    constructor(buf, start = 0) {
        this.buf = buf;
        this.start = start;
    }
    GoTo(num) {
        this.cur = num;
    }
    Write32(data, relative = true) {
        let w = data;
        if (relative) {
            w += this.start;
        }
        this.buf.writeUInt32BE(w, this.cur);
        this.cur += this.advance;
    }
    Hi32(data) {
        let temp = Buffer.alloc(0x4);
        temp.writeUInt32BE(data, 0);
        this.buf.writeUInt16BE(temp.readUInt16BE(0), this.cur);
    }
    Lo32(data) {
        let temp = Buffer.alloc(0x4);
        temp.writeUInt32BE(data, 0);
        this.buf.writeUInt16BE(temp.readUInt16BE(2), this.cur);
    }
    HexString(hex) {
        let b = Buffer.from(hex, 'hex');
        b.copy(this.buf, this.cur);
        this.cur += b.byteLength;
    }
    Write8(num) {
        this.buf.writeUInt8(num, this.cur);
        this.cur += 0x1;
    }
    SetAdvance(num) {
        this.advance = num;
    }
    Write16(num) {
        this.buf.writeUInt16BE(num, this.cur);
        this.cur += 0x2;
    }
    Float(num) {
        this.buf.writeFloatBE(num, this.cur);
        this.cur += 0x4;
    }
}
exports.ManifestBuffer = ManifestBuffer;
//# sourceMappingURL=Z64ManifestBuffer.js.map