Decompile 6 functions in Source/UI/UIMacroBlackListCheckWnd.cpp, Source/UI/UIMacroBlackListCheckWnd.h
Batch #3625 by eAthena: 4 byte-identical, 2 confirmed by peer review. - fn_09796 UIMacroBlackListCheckWnd::Slot25: byte-identical - fn_09797 UIMacroBlackListCheckWnd::Slot31: byte-identical - fn_09798 UIMacroBlackListCheckWnd::Slot27: byte-identical - fn_09799 UIMacroBlackListCheckWnd::Slot19: byte-identical - fn_09800 UIMacroBlackListCheckWnd::ShuffleDigitButtons: logic confirmed by peer review - fn_09801 UIMacroBlackListCheckWnd::SendMsg: logic confirmed by peer review Peer-reviewed-by: Yommy, ntrl, meitogi Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
parent
8627f7c8f9
commit
752c28f87b
2 changed files with 112 additions and 0 deletions
|
|
@ -1,11 +1,23 @@
|
|||
#include "UI/UIMacroBlackListCheckWnd.h"
|
||||
|
||||
#include "UI/Buttons/UIBitmapButton.h"
|
||||
#include "Network/Connection/Connection.h"
|
||||
#include "Network/Packets/PacketLengths.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <random>
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
struct MacroBlackListCheckPacket {
|
||||
/* 0000 */ std::int16_t id;
|
||||
/* 0002 */ char text[16];
|
||||
};
|
||||
static_assert(sizeof(MacroBlackListCheckPacket) == 18);
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EB230
|
||||
// FUNCTION: fn_09794
|
||||
void UIMacroBlackListCheckWnd::Slot15(int width, int height) {
|
||||
|
|
@ -66,3 +78,95 @@ void UIMacroBlackListCheckWnd::Slot15(int width, int height) {
|
|||
|
||||
this->geometry.targetAlpha = 176;
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EC770
|
||||
// FUNCTION: fn_09796
|
||||
void UIMacroBlackListCheckWnd::Slot25(int, int) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EC780
|
||||
// FUNCTION: fn_09797
|
||||
void UIMacroBlackListCheckWnd::Slot31(int, int) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EC790
|
||||
// FUNCTION: fn_09798
|
||||
void UIMacroBlackListCheckWnd::Slot27(int, int) {
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EC7A0
|
||||
// FUNCTION: fn_09799
|
||||
void UIMacroBlackListCheckWnd::Slot19() {
|
||||
this->Invalidate();
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EC7B0
|
||||
// FUNCTION: fn_09800
|
||||
void UIMacroBlackListCheckWnd::ShuffleDigitButtons() {
|
||||
unsigned char order[10];
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
order[i] = static_cast<unsigned char>(i);
|
||||
}
|
||||
|
||||
std::mt19937 engine(std::random_device{}());
|
||||
std::shuffle(order, order + 10, engine);
|
||||
|
||||
const int positions[11][2] = {
|
||||
{303, 75}, {363, 75}, {423, 75}, {303, 135}, {363, 135}, {423, 135}, {303, 195}, {363, 195}, {423, 195}, {303, 255}, {363, 255},
|
||||
};
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
this->digitButtons[i]->Move(positions[order[i]][0], positions[order[i]][1]);
|
||||
}
|
||||
|
||||
this->Invalidate();
|
||||
}
|
||||
|
||||
// OFFSET: 0x007EC910
|
||||
// FUNCTION: fn_09801
|
||||
int UIMacroBlackListCheckWnd::SendMsg(
|
||||
UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4
|
||||
) {
|
||||
if (message != 6) {
|
||||
return UIFrameWnd::SendMsg(sender, message, argument1, argument2, argument3, argument4);
|
||||
}
|
||||
|
||||
switch (argument1) {
|
||||
case 184:
|
||||
if (static_cast<unsigned>(this->inputLength - 4) <= 4) {
|
||||
MacroBlackListCheckPacket packet;
|
||||
packet.id = 0x0BDC;
|
||||
strncpy_s(packet.text, sizeof(packet.text), this->input, _TRUNCATE);
|
||||
CRagConnection& connection = GetRagConnection();
|
||||
connection.Send(g_packetLengths.FixedLength(packet.id), &packet);
|
||||
this->inputLength = 0;
|
||||
std::memset(this->input, 0, sizeof(this->input));
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 293:
|
||||
case 294:
|
||||
case 295:
|
||||
case 296:
|
||||
case 297:
|
||||
case 298:
|
||||
case 299:
|
||||
case 300:
|
||||
case 301:
|
||||
case 302:
|
||||
this->ShuffleDigitButtons();
|
||||
if (this->inputLength < 8) {
|
||||
this->input[this->inputLength] = static_cast<char>('0' + (argument1 - 293));
|
||||
++this->inputLength;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case 303:
|
||||
this->inputLength = 0;
|
||||
std::memset(this->input, 0, sizeof(this->input));
|
||||
this->ShuffleDigitButtons();
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,20 @@ struct UIButtonContext;
|
|||
class UIMacroBlackListCheckWnd : public UIFrameWnd {
|
||||
public:
|
||||
void Slot15(int width, int height) override;
|
||||
void Slot19() override;
|
||||
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 argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override;
|
||||
void ShuffleDigitButtons();
|
||||
|
||||
/* 00B4 */ UIBitmapButton* digitButtons[10];
|
||||
/* 00DC */ UIBitmapButton* resetButton;
|
||||
/* 00E0 */ UIBitmapButton* okButton;
|
||||
/* 00E4 */ unsigned char unknown_00E4;
|
||||
/* 00E5 */ char digits[10];
|
||||
/* 00F0 */ int inputLength;
|
||||
/* 00F4 */ char input[9];
|
||||
|
||||
protected:
|
||||
UIButtonContext* m_controls;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue