Decompile 2 functions in Source/UI/Enchant/UIEnchantUI.cpp, Source/UI/Enchant/EnchantUI.h

Batch #14583 by secret: 1 byte-identical, 1 confirmed by peer review.

- fn_14965 EnchantUI::CUINormalPerfect::Slot55: byte-identical
- fn_14977 EnchantUI::CUIEnchantPage::UpdateEnchantItem: logic confirmed by peer review

Peer-reviewed-by: secret, Toshiro, codeplay
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-11-07 11:29:04 +00:00
commit ed982cdcf8
2 changed files with 15 additions and 10 deletions

View file

@ -152,6 +152,7 @@ public:
__declspec(noinline) int FindEmptySlot();
__declspec(noinline) std::optional<EnchantOptionInfo*> FindOption(uint32_t key);
__declspec(noinline) void SetCost(const EnchantPerfectInfo& info);
void UpdateEnchantItem(CUIEnchantItem* item, const CEnchantItemData& data);
};
class CUINormalRandom : public CUIEnchantPage {

View file

@ -1340,7 +1340,9 @@ void CUINormalPerfect::Slot55() {
CUIListBoxEx<CUIEnchantItem, CEnchantItemData>* list = this->enchantList;
if (static_cast<int>(list->selected) >= 0 && list->selected < list->data.size()) {
auto it = list->data.begin();
std::advance(it, static_cast<int>(list->selected));
for (int i = list->selected; i > 0; --i) {
++it;
}
CEnchantMgr::GetInstance()->RequestPerfectEnchant(
this->group, static_cast<int16_t>(this->gameItem->GetItemInfo()->unknown_0000[1]), static_cast<int16_t>(this->unknown_00B0), it->itemId
);
@ -1473,14 +1475,16 @@ void CUIEnchantItem::SetFrozen(bool frozen) {
// OFFSET: 0x00A05860
// FUNCTION: fn_14977
void UpdateEnchantItem(CUIEnchantItem* item, const CEnchantItemData* data) {
ITEM_INFO info;
info.SetItemId(data->itemId);
info.identified = 1;
item->itemIcon->SetItem(info);
const std::string name = info.DisplayName(0);
item->name->SetText(name.c_str(), static_cast<unsigned>(name.size()));
item->SetFrozen(data->frozen);
void CUIEnchantPage::UpdateEnchantItem(CUIEnchantItem* item, const CEnchantItemData& data) {
{
ITEM_INFO info;
info.SetItemId(data.itemId);
info.identified = 1;
item->itemIcon->SetItem(info);
item->name->SetText(info.DisplayName(0));
}
item->SetFrozen(data.frozen);
}
// OFFSET: 0x00A05B90
@ -1993,7 +1997,7 @@ void CUIEnchantPage::Slot15(int width, int height) {
enchantList->SetSize(169, 377);
this->enchantList->Move(300, 0);
this->enchantList->SetOnSelect([this](CUIEnchantItem* item, const CEnchantItemData& data) { this->Slot54(item, data); });
this->enchantList->SetBinder([this](CUIEnchantItem* item, const CEnchantItemData& data) { UpdateEnchantItem(item, &data); });
this->enchantList->SetBinder([this](CUIEnchantItem* item, const CEnchantItemData& data) { this->UpdateEnchantItem(item, data); });
{
this->enchantList->SetImages(std::string([]() {
constexpr std::uint8_t bytes[] = {