Skip to content

Commit d252466

Browse files
authored
Merge pull request #193 from not-chciken/dev-niko
Adding processor breakpoint enable/disable button.
2 parents 31ba67e + 8978329 commit d252466

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

platforms/desktop-shared/gui_debug.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,24 @@ static void debug_window_disassembler(void)
324324
if (!IsValidPointer((*breakpoints_cpu)[b]))
325325
continue;
326326

327-
ImGui::PushID(b);
327+
ImGui::PushID(2 * b);
328328
if (ImGui::SmallButton("X"))
329329
{
330330
remove = b;
331331
ImGui::PopID();
332332
continue;
333333
}
334+
ImGui::PopID();
335+
336+
ImGui::SameLine();
334337

338+
ImGui::PushID(2 * b + 1);
339+
ImGui::PushStyleColor(ImGuiCol_Button, !(*breakpoints_cpu)[b]->disabled ? green : ImGui::GetStyle().Colors[ImGuiCol_Button]);
340+
if (ImGui::SmallButton("E"))
341+
{
342+
(*breakpoints_cpu)[b]->disabled = !(*breakpoints_cpu)[b]->disabled;
343+
}
344+
ImGui::PopStyleColor(1);
335345
ImGui::PopID();
336346

337347
ImGui::PushFont(gui_default_font);
@@ -1882,6 +1892,7 @@ static void add_breakpoint_cpu(void)
18821892
map[target_offset]->size = 0;
18831893
map[target_offset]->jump = false;
18841894
map[target_offset]->jump_address = 0;
1895+
map[target_offset]->disabled = false;
18851896
for (int i = 0; i < 4; i++)
18861897
map[target_offset]->opcodes[i] = 0;
18871898
}

src/Memory.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class Memory
4242
u8 opcodes[4];
4343
bool jump;
4444
u16 jump_address;
45+
bool disabled;
4546
};
4647

4748
struct stMemoryBreakpoint

src/Processor.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ bool Processor::Disassemble(u16 address)
484484
map[offset]->size = 0;
485485
map[offset]->jump = false;
486486
map[offset]->jump_address = 0;
487+
map[offset]->disabled = false;
487488
for (int i = 0; i < 4; i++)
488489
map[offset]->opcodes[i] = 0;
489490
}
@@ -587,7 +588,7 @@ bool Processor::Disassemble(u16 address)
587588

588589
for (std::size_t b = 0; b < size; b++)
589590
{
590-
if ((*breakpoints)[b] == map[offset])
591+
if (((*breakpoints)[b] == map[offset]) && !(*breakpoints)[b]->disabled)
591592
{
592593
return true;
593594
}

0 commit comments

Comments
 (0)