104 lines
No EOL
2.6 KiB
C++
104 lines
No EOL
2.6 KiB
C++
/*
|
|
* This file is part of VoidArchiveTool.
|
|
*
|
|
* Copyright (C) 2025 Yanczi
|
|
*
|
|
* Void Archive Toolis free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
#define EXTENSION "pak"
|
|
#define SIGNATURE "XPAK"
|
|
|
|
#define SIGNATURE_KEY_FILE "XKEY"
|
|
|
|
#define VERSION 0x03
|
|
|
|
// WielkoϾ pojedynczego bloku strumienia
|
|
#define CHUNK_STREAM_512KB 524288 // 512KB
|
|
#define CHUNK_STREAM_16MB 16777216 // 16MB
|
|
#define CHUNK_STREAM_256MB 268435456 // 256MB
|
|
|
|
// Rozmiar pojedynczego bloku
|
|
#define CHUNK_BLOCK_SIZE 131072 // 128KB
|
|
|
|
#define FILE_FLAG_RAW 0x00
|
|
#define FILE_FLAG_COMPRESS 0x0F
|
|
#define FILE_FLAG_ENCRYPT 0xF0
|
|
#define FILE_FLAG_ZIPENC 0xFF
|
|
|
|
#define FILE_FLAG_FILTERING 0xAB
|
|
|
|
//Prgoram title
|
|
#define PROGRAM_TITLE "eXtendet PAK"
|
|
#define PROGRAM_VERSION "v0.5"
|
|
#define PROGRAM_AUTHOR "Yanczi"
|
|
#define PROGRAM_COMPILING "19 December 2025"
|
|
#define PROGRAM_LICENSE "GNU LGPL v3"
|
|
|
|
// Pliki
|
|
namespace fl {
|
|
inline constexpr std::string_view sigpak = "XPAK";
|
|
inline constexpr std::string_view sigkey = "XKEY";
|
|
|
|
inline constexpr std::string_view extpak = "pak";
|
|
inline constexpr std::string_view extkey = "key";
|
|
}
|
|
|
|
// Size
|
|
namespace ds
|
|
{
|
|
// Chunki streamowania
|
|
inline constexpr int chunk_stream = 268435456; // 256MB
|
|
|
|
// Blok chunków
|
|
inline constexpr int block_size = 131072; // 128KB
|
|
|
|
// Maksymalny rozmiar pliku do spakowania
|
|
inline constexpr int maxFileSize = 8589934592; // 8GB
|
|
}
|
|
|
|
// Flagi
|
|
namespace flag
|
|
{
|
|
inline constexpr uint8_t raw = 0x00; // Surowy plik
|
|
inline constexpr uint8_t zip = 0x0F; // Kompresja
|
|
inline constexpr uint8_t enc = 0xF0; // Szyfrowanie
|
|
inline constexpr uint8_t ezd = 0xFF; // Kompresja z szyfrowaniem
|
|
|
|
// Flaga do aktywacji filtra zdefiniowanego w json
|
|
inline constexpr uint8_t filter = 0xAB;
|
|
}
|
|
|
|
struct CargoHead
|
|
{
|
|
std::string signature;
|
|
uint8_t version;
|
|
uint64_t table;
|
|
uint32_t files;
|
|
};
|
|
|
|
struct FilesTable
|
|
{
|
|
uint8_t nameLen;
|
|
std::string nameFile;
|
|
uint64_t offset;
|
|
uint64_t size;
|
|
uint64_t crc;
|
|
uint8_t flag;
|
|
}; |