Decompile 3 functions in Source/UI/Item/UIEquipmentPropertiesWnd.cpp, Source/UI/Item/UIEquipmentPropertiesWnd.h, ...
Batch #8181 by willerthal: 0 byte-identical, 3 confirmed by peer review. - fn_15039 CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::AddNewItem: logic confirmed by peer review - fn_15040 CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::Slot53: logic confirmed by peer review - fn_15041 CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::Resize: logic confirmed by peer review Peer-reviewed-by: Yommy, alisonrag, pedrao 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
d4290cee2d
commit
3aa4c39bee
3 changed files with 136 additions and 1 deletions
|
|
@ -8,7 +8,9 @@
|
|||
#include "Utility/Cipher/XorBytes.h"
|
||||
#include "Utility/Text/StringUtil.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
|
|
@ -25,6 +27,118 @@ template void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLin
|
|||
template void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::Slot35(int);
|
||||
template void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::ClearItems();
|
||||
|
||||
void CUIListItem::SetImageResources(CBitmapRes* normal, CBitmapRes* hover, CBitmapRes* pressed, CBitmapRes* disabled) {
|
||||
auto& images = *reinterpret_cast<std::map<int, CBitmapRes*>*>(reinterpret_cast<std::uint8_t*>(this) + 0x80);
|
||||
images.clear();
|
||||
images[0] = normal;
|
||||
images[1] = hover;
|
||||
images[2] = pressed;
|
||||
this->disabledImage = disabled;
|
||||
this->Invalidate();
|
||||
}
|
||||
|
||||
EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine::CUIItemEquipmentPropertiesLine(UIWindowContext& context)
|
||||
: CUIListItem(context), unknown_00E8(nullptr), unknown_00EC(nullptr), evenRowColor(0), oddRowColor(0) {
|
||||
}
|
||||
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::SelectItem(CUIListItem* item) {
|
||||
if (this->unknown_00C4) {
|
||||
return;
|
||||
}
|
||||
for (EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* other : this->items) {
|
||||
if (other != item) {
|
||||
other->SetSelected(0);
|
||||
}
|
||||
}
|
||||
item->SetSelected(1);
|
||||
if (item->index == static_cast<int>(this->selected) && this->unknown_00E0) {
|
||||
return;
|
||||
}
|
||||
EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* selectedItem =
|
||||
dynamic_cast<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine*>(item);
|
||||
if (!selectedItem) {
|
||||
return;
|
||||
}
|
||||
this->selected = selectedItem->index;
|
||||
if (this->onSelect && static_cast<int>(this->selected) >= 0 && this->selected < this->data.size()) {
|
||||
auto node = this->data.begin();
|
||||
std::advance(node, static_cast<int>(this->selected));
|
||||
this->onSelect(selectedItem, *node);
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A0CF00
|
||||
// FUNCTION: fn_15039
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::AddNewItem() {
|
||||
if (this->itemWidth <= 0 || this->rowHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* item : this->items) {
|
||||
this->RemoveChild(item, 1);
|
||||
}
|
||||
this->items.clear();
|
||||
this->selected = static_cast<unsigned int>(-1);
|
||||
|
||||
if (this->rowHeight <= this->geometry.height) {
|
||||
unsigned count = static_cast<unsigned>(this->geometry.height / this->rowHeight) + 1;
|
||||
if (this->geometry.height % this->rowHeight > 1) {
|
||||
++count;
|
||||
}
|
||||
this->items.resize(count, nullptr);
|
||||
for (EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine*& slot : this->items) {
|
||||
EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* item =
|
||||
new EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine(*this->m_context);
|
||||
item->SetSize(this->itemWidth, this->rowHeight);
|
||||
item->Show(0);
|
||||
CResPtr<CBitmapRes>* images = reinterpret_cast<CResPtr<CBitmapRes>*>(reinterpret_cast<std::uint8_t*>(this) + 0x80);
|
||||
item->SetImageResources(images[0], images[1], images[2], images[3]);
|
||||
item->onHover = [this](CUIListItem* listItem) {
|
||||
for (EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* other : this->items) {
|
||||
other->SetHighlighted(other == listItem);
|
||||
}
|
||||
};
|
||||
item->onPress = [this](CUIListItem* listItem) {
|
||||
this->SelectItem(listItem);
|
||||
};
|
||||
this->AddChild(item);
|
||||
slot = item;
|
||||
}
|
||||
}
|
||||
|
||||
this->scrollBar->SetTotal(this->geometry.height);
|
||||
this->scrollBar->SetVisible(this->geometry.height);
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A0D160
|
||||
// FUNCTION: fn_15040
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::Slot53(int resolveSkin) {
|
||||
CResPtr<CBitmapRes>* images = reinterpret_cast<CResPtr<CBitmapRes>*>(reinterpret_cast<std::uint8_t*>(this) + 0x80);
|
||||
images[0] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->imageNames[0], resolveSkin));
|
||||
images[1] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->imageNames[1], resolveSkin));
|
||||
images[2] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->imageNames[2], resolveSkin));
|
||||
images[3] = CResPtr<CBitmapRes>(this->LoadBitmapResource(this->disabledName, resolveSkin));
|
||||
for (EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine* item : this->items) {
|
||||
item->SetImageResources(images[0], images[1], images[2], images[3]);
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A0D370
|
||||
// FUNCTION: fn_15041
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::Resize(int width, int height) {
|
||||
UIWindow::Resize(width, height);
|
||||
this->AddNewItem();
|
||||
this->scrollBar->Resize(this->scrollBar->geometry.width, height);
|
||||
this->scrollBar->SetTotal(static_cast<int>(this->data.size()) * this->rowHeight + this->itemY);
|
||||
this->scrollBar->SetVisible(this->geometry.height);
|
||||
this->scrollBar->SetPosition(this->scrollBar->position);
|
||||
this->rebind = 1;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A0D3F0
|
||||
// FUNCTION: fn_15042
|
||||
template <>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@
|
|||
namespace EquipmentPropertiesWnd {
|
||||
class CUIItemEquipmentPropertiesLine : public CUIListItem {
|
||||
public:
|
||||
explicit CUIItemEquipmentPropertiesLine(UIWindowContext& context);
|
||||
|
||||
/* 00E8 */ CUIStaticText* unknown_00E8;
|
||||
/* 00EC */ CUIStaticText* unknown_00EC;
|
||||
/* 00F0 */ std::uint32_t evenRowColor;
|
||||
|
|
@ -61,6 +63,12 @@ template <>
|
|||
CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::~CUIListBoxEx();
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::Slot15(int width, int height);
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::AddNewItem();
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::Resize(int width, int height);
|
||||
template <>
|
||||
void CUIListBoxEx<EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine, std::string>::Slot53(int resolveSkin);
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(EquipmentPropertiesWnd::CUIItemEquipmentPropertiesLine) == 0xF8);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,10 @@
|
|||
|
||||
class CUIListItem : public CUIControl {
|
||||
public:
|
||||
// INLINED
|
||||
explicit CUIListItem(UIWindowContext& context) : CUIControl(context), selected(0), disabledImage(nullptr), frozen(0), index(-1) {
|
||||
}
|
||||
|
||||
void Slot25(int x, int y) override;
|
||||
void Slot27(int x, int y) override;
|
||||
void Slot31(int x, int y) override;
|
||||
|
|
@ -23,10 +27,11 @@ public:
|
|||
virtual void SetSelected(bool selected);
|
||||
virtual void SetHighlighted(bool highlighted);
|
||||
virtual void SetFrozen(bool frozen);
|
||||
void SetImageResources(CBitmapRes* normal, CBitmapRes* hover, CBitmapRes* pressed, CBitmapRes* disabled);
|
||||
|
||||
/* 0084 */ unsigned char unknown_0084[0x04];
|
||||
/* 0088 */ int selected;
|
||||
/* 008C */ unsigned char unknown_008C[0x04];
|
||||
/* 008C */ CBitmapRes* disabledImage;
|
||||
/* 0090 */ unsigned char frozen;
|
||||
/* 0094 */ int index;
|
||||
/* 0098 */ std::function<void(CUIListItem*)> onHover;
|
||||
|
|
@ -303,6 +308,14 @@ public:
|
|||
bool RebindIndex(int index);
|
||||
void SelectItem(CUIListItem* item);
|
||||
bool SelectIndex(int index);
|
||||
void AddNewItem() {
|
||||
}
|
||||
void Resize(int width, int height) override {
|
||||
UIWindow::Resize(width, height);
|
||||
}
|
||||
void Slot53(int resolveSkin) override {
|
||||
(void)resolveSkin;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00A04B30
|
||||
// FUNCTION: fn_14963
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue