Decompile fn_12344 (UIExchangeWnd::SendMsg)

Batch #10160 by KWDev: 0 byte-identical, 1 confirmed by peer review.

- fn_12344 UIExchangeWnd::SendMsg: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, gordaoprogramas, cremane
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-02 18:13:08 +00:00
commit d3e2a4eadc
3 changed files with 215 additions and 9 deletions

View file

@ -139,6 +139,7 @@
#include "Contents/NavigationManager.h"
#include "UI/Text/NavigationLink.h"
#include "Utility/Text/GroupedInteger.h"
#include "Utility/Math/Int64Math.h"
#include "Client/Mode/ModeTooltip.h"
#include "Script/LuaScript.h"
#include "Utility/Text/StringUtil.h"
@ -4023,6 +4024,8 @@ void UISkillNameChangeWnd::Slot15(int, int) {
this->m_message0 = 184;
}
// OFFSET: 0x008E9C90
// OFFSET: 0x008EA780
// FUNCTION: fn_12205
void UIToolTipWnd::Slot15(int width, int height) {
@ -5000,6 +5003,199 @@ int UISayDialogWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std:
}
}
// OFFSET: 0x008FAF50
// FUNCTION: fn_12344
int UIExchangeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
switch (message) {
case 6: {
CMode* mode = g_modeMgr.GetGameMode();
switch (a) {
case 184:
if (this->unknown_00D4 != 0) {
return 0;
}
if (this->unknown_00C0) {
char text[24];
std::sprintf(text, "%s ", this->unknown_00C0->Text());
if (!g_session.IsNumberWithCommas(text)) {
reinterpret_cast<WindowDialogs&>(g_windowMgr).Confirm(LookupMessage(602), 0, true, false, 0, "Message", 280, 120, 0);
return 0;
}
std::int64_t money = _atoi64(text);
if (money > 0x7FFFFFFF) {
money = 0x7FFFFFFF;
}
int amount = static_cast<int>(MaxInt64(money, 0));
if (amount < 0) {
amount = 0;
}
if (amount > g_session.m_zeny) {
amount = g_session.m_zeny;
}
mode->SendMsg(51, 0, g_session.unknown_5210 + amount, 0, 0);
this->CancelInput();
}
mode->SendMsg(52, 0, 0, 0, 0);
this->unknown_00D4 = 1;
return 0;
case 185:
if (this->unknown_00DC != 0) {
return 0;
}
mode->SendMsg(53, 0, 0, 0, 0);
this->unknown_00DC = 1;
return 0;
case 213:
this->unknown_011C = b != 0;
return 0;
case 226: {
if (!this->unknown_00C0) {
return 0;
}
int amount = std::atoi(this->unknown_00C0->Text());
if (amount < 0) {
amount = 0;
}
if (amount > g_session.m_zeny) {
amount = g_session.m_zeny;
}
mode->SendMsg(51, 0, g_session.unknown_5210 + amount, 0, 0);
this->CancelInput();
return 0;
}
case 230:
if (this->unknown_00D8 != 0) {
return 0;
}
if (this->unknown_011C) {
const std::string text = FormatOwnedString(LookupMessage(1832), this->unknown_00F0.c_str());
g_modeMgr.gameMode->SendMsg(68, reinterpret_cast<int>(text.c_str()), 0, 0, 0);
}
mode->SendMsg(54, 0, 0, 0, 0);
this->unknown_00D8 = 1;
this->LayoutButtons();
return 0;
}
return 0;
}
case 7:
return 0;
case 23:
this->m_myItems.erase(this->m_myItems.begin(), this->m_myItems.end());
this->m_otherItems.erase(this->m_otherItems.begin(), this->m_otherItems.end());
for (int index = 0; index < 10; ++index) {
ITEM_INFO item = g_session.GetExchangeItem(index);
if (item.quantity != 0) {
this->m_myItems.push_back(item);
}
ITEM_INFO slot = g_session.GetItemSlot(index);
if (slot.quantity != 0) {
this->m_otherItems.push_back(slot);
}
}
this->Invalidate();
return 0;
case 38: {
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
mode->SendMsg(51, mode->drag.id, mode->drag.quantity, 0, 0);
mode->SendMsg(18, 0, 0, 0, 0);
return 0;
}
case 50:
this->unknown_00F0 = reinterpret_cast<const char*>(a);
this->unknown_0108 = static_cast<int>(b);
this->unknown_010C = static_cast<short>(c);
return 0;
case 51:
this->unknown_00CC = 1;
this->CancelInput();
this->LayoutButtons();
return 0;
case 52:
this->unknown_00D0 = 1;
this->CancelInput();
this->LayoutButtons();
return 0;
case 123: {
const unsigned char* records = reinterpret_cast<const unsigned char*>(a);
FramedMessageHeader header{};
std::memcpy(&header, records, sizeof(header));
if (header.type == 20600) {
unsigned int position = sizeof(header);
int number = 0;
short level = 0;
while (position < static_cast<unsigned int>(b)) {
std::memcpy(&header, records + position, sizeof(header));
position += sizeof(header);
switch (header.type) {
case 20601:
this->SendMsg(nullptr, 23, 0, 0, 0, 0);
return 0;
case 20602: {
char name[260];
std::memset(name, 0, sizeof(name));
std::memcpy(name, records + position, header.length);
position += header.length;
this->SendMsg(nullptr, 50, reinterpret_cast<std::intptr_t>(name), number, level, 0);
break;
}
case 20603:
std::memcpy(&number, records + position, header.length);
position += header.length;
break;
case 20604:
std::memcpy(&level, records + position, header.length);
position += header.length;
break;
case 20605:
std::memcpy(&this->unknown_00CC, records + position, header.length);
position += header.length;
if (this->unknown_00CC != 0) {
this->SendMsg(nullptr, 51, 0, 0, 0, 0);
}
break;
case 20606:
std::memcpy(&this->unknown_00D0, records + position, header.length);
position += header.length;
if (this->unknown_00D0 != 0) {
this->SendMsg(nullptr, 52, 0, 0, 0, 0);
}
break;
case 20607:
std::memcpy(&this->unknown_00D4, records + position, header.length);
position += header.length;
if (this->unknown_00D4 != 0) {
this->SendMsg(nullptr, 6, 184, 0, 0, 0);
}
break;
case 20608:
std::memcpy(&this->unknown_00D8, records + position, header.length);
position += header.length;
if (this->unknown_00D8 != 0) {
this->SendMsg(nullptr, 6, 230, 0, 0, 0);
}
break;
case 20609:
std::memcpy(&this->unknown_00DC, records + position, header.length);
position += header.length;
if (this->unknown_00DC != 0) {
this->SendMsg(nullptr, 6, 185, 0, 0, 0);
}
break;
default:
position += header.length;
break;
}
}
}
return 0;
}
default:
return UIFrameWnd::SendMsg(sender, message, a, b, c, d);
}
}
// OFFSET: 0x008FB850
// FUNCTION: fn_12345
int UIGraffiStrboxWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
@ -6588,6 +6784,8 @@ void UIPartyInvitationToWnd::Slot15(int, int) {
focus.Set(this->m_edit);
}
// OFFSET: 0x008E60A0
// OFFSET: 0x008F95F0
// FUNCTION: fn_12339
int UICoupleAcceptWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {

View file

@ -11,7 +11,9 @@ class UIStaticText;
class UIEditCtrl;
class UIListBoxID;
class UITagTextViewer;
class UIButton;
class UIBitmapButton;
struct UIButtonContext;
struct UIEditContext;
struct TipBoxAnimation {
/* 0000 */ std::uint32_t moveStart;
@ -46,6 +48,7 @@ public:
void Search(std::string& keyword);
void RefreshTip();
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
void Slot15(int width, int height) override;
void Slot19() override;
void Paint() override;
@ -56,15 +59,19 @@ public:
/* 00C4 */ UIStaticText* unknown_00C4;
/* 00C8 */ UIStaticText* m_pageText;
/* 00CC */ UIStaticText* m_pageTotalText;
/* 00D0 */ UIButton* unknown_00D0;
/* 00D4 */ UIButton* unknown_00D4;
/* 00D8 */ UIButton* unknown_00D8;
/* 00D0 */ UIBitmapButton* unknown_00D0;
/* 00D4 */ UIBitmapButton* unknown_00D4;
/* 00D8 */ UIBitmapButton* unknown_00D8;
/* 00DC */ std::vector<TipBoxAnimation> m_animations;
/* 00E8 */ std::vector<TipBoxDot> m_dots;
/* 00F4 */ std::uint32_t m_buildTime;
/* 00F8 */ std::uint32_t m_frameTime;
/* 00FC */ bool unknown_00FC;
/* 0100 */ int unknown_0100;
protected:
UIButtonContext* m_controls;
UIEditContext* m_editContext;
};
#if defined(_WIN32) && !defined(_WIN64)

View file

@ -30,6 +30,12 @@ public:
protected:
UIButtonContext* m_controls;
public:
/* 00E0 */ UIEditCtrl* m_edit;
protected:
UIEditContext* m_editContext;
};
class UIPartyInvitationToWnd : public UIPartySettingWnd {
@ -39,11 +45,6 @@ public:
int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override;
void Slot15(int width, int height) override;
/* 00E0 */ UIEditCtrl* m_edit;
protected:
UIEditContext* m_editContext;
};
#endif