Skip to content

Commit 45675f1

Browse files
authored
Merge pull request #1862 from mziab/memoryeditor-focus
Make clicks in assembly view open the memory editor
2 parents c00e57f + 719a97e commit 45675f1

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

src/core/system.h

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ struct JumpToMemory {
8989
uint32_t address;
9090
unsigned size;
9191
unsigned editorNum;
92-
bool forceShowEditor;
9392
};
9493
struct SelectClut {
9594
unsigned x, y;

src/gui/gui.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,6 @@ void PCSX::GUI::init(std::function<void()> applyArguments) {
834834
const uint32_t real = event.address & 0x7fffff;
835835
const uint32_t size = event.size;
836836
const uint32_t editorNum = event.editorNum;
837-
const bool forceShowEditor = event.forceShowEditor;
838837
auto changeDataType = [](MemoryEditor* editor, int size) {
839838
bool isSigned = false;
840839
switch (editor->PreviewDataType) {
@@ -859,13 +858,13 @@ void PCSX::GUI::init(std::function<void()> applyArguments) {
859858
};
860859
if ((base == 0x000) || (base == 0x800) || (base == 0xa00)) {
861860
if (real < 0x00800000) {
862-
if (forceShowEditor) m_mainMemEditors[editorNum].m_show = true;
861+
m_mainMemEditors[editorNum].m_show = true;
863862
m_mainMemEditors[editorNum].editor.GotoAddrAndHighlight(real, real + size);
864863
changeDataType(&m_mainMemEditors[editorNum].editor, size);
865864
}
866865
} else if (base == 0x1f8) {
867866
if (real >= 0x1000 && real < 0x3000) {
868-
if (forceShowEditor) m_hwrEditor.m_show = true;
867+
m_hwrEditor.m_show = true;
869868
m_hwrEditor.editor.GotoAddrAndHighlight(real - 0x1000, real - 0x1000 + size);
870869
changeDataType(&m_hwrEditor.editor, size);
871870
}

src/gui/widgets/assembly.cc

+9-10
Original file line numberDiff line numberDiff line change
@@ -326,19 +326,18 @@ const uint8_t* PCSX::Widgets::Assembly::ptr(uint32_t addr) {
326326
return dummy;
327327
}
328328
}
329-
void PCSX::Widgets::Assembly::jumpToMemory(uint32_t addr, unsigned size, unsigned editorIndex /* = 0*/,
330-
bool forceShowEditor /* = false*/) {
331-
g_system->m_eventBus->signal(PCSX::Events::GUI::JumpToMemory{addr, size, editorIndex, forceShowEditor});
329+
void PCSX::Widgets::Assembly::jumpToMemory(uint32_t addr, unsigned size, unsigned editorIndex /* = 0*/) {
330+
g_system->m_eventBus->signal(PCSX::Events::GUI::JumpToMemory{addr, size, editorIndex});
332331
}
333332
void PCSX::Widgets::Assembly::addMemoryEditorContext(uint32_t addr, int size) {
334333
if (ImGui::BeginPopupContextItem()) {
335-
if (ImGui::MenuItem(_("Go to in Memory Editor #1 (Default Click)"))) jumpToMemory(addr, size, 0, true);
336-
if (ImGui::MenuItem(_("Go to in Memory Editor #2 (Shift+Click)"))) jumpToMemory(addr, size, 1, true);
337-
if (ImGui::MenuItem(_("Go to in Memory Editor #3 (Ctrl+Click)"))) jumpToMemory(addr, size, 2, true);
334+
if (ImGui::MenuItem(_("Go to in Memory Editor #1 (Default Click)"))) jumpToMemory(addr, size, 0);
335+
if (ImGui::MenuItem(_("Go to in Memory Editor #2 (Shift+Click)"))) jumpToMemory(addr, size, 1);
336+
if (ImGui::MenuItem(_("Go to in Memory Editor #3 (Ctrl+Click)"))) jumpToMemory(addr, size, 2);
338337
std::string itemLabel;
339338
for (unsigned i = 3; i < 8; ++i) {
340339
itemLabel = fmt::format(f_("Go to in Memory Editor #{}"), i + 1);
341-
if (ImGui::MenuItem(itemLabel.c_str())) jumpToMemory(addr, size, i, true);
340+
if (ImGui::MenuItem(itemLabel.c_str())) jumpToMemory(addr, size, i);
342341
}
343342
if (ImGui::MenuItem(_("Create Memory Read Breakpoint"))) {
344343
g_emulator->m_debug->addBreakpoint(addr, Debug::BreakpointType::Read, size, _("GUI"));
@@ -354,7 +353,7 @@ void PCSX::Widgets::Assembly::addMemoryEditorSubMenu(uint32_t addr, int size) {
354353
std::string itemLabel;
355354
for (unsigned i = 0; i < 8; ++i) {
356355
itemLabel = fmt::format("#{}", i + 1);
357-
if (ImGui::MenuItem(itemLabel.c_str())) jumpToMemory(addr, size, i, true);
356+
if (ImGui::MenuItem(itemLabel.c_str())) jumpToMemory(addr, size, i);
358357
}
359358
ImGui::EndMenu();
360359
}
@@ -381,7 +380,7 @@ void PCSX::Widgets::Assembly::OfB(int16_t offset, uint8_t reg, int size) {
381380
ImGui::TextUnformatted(" ");
382381
ImGui::SameLine(0.0f, 0.0f);
383382
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
384-
if (ImGui::Button(label)) jumpToMemory(addr, size, targetEditorIndex, false);
383+
if (ImGui::Button(label)) jumpToMemory(addr, size, targetEditorIndex);
385384
ImGui::PopStyleVar();
386385
addMemoryEditorContext(addr, size);
387386
if (ImGui::IsItemHovered()) {
@@ -442,7 +441,7 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
442441
ImGui::TextUnformatted(" ");
443442
sameLine();
444443
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
445-
if (ImGui::Button(longLabel.c_str())) jumpToMemory(addr, size, targetEditorIndex, false);
444+
if (ImGui::Button(longLabel.c_str())) jumpToMemory(addr, size, targetEditorIndex);
446445
ImGui::PopStyleVar();
447446
addMemoryEditorContext(addr, size);
448447
if (ImGui::IsItemHovered()) {

src/gui/widgets/assembly.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class Assembly : private Disasm {
7272
void sameLine();
7373
void comma();
7474
const uint8_t* ptr(uint32_t addr);
75-
void jumpToMemory(uint32_t addr, unsigned size, unsigned editorIndex = 0, bool forceShowEditor = false);
75+
void jumpToMemory(uint32_t addr, unsigned size, unsigned editorIndex = 0);
7676
uint8_t mem8(uint32_t addr);
7777
uint16_t mem16(uint32_t addr);
7878
uint32_t mem32(uint32_t addr);

src/gui/widgets/breakpoints.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void PCSX::Widgets::Breakpoints::draw(const char* title) {
122122
g_system->m_eventBus->signal(PCSX::Events::GUI::JumpToPC{bp->address() | bp->base()});
123123
} else {
124124
g_system->m_eventBus->signal(
125-
PCSX::Events::GUI::JumpToMemory{bp->address() | bp->base(), bp->width(), 0, true});
125+
PCSX::Events::GUI::JumpToMemory{bp->address() | bp->base(), bp->width(), 0});
126126
}
127127
}
128128
if (ImGui::BeginPopupContextItem()) {

0 commit comments

Comments
 (0)