rodecomp/Source/Utility/Lexicon/LexiconSerializer.h
ragnarok-clanker 4dca9d572a Decompile fn_17632 (LexiconBoundary::Load)
Batch #5122 by Yommy: 0 byte-identical, 1 confirmed by peer review.

- fn_17632 LexiconBoundary::Load: logic confirmed by peer review

Peer-reviewed-by: youko, Romain
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-10-30 08:30:02 +00:00

52 lines
1.4 KiB
C++

#ifndef RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONSERIALIZER_H
#define RAGNAROK_SOURCE_UTILITY_LEXICON_LEXICONSERIALIZER_H
#include <cstdint>
struct LexiconNode {
/* 0000 */ unsigned char value;
/* 0001 */ unsigned char terminal;
/* 0002 */ unsigned char unknown_0002[2];
/* 0004 */ LexiconNode* sibling;
/* 0008 */ LexiconNode* child;
};
struct LexiconHeader {
/* 0000 */ unsigned char unknown_0000[0x104];
/* 0104 */ std::uint32_t wordCount;
/* 0108 */ std::uint32_t nodeCount;
/* 010C */ std::uint32_t total;
/* 0110 */ std::uint32_t size;
/* 0114 */ unsigned char loaded;
};
struct LexiconSerializer {
// INLINED
LexiconSerializer() : root(nullptr), wordCount(0), nodeCount(0), unknown_000C(0), buffer(nullptr), header{} {
}
// INLINED
~LexiconSerializer() {
delete this->buffer;
this->Destroy(this->root);
}
/* 0000 */ LexiconNode* root;
/* 0004 */ int wordCount;
/* 0008 */ int nodeCount;
/* 000C */ std::uint32_t unknown_000C;
/* 0010 */ unsigned char* buffer;
/* 0014 */ LexiconHeader header;
bool Load(const char* path);
bool Insert(const unsigned char* word, int length);
void Destroy(LexiconNode* node);
std::uint32_t Serialize(LexiconNode* node, std::uint32_t offset, unsigned char terminal);
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(LexiconNode) == 12);
static_assert(sizeof(LexiconHeader) == 0x118);
static_assert(sizeof(LexiconSerializer) == 300);
#endif
#endif