1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-10-07 15:23:22 +02:00
GPXSee/src/map/IMG/netfile.cpp

30 lines
538 B
C++
Raw Normal View History

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, _gmpOffset + 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;
}