Merge pull request #602 from lioncash/lax-addr-box

DolphinWX: Allow short-hand searching in the code window
This commit is contained in:
Dolphin Bot 2014-07-12 00:47:16 +02:00
commit 99d4ab0b71
2 changed files with 27 additions and 12 deletions

View File

@ -195,10 +195,18 @@ void CCodeWindow::OnCodeStep(wxCommandEvent& event)
Parent->UpdateGUI(); Parent->UpdateGUI();
} }
void CCodeWindow::JumpToAddress(u32 _Address) bool CCodeWindow::JumpToAddress(u32 address)
{ {
codeview->Center(_Address); // Jump to anywhere in memory
UpdateLists(); if (address <= 0xFFFFFFFF)
{
codeview->Center(address);
UpdateLists();
return true;
}
return false;
} }
void CCodeWindow::OnCodeViewChange(wxCommandEvent &event) void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
@ -208,20 +216,27 @@ void CCodeWindow::OnCodeViewChange(wxCommandEvent &event)
void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event) void CCodeWindow::OnAddrBoxChange(wxCommandEvent& event)
{ {
if (!GetToolBar()) return; if (!GetToolBar())
return;
wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX); wxTextCtrl* pAddrCtrl = (wxTextCtrl*)GetToolBar()->FindControl(IDM_ADDRBOX);
wxString txt = pAddrCtrl->GetValue(); wxString txt = pAddrCtrl->GetValue().Strip(wxString::stripType::both);
std::string text(WxStrToStr(txt)); bool success = false;
text = StripSpaces(text); unsigned long addr;
if (text.size() == 8) if (txt.ToULong(&addr, 16))
{ {
u32 addr; if (JumpToAddress(addr))
sscanf(text.c_str(), "%08x", &addr); success = true;
JumpToAddress(addr);
} }
if (success)
pAddrCtrl->SetBackgroundColour(wxNullColour);
else
pAddrCtrl->SetBackgroundColour(*wxRED);
pAddrCtrl->Refresh();
event.Skip(); event.Skip();
} }

View File

@ -60,7 +60,7 @@ class CCodeWindow
bool AutomaticStart(); bool AutomaticStart();
bool JITNoBlockCache(); bool JITNoBlockCache();
bool JITBlockLinking(); bool JITBlockLinking();
void JumpToAddress(u32 _Address); bool JumpToAddress(u32 address);
void Update() override; void Update() override;
void NotifyMapLoaded(); void NotifyMapLoaded();