From 843f495bcb146a528f9ff633a266b00a8917e53d Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Fri, 30 Oct 2026 07:44:35 +0000 Subject: [PATCH] Decompile 9 functions in Source/Contents/CashEmotionMgr.cpp, Source/Contents/CashEmotionMgr.h, ... Batch #5093 by youko: 9 byte-identical, 0 confirmed by peer review. - fn_02984 CCashEmotionMgr::Unknown59D040: byte-identical - fn_09351 UICashEmotionListChildWnd_Basic::Filter: byte-identical - fn_09353 UICashEmotionListChildWnd_Basic::Slot15: byte-identical - fn_09366 UICashEmotionListChildWnd_Purchase::Filter: byte-identical - fn_09368 UICashEmotionListChildWnd_Purchase::Slot15: byte-identical - fn_09380 UICashEmotionListChildWnd_Search::Filter: byte-identical - fn_09383 UICashEmotionListChildWnd_Search::Slot15: byte-identical - fn_09392 UICashEmotionListChildWnd_UnPurchased::Filter: byte-identical - fn_09394 UICashEmotionListChildWnd_UnPurchased::Slot15: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/Contents/CashEmotionMgr.cpp | 198 ++++++++++++++++++++-- Source/Contents/CashEmotionMgr.h | 22 +++ Source/UI/Buttons/UICashEmotionSprBtn.h | 1 + Source/UI/CashEmotion/UICashEmotionPack.h | 12 +- 4 files changed, 222 insertions(+), 11 deletions(-) diff --git a/Source/Contents/CashEmotionMgr.cpp b/Source/Contents/CashEmotionMgr.cpp index 38ae020c..561f3e8d 100644 --- a/Source/Contents/CashEmotionMgr.cpp +++ b/Source/Contents/CashEmotionMgr.cpp @@ -8,10 +8,14 @@ #include "Resource/Sprites/ActionResource.h" #include "Resource/Sprites/SpriteResource.h" #include "UI/Buttons/UISpriteButton.h" +#include "Client/Mode/ModeMgr.h" +#include "Contents/SimpleStringMgr.h" +#include "Network/TextEncoding.h" #include "Resource/Bitmap/BitmapResource.h" #include "Resource/ResourceMgr.h" #include "Resource/SkinPalette.h" #include "Resource/TextureNames.h" +#include "Script/LuaScript.h" #include "UI/Buttons/UIBitmapButton.h" #include "UI/Buttons/UICashEmotionSprBtn.h" #include "UI/CashEmotion/UICashEmotionPack.h" @@ -21,16 +25,28 @@ #include "Contents/MessageTable.h" #include "UI/Buttons/UIButton.h" #include "UI/Lists/UIScrollBar.h" +#include "UI/Text/UIStaticText.h" #include "UI/UILapineScrollBar.h" +#include "UI/Window/InputFocus.h" #include "UI/Window/UIFrameWnd.h" +#include "UI/Window/UIWindowMgr.h" #include "UI/Window/WindowBorder.h" #include "Utility/Text/FormatString.h" +extern "C" { +#include +#include +} + #include #include +#include #include +#include #include #include +#include +#include #include #include #include @@ -52,12 +68,26 @@ public: bool ExecuteNamed(const char* name); }; +class CCashEmotionAction_Play : public ICashEmotionAction { +public: + CCashEmotionAction_Play(); + ~CCashEmotionAction_Play() override; + bool Execute(int packId, int emotionId) override; + +protected: + /* 0004 */ int m_diceEmotion; + /* 0008 */ int m_yutEmotion; +}; + class UICashEmotionPack_Purchase : public UICashEmotionPack { public: ~UICashEmotionPack_Purchase() override; void Paint() override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; + void UpdateExpiry(Timestamp* expiry) override; + void ShowExpiry(__time32_t expiry) override; + protected: /* 00E0 */ ICashEmotionAction* m_selectAction; /* 00E4 */ ICashEmotionAction* m_purchaseAction; @@ -112,18 +142,26 @@ protected: class UICashEmotionScrollWnd : public UIScrollWnd { public: + UICashEmotionScrollWnd(UIWindowContext& windows, int width, int height, unsigned char cached); void Slot15(int width, int height) override; + virtual void Slot53() = 0; + + void AddChild(UIWindow* child); }; class UICashEmotionListChildWnd_Abstract : public UICashEmotionScrollWnd { public: void Slot35(int delta) override; + virtual void Refresh(const char* filter) = 0; + virtual const char* Filter() = 0; }; class UICashEmotionListChildWnd_Basic : public UICashEmotionListChildWnd_Abstract { public: + void Slot15(int width, int height) override; void Slot19() override; void Paint() override; + const char* Filter() override; protected: /* 00B0 */ std::vector m_items; @@ -133,17 +171,38 @@ protected: class UICashEmotionListChildWnd_Purchase : public UICashEmotionListChildWnd_Abstract { public: + void Slot15(int width, int height) override; void Paint() override; + const char* Filter() override; + + void UpdateExpiry(int packId, Timestamp* expiry); + +protected: + /* 00B0 */ std::vector m_items; + /* 00BC */ ICashEmotionAction* unknown_00BC; + /* 00C0 */ std::string m_filter; }; class UICashEmotionListChildWnd_Search : public UICashEmotionListChildWnd_Abstract { public: + void Slot15(int width, int height) override; void Paint() override; + const char* Filter() override; + +protected: + /* 00B0 */ std::uint8_t unknown_00B0[0x10]; + /* 00C0 */ std::string m_filter; }; class UICashEmotionListChildWnd_UnPurchased : public UICashEmotionListChildWnd_Abstract { public: + void Slot15(int width, int height) override; void Paint() override; + const char* Filter() override; + +protected: + /* 00B0 */ std::vector m_items; + /* 00BC */ std::string m_filter; }; struct CashEmotionListPlacement { @@ -161,22 +220,30 @@ public: void Paint() override; UIBitmapButton* CreateButton(int x, int y, int width, int height, int id, const char* format, bool hasDisabled); + void RefreshCurrentList(); + void ShowPack(int packId); + void sub_7C7E50(); + void ResetLists(); + int SetPeriod(int packId); + void SetTab(char tab); + void UpdateExpiry(int packId, Timestamp* expiry); + void RefreshSelection(); protected: /* 00B4 */ CashEmotionListPlacement* m_placement; - /* 00B8 */ UICashEmotionListChildWnd_Abstract* m_basicList; - /* 00BC */ UICashEmotionListChildWnd_Abstract* m_purchaseList; - /* 00C0 */ UICashEmotionListChildWnd_Abstract* m_searchList; - /* 00C4 */ UICashEmotionListChildWnd_Abstract* m_unpurchasedList; + /* 00B8 */ UICashEmotionListChildWnd_Basic* m_basicList; + /* 00BC */ UICashEmotionListChildWnd_Purchase* m_purchaseList; + /* 00C0 */ UICashEmotionListChildWnd_Search* m_searchList; + /* 00C4 */ UICashEmotionListChildWnd_UnPurchased* m_unpurchasedList; /* 00C8 */ std::map m_tabs; /* 00D0 */ char m_tab; - /* 00D4 */ UIWindow* unknown_00D4; + /* 00D4 */ UIBitmapButton* unknown_00D4; /* 00D8 */ UIEditCtrl* m_searchEdit; - /* 00DC */ UIWindow* unknown_00DC; - /* 00E0 */ UIWindow* unknown_00E0; - /* 00E4 */ UIWindow* unknown_00E4; + /* 00DC */ UIBitmapButton* unknown_00DC; + /* 00E0 */ UIBitmapButton* unknown_00E0; + /* 00E4 */ UIBitmapButton* unknown_00E4; /* 00E8 */ UICashEmotionListChildWnd_Abstract* m_currentList; - /* 00EC */ UIWindow* unknown_00EC; + /* 00EC */ UIStaticText* m_period; UIButtonContext* m_controls; }; @@ -205,6 +272,10 @@ protected: UICashEmotionPieceContext* m_controls; }; +// OFFSET: 0x00591CA0 + +// OFFSET: 0x00591D30 + // OFFSET: 0x00591D80 // FUNCTION: fn_02841 ICashEmotionAction::~ICashEmotionAction() { @@ -220,6 +291,8 @@ bool ICashEmotionAction::ExecuteNamed(const char* name) { return this->Execute(g_cashEmotionMgr->BasePackId(), g_cashEmotionMgr->FindEmotionId(name)); } +// OFFSET: 0x00591EB0 + // OFFSET: 0x00592290 // FUNCTION: fn_02849 CashEmotionCommand::CashEmotionCommand(const std::string& name, int packId, int emotionId) : name(name) { @@ -841,6 +914,12 @@ bool CCashEmotionMgr::IsOwnedPack(int packId) { return std::find(this->m_ownedPacks.begin(), this->m_ownedPacks.end(), packId) != this->m_ownedPacks.end(); } +// OFFSET: 0x0059C5A0 + +// OFFSET: 0x0059C730 + +// OFFSET: 0x0059C860 + // OFFSET: 0x0059CDE0 // FUNCTION: fn_02981 void CCashEmotionMgr::sub_59CDE0(int param) { @@ -870,12 +949,29 @@ void CCashEmotionMgr::SetServerTimeZone(short serverBias) { } } +// OFFSET: 0x0059CEC0 + +// OFFSET: 0x0059D040 +// FUNCTION: fn_02984 +void CCashEmotionMgr::Unknown59D040(int, int) { +} + +// OFFSET: 0x0059D2C0 + // OFFSET: 0x0059FC50 // FUNCTION: fn_03031 int CCashEmotionMgr::sub_59FC50() { return _time32(nullptr) - this->unknown_01D0 - this->unknown_01CC; } +// OFFSET: 0x0059FDC0 + +// OFFSET: 0x005A0290 + +// OFFSET: 0x005A07F0 + +// OFFSET: 0x005A0CE0 + // OFFSET: 0x007C3AD0 // FUNCTION: fn_09344 void UICashEmotionListChildWnd_Abstract::Slot35(int delta) { @@ -888,6 +984,18 @@ void UICashEmotionListChildWnd_Abstract::Slot35(int delta) { } } +// OFFSET: 0x007C4100 +// FUNCTION: fn_09351 +const char* UICashEmotionListChildWnd_Basic::Filter() { + return nullptr; +} + +// OFFSET: 0x007C4440 +// FUNCTION: fn_09353 +void UICashEmotionListChildWnd_Basic::Slot15(int, int) { + this->Refresh(nullptr); +} + // OFFSET: 0x007C4450 // FUNCTION: fn_09354 void UICashEmotionListChildWnd_Basic::Paint() { @@ -904,18 +1012,56 @@ void UICashEmotionListChildWnd_Basic::Slot19() { } } +// OFFSET: 0x007C4D10 +// FUNCTION: fn_09366 +const char* UICashEmotionListChildWnd_Purchase::Filter() { + return this->m_filter.c_str(); +} + +// OFFSET: 0x007C5290 +// FUNCTION: fn_09368 +void UICashEmotionListChildWnd_Purchase::Slot15(int, int) { + this->Refresh(nullptr); +} + // OFFSET: 0x007C52A0 // FUNCTION: fn_09369 void UICashEmotionListChildWnd_Purchase::Paint() { this->ClearSurface(0xFFFF00FF); } +// OFFSET: 0x007C52F0 + +// OFFSET: 0x007C5980 +// FUNCTION: fn_09380 +const char* UICashEmotionListChildWnd_Search::Filter() { + return this->m_filter.c_str(); +} + +// OFFSET: 0x007C5D80 +// FUNCTION: fn_09383 +void UICashEmotionListChildWnd_Search::Slot15(int, int) { + this->Refresh(nullptr); +} + // OFFSET: 0x007C5D90 // FUNCTION: fn_09384 void UICashEmotionListChildWnd_Search::Paint() { this->ClearSurface(0xFFFF00FF); } +// OFFSET: 0x007C6520 +// FUNCTION: fn_09392 +const char* UICashEmotionListChildWnd_UnPurchased::Filter() { + return this->m_filter.c_str(); +} + +// OFFSET: 0x007C6AA0 +// FUNCTION: fn_09394 +void UICashEmotionListChildWnd_UnPurchased::Slot15(int, int) { + this->Refresh(nullptr); +} + // OFFSET: 0x007C6AB0 // FUNCTION: fn_09395 void UICashEmotionListChildWnd_UnPurchased::Paint() { @@ -927,7 +1073,7 @@ void UICashEmotionListChildWnd_UnPurchased::Paint() { UICashEmotionListWnd::UICashEmotionListWnd(UIWindowContext& windows, UIFrameContext& frame, UIButtonContext& controls) : UIFrameWnd(windows, frame, 0), m_placement(nullptr), m_basicList(nullptr), m_purchaseList(nullptr), m_searchList(nullptr), m_unpurchasedList(nullptr), m_tab(0), unknown_00D4(nullptr), m_searchEdit(nullptr), unknown_00DC(nullptr), unknown_00E0(nullptr), unknown_00E4(nullptr), m_currentList(nullptr), - unknown_00EC(nullptr), m_controls(&controls) { + m_period(nullptr), m_controls(&controls) { } // OFFSET: 0x007C7240 @@ -973,6 +1119,18 @@ void UICashEmotionListWnd::Slot19() { } } +// OFFSET: 0x007C7CD0 + +// OFFSET: 0x007C7D10 + +// OFFSET: 0x007C7E50 + +// OFFSET: 0x007C7F00 + +// OFFSET: 0x007C7F60 + +// OFFSET: 0x007C8800 + // OFFSET: 0x007C8AF0 // FUNCTION: fn_09420 void UICashEmotionListWnd::Slot11() { @@ -984,6 +1142,10 @@ void UICashEmotionListWnd::Slot11() { } } +// OFFSET: 0x007C8B30 + +// OFFSET: 0x007C8B50 + // OFFSET: 0x007C90B0 // FUNCTION: fn_09427 UICashEmotionMiniWnd::~UICashEmotionMiniWnd() { @@ -1229,6 +1391,12 @@ UICashEmotionPack::~UICashEmotionPack() { this->m_pieces.clear(); } +// OFFSET: 0x007C9EB0 + +// OFFSET: 0x007C9FE0 + +// OFFSET: 0x007CA100 + // OFFSET: 0x007CA690 // FUNCTION: fn_09446 void UICashEmotionPack::Paint() { @@ -1347,6 +1515,10 @@ UICashEmotionPack_Purchase::~UICashEmotionPack_Purchase() { this->m_purchaseAction = nullptr; } +// OFFSET: 0x007CACE0 + +// OFFSET: 0x007CAE70 + // OFFSET: 0x007CAEB0 // FUNCTION: fn_09462 void UICashEmotionPack_Purchase::Paint() { @@ -1704,6 +1876,10 @@ void UICashEmotionScrollBar::SetDisabled(bool disabled) { } } +// OFFSET: 0x007CC2B0 + +// OFFSET: 0x007CC440 + // OFFSET: 0x007CC5D0 // FUNCTION: fn_09496 void UICashEmotionScrollWnd::Slot15(int, int) { @@ -1729,6 +1905,8 @@ void UICashEmotionSprBtn::SetSelected(bool selected) { } } +// OFFSET: 0x007CCD90 + // OFFSET: 0x008502C0 // FUNCTION: fn_10674 UISpriteButton2::UISpriteButton2(UIWindowContext& windowContext, UIButtonContext& buttonContext, UIWindow* target) diff --git a/Source/Contents/CashEmotionMgr.h b/Source/Contents/CashEmotionMgr.h index 4e609a37..f1dbac58 100644 --- a/Source/Contents/CashEmotionMgr.h +++ b/Source/Contents/CashEmotionMgr.h @@ -13,6 +13,7 @@ class CCashEmotionMgr; class ICashEmotionAction; +struct lua_State; struct CashEmotionKeyHash { // INLINED @@ -49,6 +50,12 @@ struct CashEmotionData { }; struct CashEmotionPack { + // INLINED + CashEmotionPack(const char* name, int unknown18, unsigned int startTime, unsigned int endTime, int unknown24, char unknown28) + : name(name), unknown_0018(unknown18), startTime(startTime), endTime(endTime), unknown_0024(unknown24), unknown_0028(unknown28), + originalStartTime(startTime), originalEndTime(endTime) { + } + // INLINED bool IsAvailable(unsigned int now) const { if (this->startTime == 0 && this->endTime == 0) { @@ -88,6 +95,11 @@ struct CashEmotionSpecialHash { } }; +struct CashEmotionPackRefresh { + /* 0000 */ bool changed; + /* 0004 */ int nextTime; +}; + using CashEmotionTable = std::unordered_map; using CashEmotionFileNames = std::unordered_map; @@ -99,12 +111,18 @@ struct CashEmotionPackOrder { }; class CCashEmotionMgr { + friend class UICashEmotionListWnd; + public: CCashEmotionMgr(); virtual ~CCashEmotionMgr(); static bool Initialize(); static void Shutdown(); + static int InsertEmotionGroup(lua_State* state); + static int InsertEmotionMsgListTable(lua_State* state); + static int InsertEmotionMsgListTableForCustom(lua_State* state); + static int InsertPackInfo(lua_State* state); void Reset(); void ClearOwnedPacks(); @@ -144,10 +162,14 @@ public: bool IsChatProhibitEmotion(int emotionId); bool IsPackAvailable(unsigned int now, int packId); bool IsOwnedPack(int packId); + void RemoveOwnedPack(int packId, bool refresh, bool clearExpiry); + CashEmotionPackRefresh RefreshUnownedPacks(); void sub_59CDE0(int param); void SetServerTimeZone(short serverBias); bool sub_59C5A0(); bool sub_59D2C0(); + void ShowErrorMessage(const char* key, int value); + void Unknown59D040(int argument1, int argument2); int sub_59FC50(); // INLINED int BasePackId() const { diff --git a/Source/UI/Buttons/UICashEmotionSprBtn.h b/Source/UI/Buttons/UICashEmotionSprBtn.h index 52f5a9f0..4676e5c7 100644 --- a/Source/UI/Buttons/UICashEmotionSprBtn.h +++ b/Source/UI/Buttons/UICashEmotionSprBtn.h @@ -8,6 +8,7 @@ class UICashEmotionSprBtn : public UISpriteButton2 { public: UICashEmotionSprBtn(UIWindowContext& windowContext, UIButtonContext& buttonContext, UIWindow* target); + void Slot28(int x, int y) override; void SetSelected(bool selected); diff --git a/Source/UI/CashEmotion/UICashEmotionPack.h b/Source/UI/CashEmotion/UICashEmotionPack.h index dd594f1b..35654ece 100644 --- a/Source/UI/CashEmotion/UICashEmotionPack.h +++ b/Source/UI/CashEmotion/UICashEmotionPack.h @@ -5,10 +5,16 @@ #include "UI/Window/UIWindow.h" #include +#include #include #include +class Timestamp; +class UIStaticText; + class UICashEmotionPack : public UIWindow { + friend class UICashEmotionListChildWnd_Purchase; + public: ~UICashEmotionPack() override; void Slot19() override; @@ -18,14 +24,18 @@ public: void Slot27(int x, int y) override; void Slot35(int argument) override; int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override; + virtual int Slot53(int packId, bool showTooltip, bool hoverable) = 0; + virtual void UpdateExpiry(Timestamp* expiry); + virtual void ShowExpiry(__time32_t expiry); + std::string GetPriceText(int packId); void SetSaleBadge(char type); void SetTitle(const char* title); protected: /* 007C */ std::vector m_pieces; /* 0088 */ UIWindow* unknown_0088; - /* 008C */ UIWindow* m_titleText; + /* 008C */ UIStaticText* m_titleText; /* 0090 */ std::string m_background; /* 00A8 */ int unknown_00A8; /* 00AC */ std::string m_title;