2019-05-10 18:56:19 +02:00
|
|
|
#include "netfile.h"
|
|
|
|
|
|
|
|
bool NETFile::init()
|
|
|
|
{
|
|
|
|
Handle hdl;
|
2019-08-12 22:20:12 +02:00
|
|
|
quint8 multiplier;
|
2019-05-10 18:56:19 +02:00
|
|
|
|
|
|
|
if (!(seek(hdl, 0x15) && readUInt32(hdl, _offset)
|
2019-08-12 22:20:12 +02:00
|
|
|
&& readUInt32(hdl, _size) && readByte(hdl, multiplier)))
|
2019-05-10 18:56:19 +02:00
|
|
|
return false;
|
|
|
|
|
2019-08-12 22:20:12 +02:00
|
|
|
_multiplier = 1<<multiplier;
|
2019-05-10 18:56:19 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NETFile::lblOffset(Handle &hdl, quint32 netOffset, quint32 &lblOffset)
|
|
|
|
{
|
2019-08-12 22:20:12 +02:00
|
|
|
if (!_multiplier && !init())
|
|
|
|
return false;
|
2019-05-10 18:56:19 +02:00
|
|
|
|
|
|
|
if (!(seek(hdl, _offset + netOffset * _multiplier)
|
|
|
|
&& readUInt24(hdl, lblOffset)))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
lblOffset &= 0x3FFFFF;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|