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