rodecomp/Source/File/File.h
ragnarok-clanker aa8d6d2427 Decompile 8 functions in Source/Resource/GifResource.cpp, Source/Resource/GifResource.h, ...
Batch #1132 by eAthena: 0 byte-identical, 8 confirmed by peer review.

- fn_07852 CGifRes::Create: logic confirmed by peer review
- fn_07853 CGifRes::Load: logic confirmed by peer review
- fn_07854 CGifRes::Decode: logic confirmed by peer review
- fn_07855 CGifRes::Unload: logic confirmed by peer review
- fn_07856 CGifRes::Slot02: logic confirmed by peer review
- fn_07857 CGifRes::IsTransient: logic confirmed by peer review
- fn_07865 CGifRes::CreateBlank: logic confirmed by peer review
- fn_07870 CGifRes::DecodeGif: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker
Reviewed-by: ragnarok-clanker
Adds to the build: Source/Resource/GifResource.cpp
2026-10-27 21:05:50 +00:00

58 lines
1.4 KiB
C++

#ifndef RAGNAROK_SOURCE_FILE_FILE_H
#define RAGNAROK_SOURCE_FILE_FILE_H
#include <cstdint>
#include <string>
#include <windows.h>
class CRenderSystemBase;
class CFile {
public:
CFile();
virtual ~CFile();
bool OpenWrite(const char* path, CRenderSystemBase* renderSystem);
bool Open(const char* path, int mode, bool resourcePath, bool option);
// INLINED
bool Open(const char* path) {
this->m_path = path;
this->m_handle = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
if (this->m_handle == INVALID_HANDLE_VALUE) {
return false;
}
LARGE_INTEGER size;
GetFileSizeEx(this->m_handle, &size);
this->m_size = size.LowPart;
return true;
}
// INLINED
std::uint32_t GetSize() const {
return this->m_size;
}
// INLINED
void* GetData() const {
return this->m_data;
}
bool Write(const void* data, std::uint32_t bytes);
bool Read(void* data, std::uint32_t bytes);
bool Peek(void* data, std::uint32_t bytes);
bool Seek(std::uint32_t distance, DWORD origin);
void* ReadPtr(std::uint32_t bytes);
bool IsEOF() const;
void Close();
protected:
/* 0004 */ HANDLE m_handle;
/* 0008 */ void* m_data;
/* 000C */ std::uint32_t m_position;
/* 0010 */ std::uint32_t m_size;
/* 0014 */ std::string m_path;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CFile) == 44);
#endif
#endif