Make SetPatch responsible for overwriting old patches
This commit is contained in:
parent
2594447c25
commit
e2f4400f49
|
@ -32,6 +32,7 @@ void MemoryPatches::SetPatch(u32 address, u32 value)
|
|||
|
||||
void MemoryPatches::SetPatch(u32 address, std::vector<u8> value)
|
||||
{
|
||||
UnsetPatch(address);
|
||||
const std::size_t index = m_patches.size();
|
||||
m_patches.emplace_back(address, std::move(value));
|
||||
Patch(index);
|
||||
|
@ -45,7 +46,7 @@ const std::vector<MemoryPatch>& MemoryPatches::GetPatches() const
|
|||
void MemoryPatches::UnsetPatch(u32 address)
|
||||
{
|
||||
const auto it = std::find_if(m_patches.begin(), m_patches.end(),
|
||||
[address](const auto& patch) { return patch.address == address; });
|
||||
[address](const auto& patch) { return patch.address == address; });
|
||||
|
||||
if (it == m_patches.end())
|
||||
return;
|
||||
|
|
|
@ -513,7 +513,6 @@ void CodeViewWidget::SetAddress(u32 address, SetAddressUpdate update)
|
|||
|
||||
void CodeViewWidget::ReplaceAddress(u32 address, ReplaceWith replace)
|
||||
{
|
||||
PowerPC::debug_interface.UnsetPatch(address);
|
||||
PowerPC::debug_interface.SetPatch(address, replace == ReplaceWith::BLR ? 0x4e800020 : 0x60000000);
|
||||
Update();
|
||||
}
|
||||
|
@ -823,7 +822,6 @@ void CodeViewWidget::OnReplaceInstruction()
|
|||
|
||||
if (dialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
PowerPC::debug_interface.UnsetPatch(addr);
|
||||
PowerPC::debug_interface.SetPatch(addr, dialog.GetCode());
|
||||
Update();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue