2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

disassembler: Get rid of a const_cast

This commit is contained in:
Lioncash 2015-03-30 15:37:34 -04:00
parent c4767f3bb2
commit e05d6220f5
3 changed files with 5 additions and 8 deletions

View file

@ -232,11 +232,8 @@ void DisassemblerWidget::OnDebugModeEntered()
{ {
ARMword next_instr = Core::g_app_core->GetPC(); ARMword next_instr = Core::g_app_core->GetPC();
// TODO: Make BreakPoints less crappy (i.e. const-correct) so that this doesn't need a const_cast. if (model->GetBreakPoints().IsAddressBreakPoint(next_instr))
if (const_cast<BreakPoints&>(model->GetBreakPoints()).IsAddressBreakPoint(next_instr))
{
emu_thread.SetCpuRunning(false); emu_thread.SetCpuRunning(false);
}
model->SetNextInstruction(next_instr); model->SetNextInstruction(next_instr);

View file

@ -10,14 +10,14 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
bool BreakPoints::IsAddressBreakPoint(u32 iAddress) bool BreakPoints::IsAddressBreakPoint(u32 iAddress) const
{ {
auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; }; auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress; };
auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond);
return it != m_BreakPoints.end(); return it != m_BreakPoints.end();
} }
bool BreakPoints::IsTempBreakPoint(u32 iAddress) bool BreakPoints::IsTempBreakPoint(u32 iAddress) const
{ {
auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress && bp.bTemporary; }; auto cond = [&iAddress](const TBreakPoint& bp) { return bp.iAddress == iAddress && bp.bTemporary; };
auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond); auto it = std::find_if(m_BreakPoints.begin(), m_BreakPoints.end(), cond);

View file

@ -56,8 +56,8 @@ public:
void AddFromStrings(const TBreakPointsStr& bps); void AddFromStrings(const TBreakPointsStr& bps);
// is address breakpoint // is address breakpoint
bool IsAddressBreakPoint(u32 iAddress); bool IsAddressBreakPoint(u32 iAddress) const;
bool IsTempBreakPoint(u32 iAddress); bool IsTempBreakPoint(u32 iAddress) const;
// Add BreakPoint // Add BreakPoint
void Add(u32 em_address, bool temp=false); void Add(u32 em_address, bool temp=false);