Removed TargetMemoryDescriptor dependency in MemoryRegion class (in preparation for saving & loading memory regions from Bloom's project settings file)
This commit is contained in:
@@ -9,8 +9,7 @@ namespace Bloom
|
||||
public:
|
||||
explicit ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
): MemoryRegion(name, MemoryRegionType::EXCLUDED, memoryDescriptor, addressRange) {};
|
||||
): MemoryRegion(name, MemoryRegionType::EXCLUDED, addressRange) {};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ namespace Bloom
|
||||
|
||||
explicit FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
): MemoryRegion(name, MemoryRegionType::FOCUSED, memoryDescriptor, addressRange) {};
|
||||
): MemoryRegion(name, MemoryRegionType::FOCUSED, addressRange) {};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ AnnotationItem::AnnotationItem(
|
||||
|
||||
AnnotationItem::AnnotationItem(const FocusedMemoryRegion& focusedMemoryRegion, AnnotationItemPosition position)
|
||||
: AnnotationItem(
|
||||
focusedMemoryRegion.getAbsoluteAddressRange(),
|
||||
focusedMemoryRegion.addressRange,
|
||||
focusedMemoryRegion.name,
|
||||
position
|
||||
) {}
|
||||
|
||||
@@ -89,16 +89,18 @@ void ByteItemGraphicsScene::refreshRegions() {
|
||||
byteWidget->excludedMemoryRegion = nullptr;
|
||||
|
||||
for (const auto& focusedRegion : this->focusedMemoryRegions) {
|
||||
const auto addressRange = focusedRegion.getAbsoluteAddressRange();
|
||||
if (byteAddress >= addressRange.startAddress && byteAddress <= addressRange.endAddress) {
|
||||
if (byteAddress >= focusedRegion.addressRange.startAddress
|
||||
&& byteAddress <= focusedRegion.addressRange.endAddress
|
||||
) {
|
||||
byteWidget->focusedMemoryRegion = &focusedRegion;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& excludedRegion : this->excludedMemoryRegions) {
|
||||
const auto addressRange = excludedRegion.getAbsoluteAddressRange();
|
||||
if (byteAddress >= addressRange.startAddress && byteAddress <= addressRange.endAddress) {
|
||||
if (byteAddress >= excludedRegion.addressRange.startAddress
|
||||
&& byteAddress <= excludedRegion.addressRange.endAddress
|
||||
) {
|
||||
byteWidget->excludedMemoryRegion = &excludedRegion;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
using namespace Bloom;
|
||||
|
||||
using Bloom::Targets::TargetMemoryAddressRange;
|
||||
|
||||
TargetMemoryAddressRange MemoryRegion::getAbsoluteAddressRange() const {
|
||||
if (this->addressRangeType == MemoryRegionAddressType::ABSOLUTE) {
|
||||
return this->addressRange;
|
||||
}
|
||||
|
||||
return TargetMemoryAddressRange(
|
||||
this->addressRange.startAddress + this->memoryDescriptor.addressRange.startAddress,
|
||||
this->addressRange.endAddress + this->memoryDescriptor.addressRange.startAddress
|
||||
);
|
||||
}
|
||||
|
||||
TargetMemoryAddressRange MemoryRegion::getRelativeAddressRange() const {
|
||||
if (this->addressRangeType == MemoryRegionAddressType::RELATIVE) {
|
||||
return this->addressRange;
|
||||
}
|
||||
|
||||
return TargetMemoryAddressRange(
|
||||
this->addressRange.startAddress - this->memoryDescriptor.addressRange.startAddress,
|
||||
this->addressRange.endAddress - this->memoryDescriptor.addressRange.startAddress
|
||||
);
|
||||
}
|
||||
@@ -29,16 +29,31 @@ namespace Bloom
|
||||
QString name;
|
||||
QDateTime createdDate = DateTime::currentDateTime();
|
||||
MemoryRegionType type;
|
||||
Targets::TargetMemoryDescriptor memoryDescriptor;
|
||||
Targets::TargetMemoryAddressRange addressRange;
|
||||
|
||||
/**
|
||||
* The addressRangeType holds the user's preference when inputting address ranges in the memory region manager
|
||||
* window, for this particular memory region.
|
||||
*
|
||||
* It has no significance anywhere else. We never store the address in relative form - this->addressRange will
|
||||
* always be in absolute form. Conversion is done at the point of applying the changes.
|
||||
*
|
||||
* For more, see the following and their call sites:
|
||||
* See RegionItem::convertRelativeToAbsoluteAddressRange()
|
||||
* See RegionItem::convertAbsoluteToRelativeAddressRange()
|
||||
*/
|
||||
MemoryRegionAddressType addressRangeType = MemoryRegionAddressType::ABSOLUTE;
|
||||
|
||||
/**
|
||||
* This address range will always be in absolute form. Regardless of the value of this->addressRangeType.
|
||||
* See the comment above, for this->addressRangeType, for more.
|
||||
*/
|
||||
Targets::TargetMemoryAddressRange addressRange;
|
||||
|
||||
MemoryRegion(
|
||||
QString name,
|
||||
MemoryRegionType type,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
): name(std::move(name)), type(type), memoryDescriptor(memoryDescriptor), addressRange(addressRange) {};
|
||||
): name(std::move(name)), type(type), addressRange(addressRange) {};
|
||||
|
||||
virtual ~MemoryRegion() = default;
|
||||
|
||||
@@ -57,12 +72,9 @@ namespace Bloom
|
||||
}
|
||||
|
||||
[[nodiscard]] bool intersectsWith(const MemoryRegion& other) const {
|
||||
return this->getAbsoluteAddressRange().intersectsWith(other.getAbsoluteAddressRange());
|
||||
return this->addressRange.intersectsWith(other.addressRange);
|
||||
}
|
||||
|
||||
[[nodiscard]] Targets::TargetMemoryAddressRange getAbsoluteAddressRange() const;
|
||||
[[nodiscard]] Targets::TargetMemoryAddressRange getRelativeAddressRange() const;
|
||||
|
||||
private:
|
||||
static inline std::atomic<std::size_t> lastId = 0;
|
||||
};
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
using namespace Bloom;
|
||||
using namespace Bloom::Widgets;
|
||||
|
||||
using Targets::TargetMemoryAddressRange;
|
||||
|
||||
ExcludedRegionItem::ExcludedRegionItem(
|
||||
const ExcludedMemoryRegion& region,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
QWidget* parent
|
||||
): memoryRegion(region), RegionItem(region, parent) {
|
||||
): memoryRegion(region), RegionItem(region, memoryDescriptor, parent) {
|
||||
auto formUiFile = QFile(
|
||||
QString::fromStdString(Paths::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
|
||||
@@ -30,11 +33,14 @@ ExcludedRegionItem::ExcludedRegionItem(
|
||||
this->initFormInputs();
|
||||
}
|
||||
|
||||
ExcludedMemoryRegion ExcludedRegionItem::generateExcludedMemoryRegionFromInput() {
|
||||
void ExcludedRegionItem::applyChanges() {
|
||||
this->memoryRegion.name = this->nameInput->text();
|
||||
this->memoryRegion.addressRange.startAddress = this->startAddressInput->text().toUInt(nullptr, 16);
|
||||
this->memoryRegion.addressRange.endAddress = this->endAddressInput->text().toUInt(nullptr, 16);
|
||||
this->memoryRegion.addressRangeType = this->getSelectedAddressType();
|
||||
|
||||
return this->memoryRegion;
|
||||
const auto inputAddressRange = TargetMemoryAddressRange(
|
||||
this->startAddressInput->text().toUInt(nullptr, 16),
|
||||
this->endAddressInput->text().toUInt(nullptr, 16)
|
||||
);
|
||||
this->memoryRegion.addressRangeType = this->getSelectedAddressType();
|
||||
this->memoryRegion.addressRange = this->memoryRegion.addressRangeType == MemoryRegionAddressType::RELATIVE ?
|
||||
this->convertRelativeToAbsoluteAddressRange(inputAddressRange) : inputAddressRange;
|
||||
}
|
||||
|
||||
@@ -10,13 +10,17 @@ namespace Bloom::Widgets
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ExcludedRegionItem(const ExcludedMemoryRegion& region, QWidget *parent);
|
||||
ExcludedRegionItem(
|
||||
const ExcludedMemoryRegion& region,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
QWidget *parent
|
||||
);
|
||||
|
||||
[[nodiscard]] const MemoryRegion& getMemoryRegion() const override {
|
||||
[[nodiscard]] const ExcludedMemoryRegion& getMemoryRegion() const override {
|
||||
return this->memoryRegion;
|
||||
};
|
||||
|
||||
[[nodiscard]] virtual ExcludedMemoryRegion generateExcludedMemoryRegionFromInput();
|
||||
virtual void applyChanges();
|
||||
|
||||
private:
|
||||
ExcludedMemoryRegion memoryRegion;
|
||||
|
||||
@@ -9,10 +9,13 @@
|
||||
using namespace Bloom;
|
||||
using namespace Bloom::Widgets;
|
||||
|
||||
using Targets::TargetMemoryAddressRange;
|
||||
|
||||
FocusedRegionItem::FocusedRegionItem(
|
||||
const FocusedMemoryRegion& region,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
QWidget* parent
|
||||
): memoryRegion(region), RegionItem(region, parent) {
|
||||
): memoryRegion(region), RegionItem(region, memoryDescriptor, parent) {
|
||||
auto formUiFile = QFile(
|
||||
QString::fromStdString(Paths::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane"
|
||||
@@ -30,18 +33,21 @@ FocusedRegionItem::FocusedRegionItem(
|
||||
this->initFormInputs();
|
||||
}
|
||||
|
||||
FocusedMemoryRegion FocusedRegionItem::generateFocusedMemoryRegionFromInput() {
|
||||
void FocusedRegionItem::applyChanges() {
|
||||
this->memoryRegion.name = this->nameInput->text();
|
||||
this->memoryRegion.addressRange.startAddress = this->startAddressInput->text().toUInt(nullptr, 16);
|
||||
this->memoryRegion.addressRange.endAddress = this->endAddressInput->text().toUInt(nullptr, 16);
|
||||
|
||||
const auto inputAddressRange = TargetMemoryAddressRange(
|
||||
this->startAddressInput->text().toUInt(nullptr, 16),
|
||||
this->endAddressInput->text().toUInt(nullptr, 16)
|
||||
);
|
||||
this->memoryRegion.addressRangeType = this->getSelectedAddressType();
|
||||
this->memoryRegion.addressRange = this->memoryRegion.addressRangeType == MemoryRegionAddressType::RELATIVE ?
|
||||
this->convertRelativeToAbsoluteAddressRange(inputAddressRange) : inputAddressRange;
|
||||
|
||||
auto selectedDataTypeOptionName = this->dataTypeInput->currentData().toString();
|
||||
if (FocusedRegionItem::dataTypeOptionsByName.contains(selectedDataTypeOptionName)) {
|
||||
this->memoryRegion.dataType = FocusedRegionItem::dataTypeOptionsByName.at(selectedDataTypeOptionName).dataType;
|
||||
}
|
||||
|
||||
return this->memoryRegion;
|
||||
}
|
||||
|
||||
void FocusedRegionItem::initFormInputs() {
|
||||
|
||||
@@ -19,13 +19,17 @@ namespace Bloom::Widgets
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FocusedRegionItem(const FocusedMemoryRegion& region, QWidget *parent);
|
||||
FocusedRegionItem(
|
||||
const FocusedMemoryRegion& region,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
QWidget *parent
|
||||
);
|
||||
|
||||
[[nodiscard]] const MemoryRegion& getMemoryRegion() const override {
|
||||
[[nodiscard]] const FocusedMemoryRegion& getMemoryRegion() const override {
|
||||
return this->memoryRegion;
|
||||
};
|
||||
|
||||
[[nodiscard]] virtual FocusedMemoryRegion generateFocusedMemoryRegionFromInput();
|
||||
virtual void applyChanges();
|
||||
|
||||
protected:
|
||||
void initFormInputs() override;
|
||||
|
||||
@@ -195,7 +195,7 @@ void MemoryRegionManagerWindow::sortRegionItems() {
|
||||
}
|
||||
|
||||
FocusedRegionItem* MemoryRegionManagerWindow::addFocusedRegion(const FocusedMemoryRegion& region) {
|
||||
auto* focusedRegionItem = new FocusedRegionItem(region, this->regionItemScrollAreaViewport);
|
||||
auto* focusedRegionItem = new FocusedRegionItem(region, this->memoryDescriptor, this->regionItemScrollAreaViewport);
|
||||
this->focusedRegionItems.insert(focusedRegionItem);
|
||||
|
||||
this->regionItemScrollAreaViewportLayout->addWidget(focusedRegionItem);
|
||||
@@ -207,7 +207,7 @@ FocusedRegionItem* MemoryRegionManagerWindow::addFocusedRegion(const FocusedMemo
|
||||
}
|
||||
|
||||
ExcludedRegionItem* MemoryRegionManagerWindow::addExcludedRegion(const ExcludedMemoryRegion& region) {
|
||||
auto* excludedRegionItem = new ExcludedRegionItem(region, this->regionItemScrollAreaViewport);
|
||||
auto* excludedRegionItem = new ExcludedRegionItem(region, this->memoryDescriptor, this->regionItemScrollAreaViewport);
|
||||
this->excludedRegionItems.insert(excludedRegionItem);
|
||||
|
||||
this->regionItemScrollAreaViewportLayout->addWidget(excludedRegionItem);
|
||||
@@ -232,7 +232,6 @@ void MemoryRegionManagerWindow::onNewFocusedRegionTrigger() {
|
||||
|
||||
auto* region = this->addFocusedRegion(FocusedMemoryRegion(
|
||||
"Untitled Region",
|
||||
this->memoryDescriptor,
|
||||
TargetMemoryAddressRange(
|
||||
this->memoryDescriptor.addressRange.startAddress,
|
||||
this->memoryDescriptor.addressRange.startAddress + 10
|
||||
@@ -247,7 +246,6 @@ void MemoryRegionManagerWindow::onNewExcludedRegionTrigger() {
|
||||
|
||||
auto* region = this->addExcludedRegion(ExcludedMemoryRegion(
|
||||
"Untitled Region",
|
||||
this->memoryDescriptor,
|
||||
TargetMemoryAddressRange(
|
||||
this->memoryDescriptor.addressRange.startAddress,
|
||||
this->memoryDescriptor.addressRange.startAddress + 10
|
||||
@@ -315,7 +313,8 @@ void MemoryRegionManagerWindow::applyChanges() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto focusedRegion = focusedRegionItem->generateFocusedMemoryRegionFromInput();
|
||||
focusedRegionItem->applyChanges();
|
||||
const auto& focusedRegion = focusedRegionItem->getMemoryRegion();
|
||||
for (const auto& processedFocusedRegion : processedFocusedMemoryRegions) {
|
||||
if (processedFocusedRegion.intersectsWith(focusedRegion)) {
|
||||
auto* errorDialogue = new ErrorDialogue(
|
||||
@@ -347,7 +346,8 @@ void MemoryRegionManagerWindow::applyChanges() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto excludedRegion = excludedRegionItem->generateExcludedMemoryRegionFromInput();
|
||||
excludedRegionItem->applyChanges();
|
||||
auto excludedRegion = excludedRegionItem->getMemoryRegion();
|
||||
for (const auto& processedFocusedRegion : processedFocusedMemoryRegions) {
|
||||
if (processedFocusedRegion.intersectsWith(excludedRegion)) {
|
||||
auto* errorDialogue = new ErrorDialogue(
|
||||
|
||||
@@ -6,10 +6,13 @@
|
||||
using namespace Bloom;
|
||||
using namespace Bloom::Widgets;
|
||||
|
||||
using Targets::TargetMemoryAddressRange;
|
||||
|
||||
RegionItem::RegionItem(
|
||||
const MemoryRegion& region,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
QWidget* parent
|
||||
): ClickableWidget(parent) {
|
||||
): memoryDescriptor(memoryDescriptor), ClickableWidget(parent) {
|
||||
this->setObjectName("region-item");
|
||||
this->setFixedHeight(50);
|
||||
this->layout->setContentsMargins(5, 5, 5, 0);
|
||||
@@ -25,10 +28,9 @@ RegionItem::RegionItem(
|
||||
this->typeLabel->setText(region.type == MemoryRegionType::FOCUSED ? "Focused" : "Excluded");
|
||||
this->typeLabel->setObjectName("type-label");
|
||||
|
||||
auto addressRange = region.getAbsoluteAddressRange();
|
||||
this->addressRangeLabel->setText(
|
||||
"0x" + QString::number(addressRange.startAddress, 16).toUpper() + QString(" -> ")
|
||||
+ "0x" + QString::number(addressRange.endAddress, 16).toUpper()
|
||||
"0x" + QString::number(region.addressRange.startAddress, 16).toUpper() + QString(" -> ")
|
||||
+ "0x" + QString::number(region.addressRange.endAddress, 16).toUpper()
|
||||
);
|
||||
this->addressRangeLabel->setObjectName("address-label");
|
||||
|
||||
@@ -74,8 +76,6 @@ void RegionItem::setSelected(bool selected) {
|
||||
QStringList RegionItem::getValidationFailures() const {
|
||||
auto validationFailures = QStringList();
|
||||
|
||||
const auto& memoryDescriptor = this->getMemoryRegion().memoryDescriptor;
|
||||
|
||||
if (this->nameInput->text().isEmpty()) {
|
||||
validationFailures.emplace_back("Missing region name.");
|
||||
}
|
||||
@@ -97,28 +97,28 @@ QStringList RegionItem::getValidationFailures() const {
|
||||
}
|
||||
|
||||
auto addressType = this->getSelectedAddressType();
|
||||
const auto memoryAddressRange = memoryDescriptor.addressRange;
|
||||
const auto memoryAddressRange = this->memoryDescriptor.addressRange;
|
||||
|
||||
const auto memoryAddressRangeStr = QString(
|
||||
"0x" + QString::number(memoryAddressRange.startAddress, 16).toUpper() + QString(" -> ")
|
||||
+ "0x" + QString::number(memoryAddressRange.endAddress, 16).toUpper()
|
||||
);
|
||||
|
||||
std::uint32_t absoluteStartAddress = addressType == MemoryRegionAddressType::RELATIVE ?
|
||||
memoryAddressRange.startAddress + startAddress : startAddress;
|
||||
const auto absoluteAddressRange = addressType == MemoryRegionAddressType::RELATIVE ?
|
||||
this->convertRelativeToAbsoluteAddressRange(TargetMemoryAddressRange(startAddress, endAddress))
|
||||
: TargetMemoryAddressRange(startAddress, endAddress);
|
||||
|
||||
std::uint32_t absoluteEndAddress = addressType == MemoryRegionAddressType::RELATIVE ?
|
||||
memoryAddressRange.startAddress + endAddress : endAddress;
|
||||
|
||||
if (absoluteStartAddress < memoryAddressRange.startAddress
|
||||
|| absoluteStartAddress > memoryAddressRange.endAddress
|
||||
if (absoluteAddressRange.startAddress < memoryAddressRange.startAddress
|
||||
|| absoluteAddressRange.startAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
validationFailures.emplace_back(
|
||||
"The start address is not within the absolute memory address range (" + memoryAddressRangeStr + ")."
|
||||
);
|
||||
}
|
||||
|
||||
if (absoluteEndAddress < memoryAddressRange.startAddress || absoluteEndAddress > memoryAddressRange.endAddress) {
|
||||
if (absoluteAddressRange.endAddress < memoryAddressRange.startAddress
|
||||
|| absoluteAddressRange.endAddress > memoryAddressRange.endAddress
|
||||
) {
|
||||
validationFailures.emplace_back(
|
||||
"The end address not within the absolute memory address range (" + memoryAddressRangeStr + ")."
|
||||
);
|
||||
@@ -144,18 +144,17 @@ void RegionItem::initFormInputs() {
|
||||
}
|
||||
|
||||
if (region.addressRangeType == MemoryRegionAddressType::RELATIVE) {
|
||||
auto relativeAddressRange = this->convertAbsoluteToRelativeAddressRange(region.addressRange);
|
||||
this->addressTypeInput->setCurrentText(RegionItem::addressRangeTypeOptionsByName.at("relative").text);
|
||||
|
||||
auto addressRange = region.getRelativeAddressRange();
|
||||
this->startAddressInput->setText("0x" + QString::number(addressRange.startAddress, 16).toUpper());
|
||||
this->endAddressInput->setText("0x" + QString::number(addressRange.endAddress, 16).toUpper());
|
||||
this->startAddressInput->setText("0x" + QString::number(relativeAddressRange.startAddress, 16).toUpper());
|
||||
this->endAddressInput->setText("0x" + QString::number(relativeAddressRange.endAddress, 16).toUpper());
|
||||
|
||||
} else {
|
||||
this->addressTypeInput->setCurrentText(RegionItem::addressRangeTypeOptionsByName.at("absolute").text);
|
||||
|
||||
auto addressRange = region.getAbsoluteAddressRange();
|
||||
this->startAddressInput->setText("0x" + QString::number(addressRange.startAddress, 16).toUpper());
|
||||
this->endAddressInput->setText("0x" + QString::number(addressRange.endAddress, 16).toUpper());
|
||||
this->startAddressInput->setText("0x" + QString::number(region.addressRange.startAddress, 16).toUpper());
|
||||
this->endAddressInput->setText("0x" + QString::number(region.addressRange.endAddress, 16).toUpper());
|
||||
}
|
||||
|
||||
QObject::connect(this->startAddressInput, &QLineEdit::textEdited, this, &RegionItem::onAddressRangeInputChange);
|
||||
@@ -173,6 +172,24 @@ MemoryRegionAddressType RegionItem::getSelectedAddressType() const {
|
||||
return MemoryRegionAddressType::ABSOLUTE;
|
||||
}
|
||||
|
||||
TargetMemoryAddressRange RegionItem::convertAbsoluteToRelativeAddressRange(
|
||||
const TargetMemoryAddressRange& absoluteAddressRange
|
||||
) const {
|
||||
return TargetMemoryAddressRange(
|
||||
absoluteAddressRange.startAddress - this->memoryDescriptor.addressRange.startAddress,
|
||||
absoluteAddressRange.endAddress - this->memoryDescriptor.addressRange.startAddress
|
||||
);
|
||||
}
|
||||
|
||||
TargetMemoryAddressRange RegionItem::convertRelativeToAbsoluteAddressRange(
|
||||
const TargetMemoryAddressRange& relativeAddressRange
|
||||
) const {
|
||||
return TargetMemoryAddressRange(
|
||||
relativeAddressRange.startAddress + this->memoryDescriptor.addressRange.startAddress,
|
||||
relativeAddressRange.endAddress + this->memoryDescriptor.addressRange.startAddress
|
||||
);
|
||||
}
|
||||
|
||||
void RegionItem::onAddressRangeInputChange() {
|
||||
bool startAddressConversionOk = false;
|
||||
bool endAddressConversionOk = false;
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TextInput.hpp"
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemoryRegion.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
{
|
||||
@@ -28,7 +29,11 @@ namespace Bloom::Widgets
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RegionItem(const MemoryRegion& region, QWidget *parent);
|
||||
RegionItem(
|
||||
const MemoryRegion& region,
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
QWidget *parent
|
||||
);
|
||||
void setSelected(bool selected);
|
||||
|
||||
[[nodiscard]] QWidget* getFormWidget() const {
|
||||
@@ -48,6 +53,8 @@ namespace Bloom::Widgets
|
||||
protected:
|
||||
static constexpr int NAME_LABEL_MAX_LENGTH = 34;
|
||||
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor;
|
||||
|
||||
QWidget* formWidget = nullptr;
|
||||
TextInput* nameInput = nullptr;
|
||||
QComboBox* addressTypeInput = nullptr;
|
||||
@@ -58,6 +65,14 @@ namespace Bloom::Widgets
|
||||
virtual void initFormInputs();
|
||||
[[nodiscard]] MemoryRegionAddressType getSelectedAddressType() const;
|
||||
|
||||
Targets::TargetMemoryAddressRange convertAbsoluteToRelativeAddressRange(
|
||||
const Targets::TargetMemoryAddressRange& absoluteAddressRange
|
||||
) const;
|
||||
|
||||
Targets::TargetMemoryAddressRange convertRelativeToAbsoluteAddressRange(
|
||||
const Targets::TargetMemoryAddressRange& relativeAddressRange
|
||||
) const;
|
||||
|
||||
private:
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
QLabel* nameLabel = new QLabel(this);
|
||||
|
||||
@@ -20,7 +20,7 @@ using Bloom::Targets::TargetMemoryType;
|
||||
|
||||
TargetMemoryInspectionPane::TargetMemoryInspectionPane(
|
||||
const TargetMemoryDescriptor& targetMemoryDescriptor,
|
||||
const TargetMemoryInspectionPaneSettings& settings,
|
||||
TargetMemoryInspectionPaneSettings& settings,
|
||||
InsightWorker& insightWorker,
|
||||
PanelWidget* parent
|
||||
):
|
||||
@@ -104,8 +104,8 @@ void TargetMemoryInspectionPane::refreshMemoryValues(std::optional<std::function
|
||||
this->settings.excludedMemoryRegions.begin(),
|
||||
this->settings.excludedMemoryRegions.end(),
|
||||
std::inserter(excludedAddressRanges, excludedAddressRanges.begin()),
|
||||
[] (const ExcludedMemoryRegion& excludedRegion) {
|
||||
return excludedRegion.getAbsoluteAddressRange();
|
||||
[this] (const ExcludedMemoryRegion& excludedRegion) {
|
||||
return excludedRegion.addressRange;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -199,7 +199,7 @@ void TargetMemoryInspectionPane::sanitiseSettings() {
|
||||
this->settings.focusedMemoryRegions.begin(),
|
||||
this->settings.focusedMemoryRegions.end(),
|
||||
[this] (const FocusedMemoryRegion& region) {
|
||||
return region.memoryDescriptor != this->targetMemoryDescriptor;
|
||||
return !this->targetMemoryDescriptor.addressRange.contains(region.addressRange);
|
||||
}
|
||||
),
|
||||
this->settings.focusedMemoryRegions.end()
|
||||
@@ -210,7 +210,7 @@ void TargetMemoryInspectionPane::sanitiseSettings() {
|
||||
this->settings.excludedMemoryRegions.begin(),
|
||||
this->settings.excludedMemoryRegions.end(),
|
||||
[this] (const ExcludedMemoryRegion& region) {
|
||||
return region.memoryDescriptor != this->targetMemoryDescriptor;
|
||||
return !this->targetMemoryDescriptor.addressRange.contains(region.addressRange);
|
||||
}
|
||||
),
|
||||
this->settings.excludedMemoryRegions.end()
|
||||
|
||||
Reference in New Issue
Block a user