From ed982cdcf87d6535bfacc91ac3ab2b450b684467 Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Sat, 7 Nov 2026 11:29:04 +0000 Subject: [PATCH] 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). --- Source/UI/Enchant/EnchantUI.h | 1 + Source/UI/Enchant/UIEnchantUI.cpp | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Source/UI/Enchant/EnchantUI.h b/Source/UI/Enchant/EnchantUI.h index 838183554..395f59c91 100644 --- a/Source/UI/Enchant/EnchantUI.h +++ b/Source/UI/Enchant/EnchantUI.h @@ -152,6 +152,7 @@ public: __declspec(noinline) int FindEmptySlot(); __declspec(noinline) std::optional FindOption(uint32_t key); __declspec(noinline) void SetCost(const EnchantPerfectInfo& info); + void UpdateEnchantItem(CUIEnchantItem* item, const CEnchantItemData& data); }; class CUINormalRandom : public CUIEnchantPage { diff --git a/Source/UI/Enchant/UIEnchantUI.cpp b/Source/UI/Enchant/UIEnchantUI.cpp index dd1a2408f..b03c07bba 100644 --- a/Source/UI/Enchant/UIEnchantUI.cpp +++ b/Source/UI/Enchant/UIEnchantUI.cpp @@ -1340,7 +1340,9 @@ void CUINormalPerfect::Slot55() { CUIListBoxEx* list = this->enchantList; if (static_cast(list->selected) >= 0 && list->selected < list->data.size()) { auto it = list->data.begin(); - std::advance(it, static_cast(list->selected)); + for (int i = list->selected; i > 0; --i) { + ++it; + } CEnchantMgr::GetInstance()->RequestPerfectEnchant( this->group, static_cast(this->gameItem->GetItemInfo()->unknown_0000[1]), static_cast(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(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[] = {