From 3cf6aedc851ff77d5a8c7db978983d62c52ed043 Mon Sep 17 00:00:00 2001 From: Syping Date: Mon, 9 Nov 2020 02:13:06 +0100 Subject: [PATCH] RagePhoto: add G5E1P parser, fix G5E2P --- RagePhoto.cpp | 22 +++++++++++++++++++++- RagePhoto.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/RagePhoto.cpp b/RagePhoto.cpp index ff778c4..8b44dfb 100644 --- a/RagePhoto.cpp +++ b/RagePhoto.cpp @@ -357,7 +357,27 @@ bool RagePhoto::load() } else if (format == static_cast(ExportFormat::G5E2P)) { p_photoFormat = PhotoFormat::G5EX; - p_fileData = dataBuffer.readAll(); + p_fileData = qUncompress(dataBuffer.readAll()); + p_inputMode = 0; + return load(); + } + else if (format == static_cast(ExportFormat::G5E1P)) { + size = dataBuffer.skip(1); + if (size != 1) + return false; + + char length[1]; + size = dataBuffer.read(length, 1); + if (size != 1) + return false; + int i_length = QByteArray::number((int)length[0], 16).toInt() + 6; + + size = dataBuffer.skip(i_length); + if (size != i_length) + return false; + + p_photoFormat = PhotoFormat::G5EX; + p_fileData = qUncompress(dataBuffer.readAll()); p_inputMode = 0; return load(); } diff --git a/RagePhoto.h b/RagePhoto.h index 26491e0..cffd486 100644 --- a/RagePhoto.h +++ b/RagePhoto.h @@ -28,6 +28,7 @@ class RagePhoto : public QObject Q_OBJECT public: enum class ExportFormat : quint32 { + G5E1P = 0x454C0010U, G5E2P = 0x01000032U, G5E2S = 0x02000032U, G5E3P = 0x01000033U,