From 025d9383ac64edd85afc09b3be588c653664bc7c Mon Sep 17 00:00:00 2001 From: container1234 Date: Sat, 13 Jan 2018 16:46:44 +0900 Subject: [PATCH] Use double instead of float for FPRs --- .../Core/DolphinQt2/Debugger/RegisterColumn.cpp | 13 +++++++++++++ Source/Core/DolphinQt2/Debugger/RegisterColumn.h | 5 +++-- .../Core/DolphinQt2/Debugger/RegisterWidget.cpp | 16 +++++++++++++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Source/Core/DolphinQt2/Debugger/RegisterColumn.cpp b/Source/Core/DolphinQt2/Debugger/RegisterColumn.cpp index 7b37fba0dd..5ec0e2597d 100644 --- a/Source/Core/DolphinQt2/Debugger/RegisterColumn.cpp +++ b/Source/Core/DolphinQt2/Debugger/RegisterColumn.cpp @@ -74,6 +74,12 @@ void RegisterColumn::SetValue() std::memcpy(&value, &f, sizeof(u32)); break; } + case RegisterDisplay::Double: + { + double f = text().toDouble(&valid); + std::memcpy(&value, &f, sizeof(u64)); + break; + } } if (!valid) @@ -117,6 +123,13 @@ void RegisterColumn::Update() text = QString::number(tmp); break; } + case RegisterDisplay::Double: + { + double tmp; + std::memcpy(&tmp, &m_value, sizeof(double)); + text = QString::number(tmp); + break; + } } setText(text); diff --git a/Source/Core/DolphinQt2/Debugger/RegisterColumn.h b/Source/Core/DolphinQt2/Debugger/RegisterColumn.h index 54ad54747a..dfc58a41f5 100644 --- a/Source/Core/DolphinQt2/Debugger/RegisterColumn.h +++ b/Source/Core/DolphinQt2/Debugger/RegisterColumn.h @@ -13,7 +13,7 @@ enum class RegisterType { gpr, // General purpose registers, int (r0-r31) - fpr, // General purpose registers, float (f0-f31) + fpr, // Floating point registers, double (f0-f31) ibat, // Instruction BATs (IBAT0-IBAT7) dbat, // Data BATs (DBAT0-DBAT7) tb, // Time base register @@ -40,7 +40,8 @@ enum class RegisterDisplay Hex, SInt32, UInt32, - Float + Float, + Double }; constexpr int DATA_TYPE = Qt::UserRole; diff --git a/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp b/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp index 8b6fa48bfb..53e902cb76 100644 --- a/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp +++ b/Source/Core/DolphinQt2/Debugger/RegisterWidget.cpp @@ -131,8 +131,9 @@ void RegisterWidget::ShowContextMenu() auto* view_int = menu->addAction(tr("Signed Integer")); auto* view_uint = menu->addAction(tr("Unsigned Integer")); auto* view_float = menu->addAction(tr("Float")); + auto* view_double = menu->addAction(tr("Double")); - for (auto* action : {view_hex, view_int, view_uint, view_float}) + for (auto* action : {view_hex, view_int, view_uint, view_float, view_double}) { action->setCheckable(true); action->setVisible(false); @@ -153,6 +154,9 @@ void RegisterWidget::ShowContextMenu() case RegisterDisplay::Float: view_float->setChecked(true); break; + case RegisterDisplay::Double: + view_double->setChecked(true); + break; } switch (type) @@ -165,7 +169,7 @@ void RegisterWidget::ShowContextMenu() break; case RegisterType::fpr: view_hex->setVisible(true); - view_float->setVisible(true); + view_double->setVisible(true); break; default: break; @@ -195,6 +199,12 @@ void RegisterWidget::ShowContextMenu() m_updating = false; }); + connect(view_double, &QAction::triggered, [this, item] { + m_updating = true; + item->SetDisplay(RegisterDisplay::Double); + m_updating = false; + }); + menu->addSeparator(); } } @@ -212,7 +222,7 @@ void RegisterWidget::PopulateTable() AddRegister(i, 0, RegisterType::gpr, "r" + std::to_string(i), [i] { return GPR(i); }, [i](u64 value) { GPR(i) = value; }); - // General purpose registers (float) + // Floating point registers (double) AddRegister(i, 2, RegisterType::fpr, "f" + std::to_string(i), [i] { return riPS0(i); }, [i](u64 value) { riPS0(i) = value; });