Decompile 2 functions in Source/UI/UIMacroDetectorWnd.cpp, Source/UI/UIMacroDetectorWnd.h, ...

Batch #5375 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review.

- fn_09820 UICaptchaPreviewWnd::SendMsg: logic confirmed by peer review
- fn_09821 UIMacroDetectorWnd::SendMsg: logic confirmed by peer review

Peer-reviewed-by: bigodeira, willerthal
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-10-30 11:49:16 +00:00
commit ace9830686
4 changed files with 61 additions and 1 deletions

View file

@ -37,6 +37,8 @@ struct UIEditContext {
};
class UIEditCtrl : public UIWindow {
friend class UIMacroDetectorWnd;
public:
UIEditCtrl();
UIEditCtrl(UIWindowContext& windows, UIEditContext& edit);

View file

@ -8,6 +8,7 @@ class UICaptchaImage;
class UICaptchaPreviewWnd : public UIFrameWnd {
public:
void Paint() override;
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
void AddImageData(const void* data, int size);
void ClearImageData();

View file

@ -1,5 +1,11 @@
#include "UI/UIMacroDetectorWnd.h"
#include "Client/Input/Language.h"
#include "Contents/MessageTable.h"
#include "Network/Connection/Connection.h"
#include "Network/Packets/PacketLengths.h"
#include "UI/Edit/UIEditCtrl.h"
#include "UI/UICaptchaPreviewWnd.h"
#include "UI/Window/WindowManagerWindows.h"
#include "Utility/Text/FormatString.h"
#include <cstdlib>
@ -7,6 +13,14 @@
#include <windows.h>
#include <timeapi.h>
namespace {
struct CaptchaAnswerPacket {
/* 0000 */ std::int16_t id;
/* 0002 */ char text[16];
};
static_assert(sizeof(CaptchaAnswerPacket) == 18);
}
// OFFSET: 0x007EDC00
// FUNCTION: fn_09814
void UIMacroDetectorWnd::Slot25(int, int) {
@ -74,3 +88,33 @@ void UIMacroDetectorWnd::InitImageData(unsigned short size) {
this->m_imageData = static_cast<unsigned char*>(std::malloc(size));
std::memset(this->m_imageData, 0, size);
}
// OFFSET: 0x007EDCF0
// FUNCTION: fn_09820
int UICaptchaPreviewWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
if (message == 6 && a == 201) {
this->m_frameContext->windows.CloseWindow(288);
}
return UIWindow::SendMsg(sender, message, a, b, c, d);
}
// OFFSET: 0x007EDD40
// FUNCTION: fn_09821
int UIMacroDetectorWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) {
if (message == 0) {
this->SendMsg(this, 6, 345, 0, 0, 0);
} else if (message == 6) {
if (a == 201) {
this->m_frameContext->windows.CloseWindow(284);
} else if (a == 345 && this->m_editCtrl->Length() != 0 && this->m_lastAnswer != this->m_editCtrl->Text()) {
CaptchaAnswerPacket packet;
packet.id = 0xA5C;
memcpy_s(packet.text, sizeof(packet.text), this->m_editCtrl->Text(), sizeof(packet.text));
CRagConnection& connection = GetRagConnection();
connection.Send(g_packetLengths.FixedLength(packet.id), &packet);
this->m_lastAnswer = this->m_editCtrl->Text();
this->m_editCtrl->m_edit->input.ResetInput();
}
}
return UIWindow::SendMsg(sender, message, a, b, c, d);
}

View file

@ -6,6 +6,8 @@
#include <cstdint>
#include <string>
class UIEditCtrl;
class UIMacroDetectorWnd : public UIFrameWnd {
public:
void Slot19() override;
@ -13,6 +15,7 @@ public:
void Slot25(int x, int y) override;
void Slot27(int x, int y) override;
void Slot31(int x, int y) override;
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
void sub_8D2CE0(bool closeButton, const char* title, int width);
void sub_A84360(int x, int y, const char* text, int bytes, int family, int height, std::uint32_t color, unsigned char bold, unsigned char italic);
@ -31,10 +34,20 @@ public:
/* 00D4 */ std::uint32_t totalDuration;
/* 00D8 */ std::uint32_t startTick;
/* 00DC */ std::uint32_t messageDuration;
/* 00E0 */ unsigned char unknown_00E0[0x18];
/* 00E0 */ std::string m_lastAnswer;
/* 00F8 */ std::string message;
/* 0110 */ std::uint32_t unknown_0110;
/* 0114 */ std::uint32_t messageTick;
/* 00B8 */ UIEditCtrl* m_editCtrl;
};
#if defined(_WIN32) && !defined(_WIN64)
static_assert(offsetof(UIMacroDetectorWnd, m_captchaKey) == 0xC0);
static_assert(offsetof(UIMacroDetectorWnd, m_imageData) == 0xC4);
static_assert(offsetof(UIMacroDetectorWnd, m_lastAnswer) == 0xE0);
static_assert(offsetof(UIMacroDetectorWnd, message) == 0xF8);
static_assert(offsetof(UIMacroDetectorWnd, messageTick) == 0x114);
#endif
#endif