diff options
| author | Anthony <Helios747@users.noreply.github.com> | 2019-11-27 15:57:54 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-27 15:57:54 -0800 |
| commit | 66ca83e6af394b9c9a53f4e292b3cd3c06e97f03 (patch) | |
| tree | 583a4bc6067a855ae4458615c95653e935e8766a /Source/Core/DolphinQt/Debugger/MemoryWidget.cpp | |
| parent | 41563aed21a26c7147f99a993d5de95e0a96c6e7 (diff) | |
| parent | 5b6e7aabcff8e96872bfbb9206cd251697fbddb1 (diff) | |
Merge pull request #8479 from nokturnusmf/master
Fixed #11874 (leading 0s ignored by debugger)
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/MemoryWidget.cpp')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/MemoryWidget.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp index 6de34ebab6..d76e6b0b5a 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp @@ -488,12 +488,15 @@ void MemoryWidget::OnSetValue() const QByteArray bytes = m_data_edit->text().toUtf8(); for (char c : bytes) - accessors->WriteU8(static_cast<u8>(c), addr++); + accessors->WriteU8(addr++, static_cast<u8>(c)); } else { bool good_value; - u64 value = m_data_edit->text().toULongLong(&good_value, 16); + const QString text = m_data_edit->text(); + const int length = + text.startsWith(QStringLiteral("0x"), Qt::CaseInsensitive) ? text.size() - 2 : text.size(); + const u64 value = text.toULongLong(&good_value, 16); if (!good_value) { @@ -501,15 +504,15 @@ void MemoryWidget::OnSetValue() return; } - if (value == static_cast<u8>(value)) + if (length <= 2) { accessors->WriteU8(addr, static_cast<u8>(value)); } - else if (value == static_cast<u16>(value)) + else if (length <= 4) { accessors->WriteU16(addr, static_cast<u16>(value)); } - else if (value == static_cast<u32>(value)) + else if (length <= 8) { accessors->WriteU32(addr, static_cast<u32>(value)); } |
