rodecomp/Source/Resource/EmblemResource.cpp
ragnarok-clanker 21655ccd0f Decompile 2 functions in Source/Resource/Resource.h, Source/Resource/Resource.cpp, ...
Batch #14854 by secret: 2 byte-identical, 0 confirmed by peer review.

- fn_18185 CRes::MissingFile: byte-identical
- fn_07885 CEmblemRes::MissingFile: byte-identical

Merged automatically: every function is byte-identical to the original.
2026-11-07 19:25:27 +00:00

81 lines
1.7 KiB
C++

#include "Resource/EmblemResource.h"
#include "Contents/GuildMgr.h"
#include "File/File.h"
#include "Resource/ResourceMgr.h"
#include <cstdint>
#include <cstdlib>
#include <string>
#include <zlib.h>
// INLINED
CEmblemRes::~CEmblemRes() = default;
// OFFSET: 0x0074C9F0
// FUNCTION: fn_07880
CEmblemRes* CEmblemRes::Create() {
return new CEmblemRes;
}
// OFFSET: 0x0074CA90
// FUNCTION: fn_07881
bool CEmblemRes::Load(const char* name) {
if (g_guildMgr->IsInvalidEmblem(name) == true) {
this->gif.CreateBlank(24, 24);
return true;
}
CFile file;
if (!file.Open(name, 0, true, false)) {
return false;
}
uLongf size = static_cast<uLongf>(static_cast<std::uint32_t>(g_guildMgr->m_timeout) * 1.2);
Bytef* buffer = new Bytef[size];
if (uncompress(buffer, &size, static_cast<const Bytef*>(file.GetData()), file.GetSize()) != Z_OK
|| this->gif.Decode("_emblem.bmp", buffer, size, true) != true) {
g_guildMgr->MarkInvalidEmblem(name);
this->gif.CreateBlank(24, 24);
}
file.Close();
delete[] buffer;
return true;
}
// OFFSET: 0x0074CD00
// FUNCTION: fn_07882
void CEmblemRes::Unload() {
this->gif.Unload();
}
// OFFSET: 0x0074CD10
// FUNCTION: fn_07883
void CEmblemRes::Slot02() {
this->gif.Slot02();
}
// OFFSET: 0x0074CD20
// FUNCTION: fn_07884
bool CEmblemRes::IsTransient() {
return this->gif.IsTransient();
}
// OFFSET: 0x0074CD40
// FUNCTION: fn_07885
void CEmblemRes::MissingFile(const char*) {
}
// OFFSET: 0x0074CDC0
// FUNCTION: fn_07887
CEmblemRes::CEmblemRes() : CRes(), gif() {
}
// INLINED
CEmblemRes::CEmblemRes(const char* extension, const char* prefix) {
ResourceMgr::Instance().Register(extension, prefix, this);
}
// GLOBAL: gl_25554
CEmblemRes g_ebmPrototype("ebm", "..\\_tmpEmblem\\");