rodecomp/Source/Archive/GPakUpdate.h
ragnarok-clanker c933c11f53 Decompile 12 functions in Source/Archive/PakFile.cpp, Source/Archive/GPakUpdate.h
Batch #1126 by eAthena: 0 byte-identical, 12 confirmed by peer review.

- fn_04009 CPakFile::~CPakFile: logic confirmed by peer review (annotation added to existing code)
- fn_04010 myGPack::CReadPakFile::~CReadPakFile: logic confirmed by peer review (annotation added to existing code)
- fn_04011 myGPack::CWritePakFile::~CWritePakFile: logic confirmed by peer review (annotation added to existing code)
- fn_04013 myGPack::CGPakUpdate::Close: logic confirmed by peer review
- fn_04014 myGPack::CGPakUpdate::RemoveObsoleteEntries: logic confirmed by peer review
- fn_04015 myGPack::CGPakUpdate::BuildFreeBlocks: logic confirmed by peer review
- fn_04016 myGPack::CGPakRead::ReadEntry: logic confirmed by peer review
- fn_04017 myGPack::CGPakRead::CollectNames: logic confirmed by peer review
- fn_04018 myGPack::CGPakUpdate::Allocate: logic confirmed by peer review
- fn_04019 myGPack::CGPakUpdate::Commit: logic confirmed by peer review
- fn_04020 myGPack::CGPakUpdate::Open: logic confirmed by peer review
- fn_04021 myGPack::CGPakUpdate::CopyEntry: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
2026-10-27 20:13:28 +00:00

70 lines
1.6 KiB
C++

#ifndef RAGNAROK_SOURCE_ARCHIVE_GPAKUPDATE_H
#define RAGNAROK_SOURCE_ARCHIVE_GPAKUPDATE_H
#include "Archive/GPak.h"
#include "Archive/PakFile.h"
#include "Archive/PakName.h"
#include <compare>
#include <cstddef>
#include <cstdint>
#include <list>
#include <set>
#include <string>
#include <vector>
namespace myGPack {
class CNotifier {
public:
virtual ~CNotifier() {
}
virtual void Notify(std::uint64_t current, std::uint64_t total) {
}
};
class CGPakRead : public CGPak {
public:
bool ReadEntry(PakEntry* entry, void* buffer);
void CollectNames(std::set<std::string>& names) const;
};
struct PakFreeBlock {
/* 0000 */ std::uint32_t size;
/* 0008 */ std::uint64_t offset;
auto operator<=>(const PakFreeBlock& other) const = default;
};
static_assert(sizeof(PakFreeBlock) == 16);
static_assert(offsetof(PakFreeBlock, offset) == 8);
class CGPakUpdate : public CGPakRead {
public:
bool Open(const char* filename);
bool Commit(CNotifier* notifier);
void Close();
protected:
bool RemoveObsoleteEntries();
void BuildFreeBlocks();
std::uint64_t Allocate(std::uint32_t size);
bool CopyEntry(const PakName& name);
/* 0148 */ std::list<CGPakRead*> m_sources;
/* 0150 */ std::set<std::string> m_names;
/* 0158 */ std::vector<PakEntry> m_added;
/* 0164 */ std::set<PakFreeBlock> m_freeBlocks;
/* 0170 */ CWritePakFile m_output;
/* 0190 */ CNotifier m_notifier;
/* 0194 */ std::vector<std::uint8_t> m_auxiliary;
};
}
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(myGPack::CGPakUpdate) == 416);
#endif
#endif