2013-04-18 03:43:35 +00:00
|
|
|
// Copyright 2013 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2014-02-22 22:36:30 +00:00
|
|
|
#include <string>
|
|
|
|
#include <wx/chartype.h>
|
|
|
|
#include <wx/defs.h>
|
|
|
|
#include <wx/dialog.h>
|
|
|
|
#include <wx/event.h>
|
|
|
|
#include <wx/gdicmn.h>
|
|
|
|
#include <wx/sizer.h>
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/textctrl.h>
|
|
|
|
|
|
|
|
#include "Common/BreakPoints.h"
|
|
|
|
#include "Common/Common.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "Common/StringUtil.h"
|
|
|
|
#include "Core/PowerPC/PowerPC.h"
|
2014-02-19 01:56:29 +00:00
|
|
|
#include "DolphinWX/WxUtils.h"
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "DolphinWX/Debugger/BreakpointDlg.h"
|
|
|
|
#include "DolphinWX/Debugger/BreakpointWindow.h"
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2011-02-27 23:03:08 +00:00
|
|
|
BEGIN_EVENT_TABLE(BreakPointDlg, wxDialog)
|
|
|
|
EVT_BUTTON(wxID_OK, BreakPointDlg::OnOK)
|
2008-12-08 05:30:24 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
2011-02-27 23:03:08 +00:00
|
|
|
BreakPointDlg::BreakPointDlg(CBreakPointWindow *_Parent)
|
2014-05-17 17:17:28 +00:00
|
|
|
: wxDialog(_Parent, wxID_ANY, _("Add Breakpoint"))
|
2011-02-27 23:03:08 +00:00
|
|
|
, Parent(_Parent)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2014-05-17 17:17:28 +00:00
|
|
|
m_pEditAddress = new wxTextCtrl(this, wxID_ANY, "80000000");
|
2011-02-27 23:03:08 +00:00
|
|
|
|
|
|
|
wxBoxSizer *sMainSizer = new wxBoxSizer(wxVERTICAL);
|
|
|
|
sMainSizer->Add(m_pEditAddress, 0, wxEXPAND | wxALL, 5);
|
2011-03-17 04:26:01 +00:00
|
|
|
sMainSizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALL, 5);
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2011-03-17 04:26:01 +00:00
|
|
|
SetSizerAndFit(sMainSizer);
|
|
|
|
SetFocus();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
|
|
|
|
2011-03-17 04:26:01 +00:00
|
|
|
void BreakPointDlg::OnOK(wxCommandEvent& event)
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
|
|
|
wxString AddressString = m_pEditAddress->GetLineText(0);
|
|
|
|
u32 Address = 0;
|
2014-03-12 19:33:41 +00:00
|
|
|
if (AsciiToHex(WxStrToStr(AddressString), Address))
|
2008-12-08 05:30:24 +00:00
|
|
|
{
|
2009-06-28 11:47:39 +00:00
|
|
|
PowerPC::breakpoints.Add(Address);
|
2009-08-27 11:08:52 +00:00
|
|
|
Parent->NotifyUpdate();
|
2013-04-08 05:16:50 +00:00
|
|
|
Close();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|
2011-02-27 23:03:08 +00:00
|
|
|
else
|
2013-04-08 05:16:50 +00:00
|
|
|
{
|
2014-05-17 17:17:28 +00:00
|
|
|
PanicAlertT("The address %s is invalid.", WxStrToStr(AddressString).c_str());
|
2013-04-08 05:16:50 +00:00
|
|
|
}
|
2008-12-08 05:30:24 +00:00
|
|
|
|
2011-03-17 04:26:01 +00:00
|
|
|
event.Skip();
|
2008-12-08 05:30:24 +00:00
|
|
|
}
|