diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.cpp b/Source/UI/AdventureGuide/UIAdventureGuide.cpp index 83831650..c8b9264e 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.cpp +++ b/Source/UI/AdventureGuide/UIAdventureGuide.cpp @@ -14,6 +14,7 @@ #include "UI/Text/UIStaticTextControl.h" #include "UI/Text/UITextViewerControl.h" #include "UI/Window/UIWindowMgr.h" +#include "Utility/Cipher/XorBytes.h" #include "Utility/Text/FormatString.h" #include @@ -538,8 +539,43 @@ void CUIAdventureGuide::OnSelectTab(AdventureGuide::CUITab* tab) { } } +namespace { + +template +class EncryptedName { +public: + explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) { + for (std::uint64_t index = 0; index < Length; ++index) { + this->m_text[index] = source[index]; + } + } + + ~EncryptedName() { + for (std::uint64_t index = 0; index < Length; ++index) { + this->m_text[index] = 0; + } + } + + const char* Text() { + if (this->m_encrypted) { + utility::XorBytes(this->m_text, Length, Key); + this->m_encrypted = false; + } + + return reinterpret_cast(this->m_text); + } + +private: + std::uint8_t m_text[Length]; + bool m_encrypted; +}; + +} + namespace AdventureGuide { +// OFFSET: 0x009C5400 + // OFFSET: 0x009DCE10 // FUNCTION: fn_14330 void CUICharacterInfo::Slot16() { diff --git a/Source/UI/AdventureGuide/UIAdventureGuide.h b/Source/UI/AdventureGuide/UIAdventureGuide.h index 6adb374d..8593a380 100644 --- a/Source/UI/AdventureGuide/UIAdventureGuide.h +++ b/Source/UI/AdventureGuide/UIAdventureGuide.h @@ -30,6 +30,7 @@ public: class CUICharacterInfo : public CUIControl { public: + void Slot15(int width, int height) override; void Slot16() override; /* 0084 */ CUIStaticText* level; diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp index d05ab85c..be821b7d 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.cpp +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.cpp @@ -5,6 +5,7 @@ #include "Resource/SkinPalette.h" #include "Resource/TextureNames.h" #include "UI/Text/UIStaticTextControl.h" +#include "Utility/Cipher/XorBytes.h" #include "Utility/Text/StringUtil.h" #include @@ -137,6 +138,41 @@ void CUIListBoxExAddChild(this->scrollBar); } +namespace { + +template +class EncryptedName { +public: + explicit EncryptedName(const std::uint8_t (&source)[Length]) : m_encrypted(true) { + for (std::uint64_t index = 0; index < Length; ++index) { + this->m_text[index] = source[index]; + } + } + + ~EncryptedName() { + for (std::uint64_t index = 0; index < Length; ++index) { + this->m_text[index] = 0; + } + } + + const char* Text() { + if (this->m_encrypted) { + utility::XorBytes(this->m_text, Length, Key); + this->m_encrypted = false; + } + + return reinterpret_cast(this->m_text); + } + +private: + std::uint8_t m_text[Length]; + bool m_encrypted; +}; + +} + +// OFFSET: 0x00A0C9C0 + // OFFSET: 0x00A0EE90 // FUNCTION: fn_15155 void CUIEquipmentPropertiesWnd::OnClickButton1() { diff --git a/Source/UI/Item/UIEquipmentPropertiesWnd.h b/Source/UI/Item/UIEquipmentPropertiesWnd.h index 6be37863..94aba854 100644 --- a/Source/UI/Item/UIEquipmentPropertiesWnd.h +++ b/Source/UI/Item/UIEquipmentPropertiesWnd.h @@ -16,6 +16,7 @@ public: /* 00F0 */ std::uint32_t evenRowColor; /* 00F4 */ std::uint32_t oddRowColor; + void Slot15(int width, int height) override; void Slot16() override; void Paint() override; void Slot53(int resolveSkin) override; diff --git a/Source/UI/SelectPackageItemBox/SelectPackageItemBox.h b/Source/UI/SelectPackageItemBox/SelectPackageItemBox.h index 8acaa5b7..3ac8f7c5 100644 --- a/Source/UI/SelectPackageItemBox/SelectPackageItemBox.h +++ b/Source/UI/SelectPackageItemBox/SelectPackageItemBox.h @@ -23,6 +23,7 @@ public: class CUIItemInfo : public CUIListItem { public: + void Slot15(int width, int height) override; void Slot16() override; void Paint() override; @@ -33,6 +34,7 @@ public: class CUITabInfo : public CUIListItem { public: + void Slot15(int width, int height) override; void Slot16() override; /* 00E8 */ CUIStaticText* nameText; diff --git a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp index 95f19fea..ee379dc5 100644 --- a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp +++ b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp @@ -372,6 +372,29 @@ private: } +// OFFSET: 0x00A69790 + +// OFFSET: 0x00A6CDE0 +// FUNCTION: fn_16665 +void SelectPackageItemBox::CUITabInfo::Slot15(int width, int height) { + this->nameText = new CUIStaticText(*this->m_context); + this->nameText->SetSize(148, 34); + this->nameText->Move(11, 0); + this->nameText->SetText("", 0); + this->nameText->SetFitText(0); + this->nameText->SetAlign(0, 6); + const std::uint8_t nameFontSource[] = {0xBA, 0xA2, 0x21, 0xC0, 0xD8, 0x8F}; + // GLOBAL: gl_25123 + thread_local EncryptedName nameFont(nameFontSource); + this->nameText->SetFont(std::string(nameFont.Text())); + this->nameText->SetFontHeight(12); + this->nameText->SetBold(0); + this->nameText->SetColor(0); + this->nameText->SetShadow(0, 0xFFFFFF); + this->nameText->SetOutline(0, 0xFFFFFF); + this->AddChild(this->nameText); +} + // OFFSET: 0x00A6FE20 // FUNCTION: fn_16783 void CUISelectPackageItemBox::BindItem(SelectPackageItemBox::CUIItemInfo* item, const ITEM_INFO& data) {