DolphinQt: add lock state to WatchWidget
This commit is contained in:
parent
8f3e8e4ca3
commit
7d7fcdddd3
|
@ -158,11 +158,11 @@ void WatchWidget::Update()
|
||||||
// i18n: Data type used in computing
|
// i18n: Data type used in computing
|
||||||
tr("String"),
|
tr("String"),
|
||||||
// i18n: Floating-point (non-integer) number
|
// i18n: Floating-point (non-integer) number
|
||||||
tr("Float")});
|
tr("Float"), tr("Locked")});
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
auto entry = PowerPC::debug_interface.GetWatch(i);
|
const auto& entry = PowerPC::debug_interface.GetWatch(i);
|
||||||
|
|
||||||
auto* label = new QTableWidgetItem(QString::fromStdString(entry.name));
|
auto* label = new QTableWidgetItem(QString::fromStdString(entry.name));
|
||||||
auto* address =
|
auto* address =
|
||||||
|
@ -172,8 +172,11 @@ void WatchWidget::Update()
|
||||||
auto* string = new QTableWidgetItem;
|
auto* string = new QTableWidgetItem;
|
||||||
auto* floatValue = new QTableWidgetItem;
|
auto* floatValue = new QTableWidgetItem;
|
||||||
|
|
||||||
std::array<QTableWidgetItem*, NUM_COLUMNS> items = {label, address, hex,
|
auto* lockValue = new QTableWidgetItem;
|
||||||
decimal, string, floatValue};
|
lockValue->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
|
||||||
|
|
||||||
|
std::array<QTableWidgetItem*, NUM_COLUMNS> items = {label, address, hex, decimal,
|
||||||
|
string, floatValue, lockValue};
|
||||||
|
|
||||||
QBrush brush = QPalette().brush(QPalette::Text);
|
QBrush brush = QPalette().brush(QPalette::Text);
|
||||||
|
|
||||||
|
@ -189,6 +192,7 @@ void WatchWidget::Update()
|
||||||
decimal->setText(QString::number(PowerPC::HostRead_U32(entry.address)));
|
decimal->setText(QString::number(PowerPC::HostRead_U32(entry.address)));
|
||||||
string->setText(QString::fromStdString(PowerPC::HostGetString(entry.address, 32)));
|
string->setText(QString::fromStdString(PowerPC::HostGetString(entry.address, 32)));
|
||||||
floatValue->setText(QString::number(PowerPC::HostRead_F32(entry.address)));
|
floatValue->setText(QString::number(PowerPC::HostRead_F32(entry.address)));
|
||||||
|
lockValue->setCheckState(entry.locked ? Qt::Checked : Qt::Unchecked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +284,10 @@ void WatchWidget::OnLoad()
|
||||||
|
|
||||||
if (ini.GetLines("Watches", &watches, false))
|
if (ini.GetLines("Watches", &watches, false))
|
||||||
{
|
{
|
||||||
|
for (const auto& watch : PowerPC::debug_interface.GetWatches())
|
||||||
|
{
|
||||||
|
PowerPC::debug_interface.UnsetPatch(watch.address);
|
||||||
|
}
|
||||||
PowerPC::debug_interface.ClearWatches();
|
PowerPC::debug_interface.ClearWatches();
|
||||||
PowerPC::debug_interface.LoadWatchesFromStrings(watches);
|
PowerPC::debug_interface.LoadWatchesFromStrings(watches);
|
||||||
}
|
}
|
||||||
|
@ -367,9 +375,17 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item)
|
||||||
if (good)
|
if (good)
|
||||||
{
|
{
|
||||||
if (column == COLUMN_INDEX_ADDRESS)
|
if (column == COLUMN_INDEX_ADDRESS)
|
||||||
|
{
|
||||||
|
const auto& watch = PowerPC::debug_interface.GetWatch(row);
|
||||||
|
PowerPC::debug_interface.UnsetPatch(watch.address);
|
||||||
PowerPC::debug_interface.UpdateWatchAddress(row, value);
|
PowerPC::debug_interface.UpdateWatchAddress(row, value);
|
||||||
|
if (watch.locked)
|
||||||
|
LockWatchAddress(value);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
PowerPC::HostWrite_U32(value, PowerPC::debug_interface.GetWatch(row).address);
|
PowerPC::HostWrite_U32(value, PowerPC::debug_interface.GetWatch(row).address);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -377,14 +393,38 @@ void WatchWidget::OnItemChanged(QTableWidgetItem* item)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case COLUMN_INDEX_LOCK:
|
||||||
|
{
|
||||||
|
PowerPC::debug_interface.UpdateWatchLockedState(row, item->checkState() == Qt::Checked);
|
||||||
|
const auto& watch = PowerPC::debug_interface.GetWatch(row);
|
||||||
|
if (watch.locked)
|
||||||
|
LockWatchAddress(watch.address);
|
||||||
|
else
|
||||||
|
PowerPC::debug_interface.UnsetPatch(watch.address);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WatchWidget::LockWatchAddress(u32 address)
|
||||||
|
{
|
||||||
|
const std::string memory_data_as_string = PowerPC::HostGetString(address, 4);
|
||||||
|
|
||||||
|
std::vector<u8> bytes;
|
||||||
|
for (const char c : memory_data_as_string)
|
||||||
|
{
|
||||||
|
bytes.push_back(static_cast<u8>(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
PowerPC::debug_interface.SetFramePatch(address, bytes);
|
||||||
|
}
|
||||||
|
|
||||||
void WatchWidget::DeleteWatch(int row)
|
void WatchWidget::DeleteWatch(int row)
|
||||||
{
|
{
|
||||||
|
PowerPC::debug_interface.UnsetPatch(PowerPC::debug_interface.GetWatch(row).address);
|
||||||
PowerPC::debug_interface.RemoveWatch(row);
|
PowerPC::debug_interface.RemoveWatch(row);
|
||||||
Update();
|
Update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ private:
|
||||||
|
|
||||||
void ShowContextMenu();
|
void ShowContextMenu();
|
||||||
void OnItemChanged(QTableWidgetItem* item);
|
void OnItemChanged(QTableWidgetItem* item);
|
||||||
|
void LockWatchAddress(u32 address);
|
||||||
void DeleteWatch(int row);
|
void DeleteWatch(int row);
|
||||||
void AddWatchBreakpoint(int row);
|
void AddWatchBreakpoint(int row);
|
||||||
void ShowInMemory(int row);
|
void ShowInMemory(int row);
|
||||||
|
@ -61,11 +62,12 @@ private:
|
||||||
|
|
||||||
bool m_updating = false;
|
bool m_updating = false;
|
||||||
|
|
||||||
static constexpr int NUM_COLUMNS = 6;
|
static constexpr int NUM_COLUMNS = 7;
|
||||||
static constexpr int COLUMN_INDEX_LABEL = 0;
|
static constexpr int COLUMN_INDEX_LABEL = 0;
|
||||||
static constexpr int COLUMN_INDEX_ADDRESS = 1;
|
static constexpr int COLUMN_INDEX_ADDRESS = 1;
|
||||||
static constexpr int COLUMN_INDEX_HEX = 2;
|
static constexpr int COLUMN_INDEX_HEX = 2;
|
||||||
static constexpr int COLUMN_INDEX_DECIMAL = 3;
|
static constexpr int COLUMN_INDEX_DECIMAL = 3;
|
||||||
static constexpr int COLUMN_INDEX_STRING = 4;
|
static constexpr int COLUMN_INDEX_STRING = 4;
|
||||||
static constexpr int COLUMN_INDEX_FLOAT = 5;
|
static constexpr int COLUMN_INDEX_FLOAT = 5;
|
||||||
|
static constexpr int COLUMN_INDEX_LOCK = 6;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue