Maintenance: [forced, user-approved] Family F7: remove WindowReplayRecorder (agent 3 row 115, reassigned by the coordinator). Its met

Batch #10245 by ragnarok-clanker: forced by an admin (3 lower score(s), 19 changed function(s)); checked with 397 compiled unit(s), including every includer of Source/Client/ReplayPacketRecorder.h, Source/UI/Item/UIItemSellWnd.h, Source/UI/Item/UIItemSellWnd2.h, Source/UI/Item/UIItemShopWnd.h, Source/UI/Item/UIItemShopWnd2.h, Source/UI/Window/UIWindow.h.
This commit is contained in:
ragnarok-clanker 2026-11-03 11:55:38 +00:00
commit a501aa68af
17 changed files with 49 additions and 81 deletions

View file

@ -5,6 +5,7 @@
#include "Network/Packets/PacketLengths.h"
#include "Network/Packets/PacketId.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include "UI/Window/WindowPolicy.h"
#include <algorithm>
@ -271,12 +272,12 @@ namespace {
// OFFSET: 0x00A82F80
// FUNCTION: fn_17000
void WindowReplayRecorder::RecordDrop(int x, int y, const ModeDragState& drag, int target) {
void UIWindow::RecordDrop(int x, int y, const ModeDragState& drag, int target) {
if (Replay::Instance().state != 2) {
return;
}
if (WindowPolicy(this->policy, this->restricted, 5, this->windowId) == 0) {
if (WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 5, this->geometry.id) == 0) {
return;
}
@ -284,7 +285,7 @@ void WindowReplayRecorder::RecordDrop(int x, int y, const ModeDragState& drag, i
std::memset(&packet, 0, sizeof(packet));
packet.marker = 0x038508AEu;
packet.bytes = sizeof(packet);
packet.windowId = target == -1 ? this->windowId : target;
packet.windowId = target == -1 ? this->geometry.id : target;
packet.x = x;
packet.y = y;
packet.source = drag.source;
@ -305,12 +306,12 @@ void WindowReplayRecorder::RecordDrop(int x, int y, const ModeDragState& drag, i
packet.optionCount = drag.optionCount;
std::memcpy(packet.options, drag.options, sizeof(packet.options));
this->packets.Record(packet.bytes, &packet, 42, 0);
reinterpret_cast<ReplayPacketRecorder*>(&Replay::Instance())->Record(packet.bytes, &packet, 42, 0);
}
// OFFSET: 0x00A83180
// FUNCTION: fn_17001
int WindowReplayRecorder::RecordData(std::uint16_t type, std::vector<unsigned char> data) {
int UIWindow::RecordData(std::uint16_t type, std::vector<unsigned char> data) {
if (Replay::Instance().state != 2 || data.empty()) {
return 0;
}
@ -329,7 +330,7 @@ int WindowReplayRecorder::RecordData(std::uint16_t type, std::vector<unsigned ch
// OFFSET: 0x00A83300
// FUNCTION: fn_17002
void WindowReplayRecorder::RecordValues(int value, int argument1, int argument2, int argument3, int argument4) {
void UIWindow::RecordValues(int value, int argument1, int argument2, int argument3, int argument4) {
if (g_replayAnimationScaling != 0 || Replay::Instance().state != 2) {
return;
}
@ -337,18 +338,18 @@ void WindowReplayRecorder::RecordValues(int value, int argument1, int argument2,
ValuesRecord packet;
packet.marker = 0x039108AEu;
packet.bytes = sizeof(packet);
packet.windowId = this->windowId;
packet.windowId = this->geometry.id;
packet.value = value;
packet.arguments[0] = argument1;
packet.arguments[1] = argument2;
packet.arguments[2] = argument3;
packet.arguments[3] = argument4;
this->packets.Record(packet.bytes, &packet, 42, 0);
reinterpret_cast<ReplayPacketRecorder*>(&Replay::Instance())->Record(packet.bytes, &packet, 42, 0);
}
// OFFSET: 0x00A83440
// FUNCTION: fn_17003
void WindowReplayRecorder::RecordText(int event, const char* text) {
void UIWindow::RecordText(int event, const char* text) {
if (Replay::Instance().state != 2) {
return;
}
@ -357,8 +358,8 @@ void WindowReplayRecorder::RecordText(int event, const char* text) {
std::memset(packet.text, 0, sizeof(packet.text));
packet.marker = 0x038B08AEu;
packet.bytes = sizeof(packet);
packet.windowId = this->windowId;
packet.windowId = this->geometry.id;
packet.event = event;
std::memcpy(packet.text, text, std::min(static_cast<int>(std::strlen(text)), 100));
this->packets.Record(packet.bytes, &packet, 42, 0);
reinterpret_cast<ReplayPacketRecorder*>(&Replay::Instance())->Record(packet.bytes, &packet, 42, 0);
}

View file

@ -27,17 +27,5 @@ struct ReplayPacketRecorder {
bool Record(std::uint16_t bytes, const void* packet, int event, std::uint32_t delay);
};
struct WindowReplayRecorder {
const int& windowId;
const int* policy;
const bool& restricted;
ReplayPacketRecorder& packets;
void RecordDrop(int x, int y, const ModeDragState& drag, int target);
int RecordData(std::uint16_t type, std::vector<unsigned char> data);
void RecordValues(int value, int argument1, int argument2, int argument3, int argument4);
void RecordWindowFlag(bool value);
void RecordText(int event, const char* text);
};
#endif

View file

@ -174,7 +174,7 @@ void UIButton::Slot31(int x, int y) {
}
} else {
if (id == 184 || id == 321) {
RecordEditTextsNoArg(parent);
parent->RecordEditTexts();
id = this->geometry.id;
parent = this->parent;
}

View file

@ -43,7 +43,7 @@ void UITextureButton::Slot31(int x, int y) {
}
} else {
if (id == 184 || id == 321) {
RecordEditTextsNoArg(parent);
parent->RecordEditTexts();
id = this->geometry.id;
}

View file

@ -1717,7 +1717,7 @@ void UIItemSellWnd2::Slot26(int x, int y) {
if (target) {
this->Slot25(x, y);
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
this->m_recorder->RecordDrop(x, y, mode->drag, 160);
this->RecordDrop(x, y, mode->drag, 160);
target->Slot10(x, y, reinterpret_cast<std::intptr_t>(&mode->drag));
}
}
@ -1734,7 +1734,7 @@ void UIItemSellWnd::Slot26(int x, int y) {
if (target) {
this->Slot25(x, y);
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
this->m_recorder->RecordDrop(x, y, mode->drag, 22);
this->RecordDrop(x, y, mode->drag, 22);
target->Slot10(x, y, reinterpret_cast<std::intptr_t>(&mode->drag));
}
}
@ -4204,7 +4204,7 @@ void UIItemShopWnd2::Slot26(int x, int y) {
if (target) {
this->Slot25(x, y);
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
this->m_recorder->RecordDrop(x, y, mode->drag, 161);
this->RecordDrop(x, y, mode->drag, 161);
target->Slot10(x, y, reinterpret_cast<std::intptr_t>(&mode->drag));
}
}
@ -4221,7 +4221,7 @@ void UIItemShopWnd::Slot26(int x, int y) {
if (target) {
this->Slot25(x, y);
CGameMode* mode = static_cast<CGameMode*>(g_modeMgr.GetGameMode());
this->m_recorder->RecordDrop(x, y, mode->drag, 24);
this->RecordDrop(x, y, mode->drag, 24);
target->Slot10(x, y, reinterpret_cast<std::intptr_t>(&mode->drag));
}
}

View file

@ -6,7 +6,6 @@
#include <cstddef>
struct WindowReplayRecorder;
class UIStaticText;
class UIItemSellWnd : public UIItemBaseWnd {
@ -23,10 +22,7 @@ public:
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
protected:
union {
WindowReplayRecorder* m_recorder;
/* 00F0 */ UIStaticText* total;
};
/* 00F0 */ UIStaticText* total;
public:
/* 00F4 */ ItemSellWndInfo* saved;

View file

@ -7,7 +7,6 @@
#include <cstddef>
#include <vector>
struct WindowReplayRecorder;
class UIStaticText;
class UIItemSellWnd2 : public UIItemBaseWnd {
@ -25,10 +24,7 @@ public:
void Slot15(int width, int height) override;
protected:
union {
WindowReplayRecorder* m_recorder;
/* 00F0 */ UIStaticText* total;
};
/* 00F0 */ UIStaticText* total;
public:
/* 00F4 */ ItemSellWndInfo* saved;

View file

@ -8,7 +8,6 @@
#include <cstdint>
#include <vector>
struct WindowReplayRecorder;
class UICheckBox;
class UIStaticText;
@ -27,10 +26,7 @@ public:
int SendMsg(UIWindow* sender, int message, std::intptr_t a, std::intptr_t b, std::intptr_t c, std::intptr_t d) override;
protected:
union {
WindowReplayRecorder* m_recorder;
/* 00F0 */ UIStaticText* title;
};
/* 00F0 */ UIStaticText* title;
public:
/* 00F4 */ UICheckBox* checkBox;

View file

@ -7,7 +7,6 @@
#include <cstddef>
#include <cstdint>
struct WindowReplayRecorder;
class UICheckBox;
class UIStaticText;
@ -25,10 +24,7 @@ public:
int SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3, std::intptr_t argument4) override;
protected:
union {
WindowReplayRecorder* m_recorder;
/* 00F0 */ UIStaticText* title;
};
/* 00F0 */ UIStaticText* title;
public:
/* 00F4 */ UICheckBox* checkBox;

View file

@ -954,7 +954,7 @@ template void CUIListBoxEx<RenewQuestUI::CUIQuestItem, unsigned long>::ClearData
// OFFSET: 0x00A661F0
// FUNCTION: fn_16612
void WindowReplayRecorder::RecordWindowFlag(bool value) {
void UIWindow::RecordWindowFlag(bool value) {
this->RecordValues(6, 0xd5, value, 0, 0);
if (UIWindow* window = g_windowMgr.LookupWindow(0xcc)) {
window->Show(value);
@ -1101,7 +1101,7 @@ int CUIRenewQuestUI::SendMsg(UIWindow* sender, int message, std::intptr_t a, std
const bool checked = b != 0;
this->checkBox->checked = checked;
this->checkBox->Invalidate();
reinterpret_cast<WindowReplayRecorder*>(this)->RecordValues(6, 0xD5, checked, 0, 0);
this->RecordValues(6, 0xD5, checked, 0, 0);
if (UIWindow* window = g_windowMgr.LookupWindow(0xCC)) {
window->Show(checked);
}
@ -1593,7 +1593,7 @@ void CUIRenewQuestUI::Slot15(int width, int height) {
processButton->SetSize(30, 100);
processButton->Move(0, 0);
processButton->SetOnClick([this]() {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordValues(0x16, 1, 0, 0, 0);
this->RecordValues(0x16, 1, 0, 0, 0);
for (RenewQuestUI::CUIQuestList* list : this->questLists) {
if (list->type == 1) {
if (list->list) {
@ -1648,7 +1648,7 @@ void CUIRenewQuestUI::Slot15(int width, int height) {
recommendedButton->SetSize(30, 100);
recommendedButton->Move(0, 101);
recommendedButton->SetOnClick([this]() {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordValues(0x16, 2, 0, 0, 0);
this->RecordValues(0x16, 2, 0, 0, 0);
for (RenewQuestUI::CUIQuestList* list : this->questLists) {
if (list->type == 2) {
if (list->list) {
@ -1711,7 +1711,7 @@ void CUIRenewQuestUI::Slot15(int width, int height) {
holdButton->SetSize(30, 100);
holdButton->Move(0, 202);
holdButton->SetOnClick([this]() {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordValues(0x16, 4, 0, 0, 0);
this->RecordValues(0x16, 4, 0, 0, 0);
for (RenewQuestUI::CUIQuestList* list : this->questLists) {
if (list->type == 4) {
if (list->list) {
@ -1763,7 +1763,7 @@ void CUIRenewQuestUI::Slot15(int width, int height) {
waitButton->SetSize(30, 100);
waitButton->Move(0, 303);
waitButton->SetOnClick([this]() {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordValues(0x16, 8, 0, 0, 0);
this->RecordValues(0x16, 8, 0, 0, 0);
for (RenewQuestUI::CUIQuestList* list : this->questLists) {
if (list->type == 8) {
if (list->list) {
@ -1814,7 +1814,7 @@ void CUIRenewQuestUI::Slot15(int width, int height) {
this->checkBox = new CUICheckBox();
this->checkBox->SetSize(10, 10);
this->checkBox->Move(38, 448);
this->checkBox->SetOnCheck([this](bool checked) { reinterpret_cast<WindowReplayRecorder*>(this)->RecordWindowFlag(checked); });
this->checkBox->SetOnCheck([this](bool checked) { this->RecordWindowFlag(checked); });
this->checkBox->disabled = 0;
this->checkBox->Invalidate();
const std::uint8_t checkInactive[] = {

View file

@ -1065,7 +1065,7 @@ static void SetRecommendedQuestSummary(CRenewQuestMgr* mgr, unsigned int id, std
int UIRenewQuestWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument1, std::intptr_t argument2, std::intptr_t argument3,
std::intptr_t argument4) {
if (message == 22 || argument1 == 0xD5) {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordValues(message, argument1, argument2, argument3, argument4);
this->RecordValues(message, argument1, argument2, argument3, argument4);
}
switch (message) {

View file

@ -1079,7 +1079,7 @@ bool UINavigationWnd::LoadRoute(int index) {
fclose(file);
if (g_navigationManager.StateCount() > 0) {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordData(0x38F, g_navigationManager.WriteStates());
this->RecordData(0x38F, g_navigationManager.WriteStates());
}
this->FillRouteList();

View file

@ -174,7 +174,7 @@ void UIStylingShopButton::Slot31(int, int) {
}
} else {
if (id == 184 || id == 321) {
RecordEditTextsNoArg(parent);
parent->RecordEditTexts();
id = this->geometry.id;
parent = this->parent;
}

View file

@ -2215,8 +2215,8 @@ static_assert(sizeof(EditTextsRecord) == 0x1000);
// OFFSET: 0x00A834E0
// FUNCTION: fn_17004
int UIWindow::RecordEditTexts(WindowReplayRecorder& recorder) {
if (Replay::Instance().state != 2 || !WindowPolicy(recorder.policy, recorder.restricted, 6, this->geometry.id)) {
int UIWindow::RecordEditTexts() {
if (Replay::Instance().state != 2 || !WindowPolicy(g_windowMgr.policy[0].actions, g_replayAnimationScaling != 0, 6, this->geometry.id)) {
return 0;
}
@ -2254,7 +2254,7 @@ int UIWindow::RecordEditTexts(WindowReplayRecorder& recorder) {
record.bytes = static_cast<std::uint16_t>(offset);
record.marker = 0x038608AEu;
record.windowId = this->geometry.id;
recorder.packets.Record(record.bytes, &record, 41, 0);
reinterpret_cast<ReplayPacketRecorder*>(&Replay::Instance())->Record(record.bytes, &record, 41, 0);
return offset;
}
@ -3314,7 +3314,7 @@ bool UINavigationV4Wnd::LoadRoute(int index) {
g_navigationManager.BuildSingleNodePaths();
if (g_navigationManager.StateCount() > 0) {
reinterpret_cast<WindowReplayRecorder*>(this)->RecordData(0x38F, g_navigationManager.WriteStates());
this->RecordData(0x38F, g_navigationManager.WriteStates());
}
this->FillRouteGroups();

View file

@ -26,7 +26,7 @@ class CBitmapRes;
class CActRes;
class TextureCache;
class UITextViewer;
struct WindowReplayRecorder;
struct ModeDragState;
struct ITEM_INFO;
class UIItemTagButton;
@ -177,7 +177,12 @@ public:
const char* TruncateText(const char* text, int maxBytes);
const char* ClipTextToWidth(const char* text, int maxWidth, int family, int height, unsigned char bold);
void RecordResponse(int response, std::intptr_t b, std::intptr_t c, std::intptr_t d);
int RecordEditTexts(WindowReplayRecorder& recorder);
int RecordEditTexts();
void RecordDrop(int x, int y, const ModeDragState& drag, int target);
int RecordData(std::uint16_t type, std::vector<unsigned char> data);
void RecordValues(int value, int argument1, int argument2, int argument3, int argument4);
void RecordWindowFlag(bool value);
void RecordText(int event, const char* text);
int RestoreEditTexts(const unsigned char* data);
void DrawActionSprite(
const CSprRes* sprite, const CActRes* action, int x, int y, int width, int height, int interval, bool scaled, const CBitmapRes* background
@ -233,16 +238,6 @@ private:
UIWindow& operator=(const UIWindow&) = delete;
};
// INLINED
__forceinline void RecordEditTextsNoArg(UIWindow* window) {
union {
int (UIWindow::*method)(WindowReplayRecorder&);
void (__thiscall* call)(UIWindow*);
} convert;
convert.method = &UIWindow::RecordEditTexts;
convert.call(window);
}
extern std::uint32_t g_windowUid;
#if defined(_WIN32) && !defined(_WIN64)

View file

@ -1975,7 +1975,7 @@ bool UIWindowMgr::sub_A8CA20() {
window = this->unknown_0314;
if (window != nullptr) {
if (Replay::Instance().state == 2) {
RecordEditTextsNoArg(window);
window->RecordEditTexts();
}
window->SendMsg(nullptr, 0, 0, 0, 0, 0);
return true;
@ -1983,7 +1983,7 @@ bool UIWindowMgr::sub_A8CA20() {
window = this->unknown_0318;
if (window != nullptr) {
if (Replay::Instance().state == 2) {
RecordEditTextsNoArg(window);
window->RecordEditTexts();
}
window->SendMsg(nullptr, 0, 0, 0, 0, 0);
return true;
@ -2027,7 +2027,7 @@ bool UIWindowMgr::sub_A8CA20() {
handled = false;
}
if (Replay::Instance().state == 2 && handled) {
RecordEditTextsNoArg(this->hoverWindow->Root());
this->hoverWindow->Root()->RecordEditTexts();
}
if (g_windowCloseByte == 0) {
handled = true;
@ -2041,7 +2041,7 @@ bool UIWindowMgr::sub_A8CA20() {
if (window == nullptr) {
if (this->window_01C8 != nullptr && g_inputSuggestionsEnabled == 1) {
handled = false;
RecordEditTextsNoArg(this->window_01C8);
this->window_01C8->RecordEditTexts();
window = this->window_01C8;
} else {
for (UIWindow* item : this->rendered) {
@ -2049,7 +2049,7 @@ bool UIWindowMgr::sub_A8CA20() {
continue;
}
if (g_replayAnimationScaling == 0) {
RecordEditTextsNoArg(item->Root());
item->Root()->RecordEditTexts();
}
item->SendMsg(nullptr, 0, 0, 0, 0, 0);
}

View file

@ -1095,7 +1095,7 @@ bool UIWindowMgr::DropAt(int x, int y, ModeDragState* drag) {
const int localX = x - offsetX;
const int localY = y - offsetY;
reinterpret_cast<WindowReplayRecorder*>(window)->RecordDrop(localX, localY, *drag, -1);
window->RecordDrop(localX, localY, *drag, -1);
drag->unknown_038C = reinterpret_cast<std::uint32_t>(window);
if (this->window_01EC != window->Root()) {
window->Slot10(localX, localY, reinterpret_cast<std::intptr_t>(drag));