diff options
| author | Dentomologist <dentomologist@gmail.com> | 2025-06-29 22:52:24 -0700 |
|---|---|---|
| committer | Dentomologist <dentomologist@gmail.com> | 2025-06-30 00:12:48 -0700 |
| commit | 8f4a0b0e77514bb331dcc3fd97b64064053324f2 (patch) | |
| tree | 20f778cf2f014bb4176d586007fb9e9a09b379e3 /Source/Core | |
| parent | 9a0d4501f8e41f186068ecbc52408d5281223760 (diff) | |
MemoryWidget: Allow 0x prefix when Hex box is checked.
Fix validation failing when the user has checked the Hex box and also
includes a "0x" or "-0x" prefix in their input.
Previously an extra "0x" would be inserted, causing the user's input of
"0x13" to become "0x0x13" which would then fail to validate.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/DolphinQt/Debugger/MemoryWidget.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp index 4c15e92a03..0b0363049c 100644 --- a/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/MemoryWidget.cpp @@ -620,10 +620,17 @@ void MemoryWidget::ValidateAndPreviewInputValue() if (m_base_check->isChecked()) { + // Add 0x to the front of the input (after the '-', if present), but only if the user didn't + // already do so. if (input_text.startsWith(QLatin1Char('-'))) - input_text.insert(1, QStringLiteral("0x")); - else + { + if (!input_text.startsWith(QStringLiteral("-0x"), Qt::CaseInsensitive)) + input_text.insert(1, QStringLiteral("0x")); + } + else if (!input_text.startsWith(QStringLiteral("0x"), Qt::CaseInsensitive)) + { input_text.prepend(QStringLiteral("0x")); + } } QFont font; |
