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