summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-07-10 23:17:38 -0400
committerLioncash <mathew1800@gmail.com>2014-07-11 18:32:32 -0400
commit26f3867e205b132b67fde2d1a28ca39228b41776 (patch)
tree2ed2e9dc0848aa48a4fb7c62a9fd2f5213907c1c /Source/Core/DolphinWX/Debugger/CodeWindow.cpp
parentdc526aa0a639760cccde662366d3890935331f5a (diff)
DolphinWX: Allow short-hand searching in the code window
Lessens the restrictions on the searching in the code view. Now typing out the full 8 digit hex number isn't needed. For example, you don't need to type 000000FF to go to FF, you just literally type FF. Also makes JumpToAddress a boolean function to remain consistent with the DSP code view. This will also change the address search box to have a red background if either an invalid hex number is given, or if it's longer than 8 characters
Diffstat (limited to 'Source/Core/DolphinWX/Debugger/CodeWindow.cpp')
-rw-r--r--Source/Core/DolphinWX/Debugger/CodeWindow.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
index ff9758a8f9..57ec740749 100644
--- a/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
+++ b/Source/Core/DolphinWX/Debugger/CodeWindow.cpp
@@ -195,10 +195,18 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
Parent->UpdateGUI();
}
-void CCodeWindow::JumpToAddress(u32 _Address)
+bool CCodeWindow::JumpToAddress(u32 address)
{
- codeview->Center(_Address);
- UpdateLists();
+ // Jump to anywhere in memory
+ if (address <= 0xFFFFFFFF)
+ {
+ codeview->Center(address);
+ UpdateLists();
+
+ return true;
+ }
+
+ return false;
}
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
@@ -208,20 +216,27 @@ void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
{
- if (!GetToolBar()) return;
+ if (!GetToolBar())
+ return;
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX);
- wxString txt = pAddrCtrl->GetValue();
+ wxString txt = pAddrCtrl->GetValue().Strip(wxString::stripType::both);
- std::string text(WxStrToStr(txt));
- text = StripSpaces(text);
- if (text.size() == 8)
+ bool success = false;
+ unsigned long addr;
+ if (txt.ToULong(&addr, 16))
{
- u32 addr;
- sscanf(text.c_str(), "%08x", &addr);
- JumpToAddress(addr);
+ if (JumpToAddress(addr))
+ success = true;
}
+ if (success)
+ pAddrCtrl->SetBackgroundColour(wxNullColour);
+ else
+ pAddrCtrl->SetBackgroundColour(*wxRED);
+
+ pAddrCtrl->Refresh();
+
event.Skip();
}