Files
gMod/header/gMod_FileLoader.h
T
DubbleClick ab2d8cdb0a 1.5.4 (#7)
* toggle use_folders on

* Rename pipelines

* its a strcpy :(

* add miniz, add xorstream, add non-working ziploader

* start integrating libzip (WIP)

* use ExternalProject test (doesnt work maybe?!)

* further work in integrating libzippp [WIP]
can't build libzip yet (neither manually nor in the vs build), as it doesn't find zlib

* LibZip build script

* make libzip build too
todo: specify cmake find_library to check the paths we install to

* prepare everything in cmake

* fix rebuilding of libzip/zlib

* fix stupid double quotes

* libzippp works

* Setup libzippp archive loading

* Remove allocation of new data when adding file to TextureServer

* Enable CI on dev

* Create LICENSE (#5)

* add mbedtls

* fix cmake (forgot to substitute, woops)

* fix %lu warnings for printing addresses

* enable debug messages, some formatting

* remove mbedtls, fix libzip for /MD(d)

* some code changes

* fix cmake logic, str replace min cmake version in libzip-src/CMakeLists.txt to 3.15

* linker errors in release

* c++ify a little

* remove unnecessary duplicate c++23 definition

* Fixes to gMod_XorStream when calculating stream length

* Fix loading tpf contents with password

* Implemented complete parsing

* Cleanup file loading

* Change to NI

* Revert "Change to NI"

This reverts commit 19b511d907.

* update XorStreamReader to read whole file, then xor

* delete a lot of unused code

* loading logic

* rename console window

* 1.5.4

* remove pointless mutex

* wtf is this code

---------

Co-authored-by: Alex Macocian <amacocian@yahoo.com>
2023-11-17 21:58:04 +01:00

43 lines
1.0 KiB
C++

#pragma once
#include <vector>
#include <string>
#include <ranges>
#include <libzippp.h>
struct TpfEntry {
std::string name;
std::string entry;
uint32_t crc_hash;
void* data;
unsigned long long size;
};
class gMod_FileLoader {
std::string file_name;
const std::string TPF_PASSWORD{
0x73, 0x2A, 0x63, 0x7D, 0x5F, 0x0A, static_cast<char>(0xA6), static_cast<char>(0xBD),
0x7D, 0x65, 0x7E, 0x67, 0x61, 0x2A, 0x7F, 0x7F,
0x74, 0x61, 0x67, 0x5B, 0x60, 0x70, 0x45, 0x74,
0x5C, 0x22, 0x74, 0x5D, 0x6E, 0x6A, 0x73, 0x41,
0x77, 0x6E, 0x46, 0x47, 0x77, 0x49, 0x0C, 0x4B,
0x46, 0x6F
};
std::vector<TpfEntry> entry_cache{};
bool loaded = false;
public:
gMod_FileLoader(const std::string& fileName);
std::vector<TpfEntry> Load();
private:
std::vector<TpfEntry> GetContents();
std::vector<TpfEntry> GetTpfContents();
std::vector<TpfEntry> GetFileContents();
void LoadEntries(libzippp::ZipArchive& archive, std::vector<TpfEntry>& entries);
};