| 1040 | } |
| 1041 | |
| 1042 | void DisassemblyView::setInstructions(u32 start, u32 end, u32 value) |
| 1043 | { |
| 1044 | const u32 count = (end - start) / 4 + 1; |
| 1045 | |
| 1046 | const QPointer<DisassemblyView> view(this); |
| 1047 | Host::RunOnCPUThread([view, start, count, cpu = &cpu(), value] { |
| 1048 | std::vector<u32> original_instructions; |
| 1049 | original_instructions.reserve(count); |
| 1050 | for (u32 i = 0; i < count; i++) |
| 1051 | { |
| 1052 | const u32 address = start + i * 4; |
| 1053 | original_instructions.emplace_back(cpu->Read32(address)); |
| 1054 | cpu->Write32(address, value); |
| 1055 | } |
| 1056 | |
| 1057 | QtHost::RunOnUIThread([view, start, count, original_instructions = std::move(original_instructions)]() { |
| 1058 | if (!view) |
| 1059 | return; |
| 1060 | |
| 1061 | for (u32 i = 0; i < count; i++) |
| 1062 | { |
| 1063 | const u32 address = start + i * 4; |
| 1064 | view->m_nopedInstructions.emplace(address, original_instructions[i]); |
| 1065 | } |
| 1066 | |
| 1067 | DebuggerView::broadcastEvent(DebuggerEvents::VMUpdate()); |
| 1068 | }); |
| 1069 | }); |
| 1070 | } |
| 1071 | |
| 1072 | bool DisassemblyView::AddressCanRestore(u32 start, u32 end) |
| 1073 | { |