From 66e776ee87597b60c3cf0b3c313ba9ae4a963e3f Mon Sep 17 00:00:00 2001 From: yanczi Date: Thu, 6 Nov 2025 03:24:15 +0100 Subject: [PATCH] ex --- CreateCargo.cpp | 18 +++++++++--------- CreateCargo.h | 4 ++-- CreateCargoEX.cpp | 1 + CreateCargoEX.h | 5 +++++ DataStruct.h | 6 +++--- ExtractCargo.cpp | 4 ++-- voidcmd.vcxproj | 2 ++ 7 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 CreateCargoEX.cpp create mode 100644 CreateCargoEX.h diff --git a/CreateCargo.cpp b/CreateCargo.cpp index eb7c21a..30f4cb4 100644 --- a/CreateCargo.cpp +++ b/CreateCargo.cpp @@ -222,30 +222,30 @@ std::vector CreateCargo::ComputingHeadFiles() f.seekg(0, std::ios::beg); //Wczytanie pliku do pamięci - std::vector buffor(size); - f.read(buffor.data(), size); + std::vector buffer(size); + f.read(buffer.data(), size); f.close(); //Tworzenie hashu CRC - const uint64_t crc = XXH64(buffor.data(), buffor.size(), VERSION); + const uint64_t crc = XXH64(buffer.data(), buffer.size(), VERSION); //Kompresjia - std::vector zip; - uint8_t method = CheckFileOnTheList(path, buffor, zip); + std::vector pakBuffer; + uint8_t method = CheckFileOnTheList(path, buffer, pakBuffer); FilesTable ft; ft.nameFile = path; ft.nameLen = path.length(); ft.hashName = fnv64(path); ft.offset = offset; - ft.size = zip.size(); - ft.isZip = method; + ft.size = pakBuffer.size(); + ft.flag = method; ft.crc = crc; - cargo.write(reinterpret_cast(zip.data()), zip.size()); + cargo.write(reinterpret_cast(pakBuffer.data()), pakBuffer.size()); filesTable.push_back(ft); - offset += zip.size(); + offset += pakBuffer.size(); } return filesTable; } diff --git a/CreateCargo.h b/CreateCargo.h index ab2d93b..f17100f 100644 --- a/CreateCargo.h +++ b/CreateCargo.h @@ -46,9 +46,9 @@ #define KEY_ZIP "COMPRESS" // Pliki do skompresowania #define KEY_RAW "RAW" // Pliki które mają pozostać w oryginalnej formie #define KEY_IGNORE "IGNORE" // Pliki pominięte przy pakowaniu -#define KEY_ENCRYPT "ENCRYPT" // Plili które mają być zaszyfrowane +#define KEY_ENCRYPT "ENCRYPT" // Plili które mają być zaszyfrowane -#define ALL_FILE ".*" // Wszystkie pliki +#define ALL_FILE ".*" // Wszystkie pliki struct PathConf { diff --git a/CreateCargoEX.cpp b/CreateCargoEX.cpp new file mode 100644 index 0000000..a0dae00 --- /dev/null +++ b/CreateCargoEX.cpp @@ -0,0 +1 @@ +#include "CreateCargoEX.h" diff --git a/CreateCargoEX.h b/CreateCargoEX.h new file mode 100644 index 0000000..08f2480 --- /dev/null +++ b/CreateCargoEX.h @@ -0,0 +1,5 @@ +#pragma once +class CreateCargoEX +{ +}; + diff --git a/DataStruct.h b/DataStruct.h index 8136b69..ab7fea9 100644 --- a/DataStruct.h +++ b/DataStruct.h @@ -27,7 +27,7 @@ #define SIGNATURE_KEY_FILE 1497713496 // XKEY -#define VERSION 100 +#define VERSION 300 enum StoreMethod { @@ -59,7 +59,7 @@ enum StoreMethod struct CargoHead { std::string signature; - uint16_t version; + int16_t version; uint32_t files; uint64_t table; }; @@ -72,5 +72,5 @@ struct FilesTable uint64_t offset; uint32_t size; uint64_t crc; - uint8_t isZip; + int8_t flag; }; \ No newline at end of file diff --git a/ExtractCargo.cpp b/ExtractCargo.cpp index fbbfeb8..cdc4907 100644 --- a/ExtractCargo.cpp +++ b/ExtractCargo.cpp @@ -150,7 +150,7 @@ void ExtractCargo::LoadFilesTable() cargoFile.read(reinterpret_cast(&fhTmp.offset), sizeof(fhTmp.offset)); cargoFile.read(reinterpret_cast(&fhTmp.size), sizeof(fhTmp.size)); cargoFile.read(reinterpret_cast(&fhTmp.crc), sizeof(fhTmp.crc)); - cargoFile.read(reinterpret_cast(&fhTmp.isZip), sizeof(fhTmp.isZip)); + cargoFile.read(reinterpret_cast(&fhTmp.flag), sizeof(fhTmp.flag)); filesHeads.push_back(fhTmp); } @@ -174,7 +174,7 @@ void ExtractCargo::ExtractingFilesFromCargo() cargoFile.read(buffor.data(), fh.size); - std::vector rawBuffor = fh.isZip ? cm.decompress(buffor) : eman.decrypt(buffor); + std::vector rawBuffor = fh.flag ? cm.decompress(buffor) : eman.decrypt(buffor); if (!HashValid(rawBuffor, fh.crc)) { diff --git a/voidcmd.vcxproj b/voidcmd.vcxproj index d0fe1d7..3f10666 100644 --- a/voidcmd.vcxproj +++ b/voidcmd.vcxproj @@ -134,6 +134,7 @@ + @@ -143,6 +144,7 @@ +