@@ -325,8 +325,32 @@ const uint8_t* PCSX::Widgets::Assembly::ptr(uint32_t addr) {
325
325
return dummy;
326
326
}
327
327
}
328
- void PCSX::Widgets::Assembly::jumpToMemory (uint32_t addr, unsigned size) {
329
- g_system->m_eventBus ->signal (PCSX::Events::GUI::JumpToMemory{addr, size});
328
+ void PCSX::Widgets::Assembly::jumpToMemory (uint32_t addr, unsigned size, unsigned editorIndex /* = 0*/ ,
329
+ bool forceShowEditor /* = false*/ ) {
330
+ g_system->m_eventBus ->signal (PCSX::Events::GUI::JumpToMemory{addr, size, editorIndex, forceShowEditor});
331
+ }
332
+ void PCSX::Widgets::Assembly::addMemoryEditorContext (uint32_t addr, int size) {
333
+ if (ImGui::BeginPopupContextItem ()) {
334
+ if (ImGui::MenuItem (_ (" Go to in Memory Editor #1 (Default Click)" ))) jumpToMemory (addr, size, 0 , true );
335
+ if (ImGui::MenuItem (_ (" Go to in Memory Editor #2 (Shift+Click)" ))) jumpToMemory (addr, size, 1 , true );
336
+ if (ImGui::MenuItem (_ (" Go to in Memory Editor #3 (Ctrl+Click)" ))) jumpToMemory (addr, size, 2 , true );
337
+ std::string itemLabel;
338
+ for (unsigned i = 3 ; i < 8 ; ++i) {
339
+ itemLabel = fmt::format (f_ (" Go to in Memory Editor #{}" ), i + 1 );
340
+ if (ImGui::MenuItem (itemLabel.c_str ())) jumpToMemory (addr, size, i, true );
341
+ }
342
+ ImGui::EndPopup ();
343
+ }
344
+ }
345
+ void PCSX::Widgets::Assembly::addMemoryEditorSubMenu (uint32_t addr, int size) {
346
+ if (ImGui::BeginMenu (_ (" Go to in Memory Editor..." ))) {
347
+ std::string itemLabel;
348
+ for (unsigned i = 0 ; i < 8 ; ++i) {
349
+ itemLabel = fmt::format (" #{}" , i + 1 );
350
+ if (ImGui::MenuItem (itemLabel.c_str ())) jumpToMemory (addr, size, i, true );
351
+ }
352
+ ImGui::EndMenu ();
353
+ }
330
354
}
331
355
332
356
void PCSX::Widgets::Assembly::OfB (int16_t offset, uint8_t reg, int size) {
@@ -344,11 +368,15 @@ void PCSX::Widgets::Assembly::OfB(int16_t offset, uint8_t reg, int size) {
344
368
auto symbols = findSymbol (addr);
345
369
if (symbols.size () != 0 ) longLabel = *symbols.begin () + " ; " ;
346
370
371
+ const auto & io = ImGui::GetIO ();
372
+ unsigned targetEditorIndex = io.KeyShift ? 1 : (io.KeyCtrl ? 2 : 0 );
373
+
347
374
ImGui::TextUnformatted (" " );
348
375
ImGui::SameLine (0 .0f , 0 .0f );
349
376
ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 (0 , 0 ));
350
- if (ImGui::Button (label)) jumpToMemory (addr, size);
377
+ if (ImGui::Button (label)) jumpToMemory (addr, size, targetEditorIndex, false );
351
378
ImGui::PopStyleVar ();
379
+ addMemoryEditorContext (addr, size);
352
380
if (ImGui::IsItemHovered ()) {
353
381
ImGui::BeginTooltip ();
354
382
ImGui::PushTextWrapPos (ImGui::GetFontSize () * 35 .0f );
@@ -363,6 +391,7 @@ void PCSX::Widgets::Assembly::OfB(int16_t offset, uint8_t reg, int size) {
363
391
ImGui::Text (" %s[%8.8x] = %8.8x" , longLabel.c_str (), addr, mem32 (addr));
364
392
break ;
365
393
}
394
+ ImGui::Text (_ (" Go to in Memory Editor #%d" ), targetEditorIndex + 1 );
366
395
ImGui::PopTextWrapPos ();
367
396
ImGui::EndTooltip ();
368
397
}
@@ -399,11 +428,16 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
399
428
std::string longLabel = label;
400
429
auto symbols = findSymbol (addr);
401
430
if (symbols.size () != 0 ) longLabel = *symbols.begin () + " ;" + label;
431
+
432
+ const auto & io = ImGui::GetIO ();
433
+ unsigned targetEditorIndex = io.KeyShift ? 1 : (io.KeyCtrl ? 2 : 0 );
434
+
402
435
ImGui::TextUnformatted (" " );
403
436
sameLine ();
404
437
ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 (0 , 0 ));
405
- if (ImGui::Button (longLabel.c_str ())) jumpToMemory (addr, size);
438
+ if (ImGui::Button (longLabel.c_str ())) jumpToMemory (addr, size, targetEditorIndex, false );
406
439
ImGui::PopStyleVar ();
440
+ addMemoryEditorContext (addr, size);
407
441
if (ImGui::IsItemHovered ()) {
408
442
ImGui::BeginTooltip ();
409
443
ImGui::PushTextWrapPos (ImGui::GetFontSize () * 35 .0f );
@@ -418,6 +452,7 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
418
452
ImGui::Text (" [%8.8x] = %8.8x" , addr, mem32 (addr));
419
453
break ;
420
454
}
455
+ ImGui::Text (_ (" Go to in Memory Editor #%u" ), targetEditorIndex + 1 );
421
456
ImGui::PopTextWrapPos ();
422
457
ImGui::EndTooltip ();
423
458
}
@@ -729,9 +764,7 @@ settings, otherwise debugging features may not work.)");
729
764
std::snprintf (fmtAddr, sizeof (fmtAddr), " %8.8x" , dispAddr);
730
765
ImGui::SetClipboardText (fmtAddr);
731
766
}
732
- if (ImGui::MenuItem (_ (" Go to in Memory Editor" ))) {
733
- jumpToMemory (dispAddr, 4 );
734
- }
767
+ addMemoryEditorSubMenu (addr, 4 );
735
768
if (ImGui::MenuItem (_ (" Run to Cursor" ), nullptr , false , !PCSX::g_system->running ())) {
736
769
g_emulator->m_debug ->addBreakpoint (
737
770
dispAddr, Debug::BreakpointType::Exec, 4 , _ (" GUI" ),
0 commit comments