UNPKG

elflib

Version:
135 lines (134 loc) 6.51 kB
import assert from 'assert'; import { Structs } from './structs.js'; export class RPLFileInfo extends Structs.RPLFileInfo { constructor() { super(); } get version() { return this._version; } get textSize() { return this._textSize; } get textAlign() { return this._textAlign; } get dataSize() { return this._dataSize; } get dataAlign() { return this._dataAlign; } get loadSize() { return this._loadSize; } get loadAlign() { return this._loadAlign; } get tempSize() { return this._tempSize; } get trampAdjust() { return this._trampAdjust; } get sdaBase() { return this._sdaBase; } get sda2Base() { return this._sda2Base; } get stackSize() { return this._stackSize; } /** The offset from the start of the section to the start of the strings array */ get stringsOffset() { return this._stringsOffset; } get flags() { return this._flags; } get heapSize() { return this._heapSize; } get tagOffset() { return this._tagOffset; } get minVersion() { return this._minVersion; } get compressionLevel() { return this._compressionLevel; } get trampAddition() { return this._trampAddition; } get fileInfoPad() { return this._fileInfoPad; } get cafeSdkVersion() { return this._cafeSdkVersion; } get cafeSdkRevision() { return this._cafeSdkRevision; } get tlsModuleIndex() { return this._tlsModuleIndex; } get tlsAlignShift() { return this._tlsAlignShift; } get runtimeFileInfoSize() { return this._runtimeFileInfoSize; } /** Array of null-terminated strings until the end of the file */ get strings() { return this._strings; } set version(version) { assert(version >= 0x00 && 0xFFFF >= version, `${version} does not fit inside a uint16.`); this._version = version; } set textSize(textSize) { assert(textSize >= 0x00 && 0xFFFFFFFF >= textSize, `${textSize} does not fit inside a uint32.`); this._textSize = textSize; } set textAlign(textAlign) { assert(textAlign >= 0x00 && 0xFFFFFFFF >= textAlign, `${textAlign} does not fit inside a uint32.`); this._textAlign = textAlign; } set dataSize(dataSize) { assert(dataSize >= 0x00 && 0xFFFFFFFF >= dataSize, `${dataSize} does not fit inside a uint32.`); this._dataSize = dataSize; } set dataAlign(dataAlign) { assert(dataAlign >= 0x00 && 0xFFFFFFFF >= dataAlign, `${dataAlign} does not fit inside a uint32.`); this._dataAlign = dataAlign; } set loadSize(loadSize) { assert(loadSize >= 0x00 && 0xFFFFFFFF >= loadSize, `${loadSize} does not fit inside a uint32.`); this._loadSize = loadSize; } set loadAlign(loadAlign) { assert(loadAlign >= 0x00 && 0xFFFFFFFF >= loadAlign, `${loadAlign} does not fit inside a uint32.`); this._loadAlign = loadAlign; } set tempSize(tempSize) { assert(tempSize >= 0x00 && 0xFFFFFFFF >= tempSize, `${tempSize} does not fit inside a uint32.`); this._tempSize = tempSize; } set trampAdjust(trampAdjust) { assert(trampAdjust >= 0x00 && 0xFFFFFFFF >= trampAdjust, `${trampAdjust} does not fit inside a uint32.`); this._trampAdjust = trampAdjust; } set sdaBase(sdaBase) { assert(sdaBase >= 0x00 && 0xFFFFFFFF >= sdaBase, `${sdaBase} does not fit inside a uint32.`); this._sdaBase = sdaBase; } set sda2Base(sda2Base) { assert(sda2Base >= 0x00 && 0xFFFFFFFF >= sda2Base, `${sda2Base} does not fit inside a uint32.`); this._sda2Base = sda2Base; } set stackSize(stackSize) { assert(stackSize >= 0x00 && 0xFFFFFFFF >= stackSize, `${stackSize} does not fit inside a uint32.`); this._stackSize = stackSize; } set stringsOffset(stringsOffset) { assert(stringsOffset >= 0x00 && 0xFFFFFFFF >= stringsOffset, `${stringsOffset} does not fit inside a uint32.`); this._stringsOffset = stringsOffset; } set flags(flags) { assert(flags >= 0x00 && 0xFFFFFFFF >= flags, `${flags} does not fit inside a uint32.`); this._flags = flags; } set heapSize(heapSize) { assert(heapSize >= 0x00 && 0xFFFFFFFF >= heapSize, `${heapSize} does not fit inside a uint32.`); this._heapSize = heapSize; } set tagOffset(tagOffset) { assert(tagOffset >= 0x00 && 0xFFFFFFFF >= tagOffset, `${tagOffset} does not fit inside a uint32.`); this._tagOffset = tagOffset; } set minVersion(minVersion) { assert(minVersion >= 0x00 && 0xFFFFFFFF >= minVersion, `${minVersion} does not fit inside a uint32.`); this._minVersion = minVersion; } set compressionLevel(compressionLevel) { assert(compressionLevel >= -0x80000000 && 0x7FFFFFFF >= compressionLevel, `${compressionLevel} does not fit inside a sint32.`); this._compressionLevel = compressionLevel; } set trampAddition(trampAddition) { assert(trampAddition >= 0x00 && 0xFFFFFFFF >= trampAddition, `${trampAddition} does not fit inside a uint32.`); this._trampAddition = trampAddition; } set fileInfoPad(fileInfoPad) { assert(fileInfoPad >= 0x00 && 0xFFFFFFFF >= fileInfoPad, `${fileInfoPad} does not fit inside a uint32.`); this._fileInfoPad = fileInfoPad; } set cafeSdkVersion(cafeSdkVersion) { assert(cafeSdkVersion >= 0x00 && 0xFFFFFFFF >= cafeSdkVersion, `${cafeSdkVersion} does not fit inside a uint32.`); this._cafeSdkVersion = cafeSdkVersion; } set cafeSdkRevision(cafeSdkRevision) { assert(cafeSdkRevision >= 0x00 && 0xFFFFFFFF >= cafeSdkRevision, `${cafeSdkRevision} does not fit inside a uint32.`); this._cafeSdkRevision = cafeSdkRevision; } set tlsModuleIndex(tlsModuleIndex) { assert(tlsModuleIndex >= 0x00 && 0xFFFF >= tlsModuleIndex, `${tlsModuleIndex} does not fit inside a uint16.`); this._tlsModuleIndex = tlsModuleIndex; } set tlsAlignShift(tlsAlignShift) { assert(tlsAlignShift >= 0x00 && 0xFFFF >= tlsAlignShift, `${tlsAlignShift} does not fit inside a uint16.`); this._tlsAlignShift = tlsAlignShift; } set runtimeFileInfoSize(runtimeFileInfoSize) { assert(runtimeFileInfoSize >= 0x00 && 0xFFFFFFFF >= runtimeFileInfoSize, `${runtimeFileInfoSize} does not fit inside a uint32.`); this._runtimeFileInfoSize = runtimeFileInfoSize; } set strings(strings) { this._strings = strings; } // TODO: Strings validation }