mirror of
https://github.com/grumpycoders/pcsx-redux.git
synced 2024-06-01 02:38:33 -04:00
Merge pull request #1645 from Giragast/goto_in_more_memory_editors
Open Assembly widget addresses in different Memory Editors
This commit is contained in:
commit
437f208d94
|
@ -88,6 +88,8 @@ struct JumpToPC {
|
|||
struct JumpToMemory {
|
||||
uint32_t address;
|
||||
unsigned size;
|
||||
unsigned editorNum;
|
||||
bool forceShowEditor;
|
||||
};
|
||||
struct SelectClut {
|
||||
unsigned x, y;
|
||||
|
|
|
@ -740,6 +740,8 @@ void PCSX::GUI::init(std::function<void()> applyArguments) {
|
|||
const uint32_t base = (event.address >> 20) & 0xff8;
|
||||
const uint32_t real = event.address & 0x7fffff;
|
||||
const uint32_t size = event.size;
|
||||
const uint32_t editorNum = event.editorNum;
|
||||
const bool forceShowEditor = event.forceShowEditor;
|
||||
auto changeDataType = [](MemoryEditor* editor, int size) {
|
||||
bool isSigned = false;
|
||||
switch (editor->PreviewDataType) {
|
||||
|
@ -764,11 +766,13 @@ void PCSX::GUI::init(std::function<void()> applyArguments) {
|
|||
};
|
||||
if ((base == 0x000) || (base == 0x800) || (base == 0xa00)) {
|
||||
if (real < 0x00800000) {
|
||||
m_mainMemEditors[0].editor.GotoAddrAndHighlight(real, real + size);
|
||||
changeDataType(&m_mainMemEditors[0].editor, size);
|
||||
if (forceShowEditor) m_mainMemEditors[editorNum].m_show = true;
|
||||
m_mainMemEditors[editorNum].editor.GotoAddrAndHighlight(real, real + size);
|
||||
changeDataType(&m_mainMemEditors[editorNum].editor, size);
|
||||
}
|
||||
} else if (base == 0x1f8) {
|
||||
if (real >= 0x1000 && real < 0x3000) {
|
||||
if (forceShowEditor) m_hwrEditor.m_show = true;
|
||||
m_hwrEditor.editor.GotoAddrAndHighlight(real - 0x1000, real - 0x1000 + size);
|
||||
changeDataType(&m_hwrEditor.editor, size);
|
||||
}
|
||||
|
|
|
@ -325,8 +325,32 @@ const uint8_t* PCSX::Widgets::Assembly::ptr(uint32_t addr) {
|
|||
return dummy;
|
||||
}
|
||||
}
|
||||
void PCSX::Widgets::Assembly::jumpToMemory(uint32_t addr, unsigned size) {
|
||||
g_system->m_eventBus->signal(PCSX::Events::GUI::JumpToMemory{addr, size});
|
||||
void PCSX::Widgets::Assembly::jumpToMemory(uint32_t addr, unsigned size, unsigned editorIndex /* = 0*/,
|
||||
bool forceShowEditor /* = false*/) {
|
||||
g_system->m_eventBus->signal(PCSX::Events::GUI::JumpToMemory{addr, size, editorIndex, forceShowEditor});
|
||||
}
|
||||
void PCSX::Widgets::Assembly::addMemoryEditorContext(uint32_t addr, int size) {
|
||||
if (ImGui::BeginPopupContextItem()) {
|
||||
if (ImGui::MenuItem(_("Go to in Memory Editor #1 (Default Click)"))) jumpToMemory(addr, size, 0, true);
|
||||
if (ImGui::MenuItem(_("Go to in Memory Editor #2 (Shift+Click)"))) jumpToMemory(addr, size, 1, true);
|
||||
if (ImGui::MenuItem(_("Go to in Memory Editor #3 (Ctrl+Click)"))) jumpToMemory(addr, size, 2, true);
|
||||
std::string itemLabel;
|
||||
for (unsigned i = 3; i < 8; ++i) {
|
||||
itemLabel = fmt::format(f_("Go to in Memory Editor #{}"), i + 1);
|
||||
if (ImGui::MenuItem(itemLabel.c_str())) jumpToMemory(addr, size, i, true);
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
void PCSX::Widgets::Assembly::addMemoryEditorSubMenu(uint32_t addr, int size) {
|
||||
if (ImGui::BeginMenu(_("Go to in Memory Editor..."))) {
|
||||
std::string itemLabel;
|
||||
for (unsigned i = 0; i < 8; ++i) {
|
||||
itemLabel = fmt::format("#{}", i + 1);
|
||||
if (ImGui::MenuItem(itemLabel.c_str())) jumpToMemory(addr, size, i, true);
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
|||
auto symbols = findSymbol(addr);
|
||||
if (symbols.size() != 0) longLabel = *symbols.begin() + " ; ";
|
||||
|
||||
const auto& io = ImGui::GetIO();
|
||||
unsigned targetEditorIndex = io.KeyShift ? 1 : (io.KeyCtrl ? 2 : 0);
|
||||
|
||||
ImGui::TextUnformatted(" ");
|
||||
ImGui::SameLine(0.0f, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
if (ImGui::Button(label)) jumpToMemory(addr, size);
|
||||
if (ImGui::Button(label)) jumpToMemory(addr, size, targetEditorIndex, false);
|
||||
ImGui::PopStyleVar();
|
||||
addMemoryEditorContext(addr, size);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
|
@ -363,6 +391,7 @@ void PCSX::Widgets::Assembly::OfB(int16_t offset, uint8_t reg, int size) {
|
|||
ImGui::Text("%s[%8.8x] = %8.8x", longLabel.c_str(), addr, mem32(addr));
|
||||
break;
|
||||
}
|
||||
ImGui::Text(_("Go to in Memory Editor #%d"), targetEditorIndex + 1);
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
@ -399,11 +428,16 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
|
|||
std::string longLabel = label;
|
||||
auto symbols = findSymbol(addr);
|
||||
if (symbols.size() != 0) longLabel = *symbols.begin() + " ;" + label;
|
||||
|
||||
const auto& io = ImGui::GetIO();
|
||||
unsigned targetEditorIndex = io.KeyShift ? 1 : (io.KeyCtrl ? 2 : 0);
|
||||
|
||||
ImGui::TextUnformatted(" ");
|
||||
sameLine();
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
||||
if (ImGui::Button(longLabel.c_str())) jumpToMemory(addr, size);
|
||||
if (ImGui::Button(longLabel.c_str())) jumpToMemory(addr, size, targetEditorIndex, false);
|
||||
ImGui::PopStyleVar();
|
||||
addMemoryEditorContext(addr, size);
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
|
||||
|
@ -418,6 +452,7 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
|
|||
ImGui::Text("[%8.8x] = %8.8x", addr, mem32(addr));
|
||||
break;
|
||||
}
|
||||
ImGui::Text(_("Go to in Memory Editor #%u"), targetEditorIndex + 1);
|
||||
ImGui::PopTextWrapPos();
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
@ -729,9 +764,7 @@ settings, otherwise debugging features may not work.)");
|
|||
std::snprintf(fmtAddr, sizeof(fmtAddr), "%8.8x", dispAddr);
|
||||
ImGui::SetClipboardText(fmtAddr);
|
||||
}
|
||||
if (ImGui::MenuItem(_("Go to in Memory Editor"))) {
|
||||
jumpToMemory(dispAddr, 4);
|
||||
}
|
||||
addMemoryEditorSubMenu(addr, 4);
|
||||
if (ImGui::MenuItem(_("Run to Cursor"), nullptr, false, !PCSX::g_system->running())) {
|
||||
g_emulator->m_debug->addBreakpoint(
|
||||
dispAddr, Debug::BreakpointType::Exec, 4, _("GUI"),
|
||||
|
|
|
@ -67,7 +67,7 @@ class Assembly : private Disasm {
|
|||
void sameLine();
|
||||
void comma();
|
||||
const uint8_t* ptr(uint32_t addr);
|
||||
void jumpToMemory(uint32_t addr, unsigned size);
|
||||
void jumpToMemory(uint32_t addr, unsigned size, unsigned editorIndex = 0, bool forceShowEditor = false);
|
||||
uint8_t mem8(uint32_t addr);
|
||||
uint16_t mem16(uint32_t addr);
|
||||
uint32_t mem32(uint32_t addr);
|
||||
|
@ -111,6 +111,8 @@ class Assembly : private Disasm {
|
|||
bool m_symbolsCachesValid = false;
|
||||
|
||||
void rebuildSymbolsCaches();
|
||||
void addMemoryEditorContext(uint32_t addr, int size);
|
||||
void addMemoryEditorSubMenu(uint32_t addr, int size);
|
||||
|
||||
bool m_showSymbols = false;
|
||||
std::string m_symbolFilter;
|
||||
|
|
Loading…
Reference in a new issue