2021-04-10 15:27:40 +02:00
|
|
|
#ifndef IMG_LBLFILE_H
|
|
|
|
#define IMG_LBLFILE_H
|
2019-05-10 18:56:19 +02:00
|
|
|
|
2021-03-19 08:42:20 +01:00
|
|
|
#include <QPixmap>
|
2020-12-22 22:09:09 +01:00
|
|
|
#include "common/textcodec.h"
|
2022-03-25 19:28:32 +01:00
|
|
|
#include "section.h"
|
2019-05-10 18:56:19 +02:00
|
|
|
#include "subfile.h"
|
2019-06-30 20:39:22 +02:00
|
|
|
#include "label.h"
|
2019-05-10 18:56:19 +02:00
|
|
|
|
2021-04-10 15:27:40 +02:00
|
|
|
namespace IMG {
|
|
|
|
|
2020-11-10 00:58:19 +01:00
|
|
|
class HuffmanText;
|
|
|
|
class RGNFile;
|
2019-05-10 18:56:19 +02:00
|
|
|
|
|
|
|
class LBLFile : public SubFile
|
|
|
|
{
|
|
|
|
public:
|
2021-04-10 15:27:40 +02:00
|
|
|
LBLFile(const IMGData *img)
|
2023-12-21 01:31:44 +01:00
|
|
|
: SubFile(img), _huffmanText(0), _table(0), _rasters(0), _codec(1252),
|
|
|
|
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
2020-11-10 00:58:19 +01:00
|
|
|
LBLFile(const QString *path)
|
2023-12-21 01:31:44 +01:00
|
|
|
: SubFile(path), _huffmanText(0), _table(0), _rasters(0), _codec(1252),
|
|
|
|
_imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
2022-03-25 19:28:32 +01:00
|
|
|
LBLFile(const SubFile *gmp, quint32 offset)
|
|
|
|
: SubFile(gmp, offset), _huffmanText(0), _table(0), _rasters(0),
|
2023-12-21 01:31:44 +01:00
|
|
|
_codec(1252), _imgIdSize(0), _poiShift(0), _shift(0), _encoding(0) {}
|
2020-11-10 00:58:19 +01:00
|
|
|
~LBLFile();
|
|
|
|
|
|
|
|
bool load(Handle &hdl, const RGNFile *rgn, Handle &rgnHdl);
|
|
|
|
void clear();
|
2019-05-10 18:56:19 +02:00
|
|
|
|
2020-02-16 12:57:40 +01:00
|
|
|
Label label(Handle &hdl, quint32 offset, bool poi = false,
|
2021-08-16 09:00:36 +02:00
|
|
|
bool capitalize = true, bool convert = false) const;
|
2022-02-06 04:17:08 +01:00
|
|
|
Label label(Handle &hdl, const SubFile *file, Handle &fileHdl,
|
2022-02-06 11:53:43 +01:00
|
|
|
quint32 size, bool capitalize = true, bool convert = false) const;
|
2019-05-10 18:56:19 +02:00
|
|
|
|
2022-03-25 19:28:32 +01:00
|
|
|
quint8 imageIdSize() const {return _imgIdSize;}
|
2021-03-19 08:42:20 +01:00
|
|
|
QPixmap image(Handle &hdl, quint32 id) const;
|
2021-01-25 21:37:07 +01:00
|
|
|
|
2019-05-10 18:56:19 +02:00
|
|
|
private:
|
2021-02-10 21:26:26 +01:00
|
|
|
struct Image {
|
2021-01-27 21:18:06 +01:00
|
|
|
quint32 offset;
|
|
|
|
quint32 size;
|
|
|
|
};
|
|
|
|
|
2021-08-16 09:00:36 +02:00
|
|
|
Label str2label(const QVector<quint8> &str, bool capitalize,
|
|
|
|
bool convert) const;
|
2022-02-06 11:53:43 +01:00
|
|
|
Label label6b(const SubFile *file, Handle &fileHdl, quint32 size,
|
|
|
|
bool capitalize, bool convert) const;
|
|
|
|
Label label8b(const SubFile *file, Handle &fileHdl, quint32 size,
|
2022-02-06 04:17:08 +01:00
|
|
|
bool capitalize, bool convert) const;
|
2022-02-06 11:53:43 +01:00
|
|
|
Label labelHuffman(Handle &hdl, const SubFile *file, Handle &fileHdl,
|
|
|
|
quint32 size, bool capitalize, bool convert) const;
|
2021-02-10 21:26:26 +01:00
|
|
|
bool loadRasterTable(Handle &hdl, quint32 offset, quint32 size,
|
2021-01-27 21:18:06 +01:00
|
|
|
quint32 recordSize);
|
2020-11-10 00:58:19 +01:00
|
|
|
|
|
|
|
HuffmanText *_huffmanText;
|
|
|
|
quint32 *_table;
|
2021-02-10 21:26:26 +01:00
|
|
|
Image *_rasters;
|
2020-12-22 22:09:09 +01:00
|
|
|
TextCodec _codec;
|
2022-03-25 19:28:32 +01:00
|
|
|
Section _base, _poi, _img;
|
2021-02-10 21:26:26 +01:00
|
|
|
quint32 _imgCount;
|
2022-03-25 19:28:32 +01:00
|
|
|
quint8 _imgIdSize;
|
|
|
|
quint8 _poiShift;
|
|
|
|
quint8 _shift;
|
2019-05-10 18:56:19 +02:00
|
|
|
quint8 _encoding;
|
|
|
|
};
|
|
|
|
|
2021-04-10 15:27:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // IMG_LBLFILE_H
|