rodecomp/Source/Archive/PakFile.h
ragnarok-clanker 5393e7d6ac Decompile fn_04004 (CPakFile::~CPakFile)
Batch #4478 by youko: 0 byte-identical, 1 confirmed by peer review.

- fn_04004 CPakFile::~CPakFile: logic confirmed by peer review (annotation added to existing code)

Peer-reviewed-by: eAthena, willerthal
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-30 03:26:50 +00:00

50 lines
1.2 KiB
C++

#ifndef RAGNAROK_SOURCE_ARCHIVE_PAKFILE_H
#define RAGNAROK_SOURCE_ARCHIVE_PAKFILE_H
#include <cstdint>
#include <vector>
#include <windows.h>
// VTABLE: vt_01910
class CPakFile {
public:
virtual ~CPakFile();
virtual std::uint64_t GetSize() const = 0;
virtual std::uint8_t* Read(std::uint64_t offset, std::uint32_t length) = 0;
};
namespace myGPack {
class CReadPakFile : public CPakFile {
public:
CReadPakFile();
~CReadPakFile() override;
std::uint64_t GetSize() const override;
std::uint8_t* Read(std::uint64_t offset, std::uint32_t length) override;
void Close();
protected:
/* 0004 */ HANDLE m_handle;
/* 0008 */ std::uint64_t m_size;
/* 0010 */ std::vector<std::uint8_t> m_buffer;
};
class CWritePakFile : public CReadPakFile {
public:
~CWritePakFile() override;
bool Open(const char* filename);
bool Write(std::uint64_t offset, const void* bytes, std::uint32_t length);
};
}
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CPakFile) == 4);
static_assert(sizeof(std::vector<std::uint8_t>) == 12);
static_assert(sizeof(myGPack::CReadPakFile) == 32);
static_assert(sizeof(myGPack::CWritePakFile) == 32);
#endif
#endif