Skip to content

Commit

Permalink
Slightly different layout system, and using buttons for jump targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolasnoble committed May 1, 2019
1 parent 190e562 commit 5e53a12
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/gui/widgets/assembly.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,19 @@ class ImGuiAsm : public PCSX::Disasm {
void comma() {
if (m_gotArg) {
sameLine();
ImGui::Text(", ");
ImGui::Text(",");
}
m_gotArg = true;
}
virtual void OpCode(const char* str) final {
m_gotArg = false;
sameLine();
ImGui::Text("%-7s", str);
ImGui::Text("%-6s", str);
}
virtual void GPR(uint8_t reg) final {
comma();
sameLine();
ImGui::Text("$");
ImGui::Text(" $");
sameLine();
ImGui::Text(s_disRNameGPR[reg]);
if (ImGui::IsItemHovered()) {
Expand All @@ -113,7 +113,7 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void CP0(uint8_t reg) final {
comma();
sameLine();
ImGui::Text("$");
ImGui::Text(" $");
sameLine();
ImGui::Text(s_disRNameCP0[reg]);
if (ImGui::IsItemHovered()) {
Expand All @@ -127,7 +127,7 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void CP2C(uint8_t reg) final {
comma();
sameLine();
ImGui::Text("$");
ImGui::Text(" $");
sameLine();
ImGui::Text(s_disRNameCP2C[reg]);
if (ImGui::IsItemHovered()) {
Expand All @@ -141,7 +141,7 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void CP2D(uint8_t reg) final {
comma();
sameLine();
ImGui::Text("$");
ImGui::Text(" $");
sameLine();
ImGui::Text(s_disRNameCP2D[reg]);
if (ImGui::IsItemHovered()) {
Expand All @@ -155,7 +155,7 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void HI() final {
comma();
sameLine();
ImGui::Text("$hi");
ImGui::Text(" $hi");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
Expand All @@ -167,7 +167,7 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void LO() final {
comma();
sameLine();
ImGui::Text("$lo");
ImGui::Text(" $lo");
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::PushTextWrapPos(ImGui::GetFontSize() * 35.0f);
Expand All @@ -179,32 +179,27 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void Imm(uint16_t value) final {
comma();
sameLine();
ImGui::Text("0x%4.4x", value);
ImGui::Text(" 0x%4.4x", value);
}
virtual void Imm32(uint32_t value) final {
comma();
sameLine();
ImGui::Text("0x%8.8x", value);
ImGui::Text(" 0x%8.8x", value);
}
virtual void Target(uint32_t value) final {
comma();
sameLine();
ImGui::Text("0x%8.8x", value);
std::string contextMenuTitle = "target menu ";
contextMenuTitle += m_currentAddr;
if (ImGui::BeginPopupContextItem(contextMenuTitle.c_str())) {
DButton("Jump to address", true, [&]() mutable {
m_jumpToPC = true;
m_jumpToPCValue = virtToReal(value);
});
ImGui::EndPopup();
char label[21];
std::snprintf(label, sizeof(label), "0x%8.8x##%8.8x", value, m_currentAddr);
if (ImGui::SmallButton(label)) {
m_jumpToPC = true;
m_jumpToPCValue = virtToReal(value);
}

}
virtual void Sa(uint8_t value) final {
comma();
sameLine();
ImGui::Text("0x%2.2x", value);
ImGui::Text(" 0x%2.2x", value);
}
inline uint8_t* ptr(uint32_t addr) {
uint8_t* lut = m_memory->g_psxMemRLUT[addr >> 16];
Expand All @@ -221,7 +216,7 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void OfB(int16_t offset, uint8_t reg, int size) {
comma();
sameLine();
ImGui::Text("0x%4.4x($%s)", offset, s_disRNameGPR[reg]);
ImGui::Text(" 0x%4.4x($%s)", offset, s_disRNameGPR[reg]);
if (ImGui::IsItemHovered()) {
uint32_t addr = m_registers->GPR.r[reg] + offset;
ImGui::BeginTooltip();
Expand All @@ -244,7 +239,12 @@ class ImGuiAsm : public PCSX::Disasm {
virtual void Offset(uint32_t value) final {
comma();
sameLine();
ImGui::Text("0x%8.8x", value);
char label[21];
std::snprintf(label, sizeof(label), "0x%8.8x##%8.8x", value, m_currentAddr);
if (ImGui::SmallButton(label)) {
m_jumpToPC = true;
m_jumpToPCValue = virtToReal(value);
}
}
bool m_gotArg = false;
PCSX::psxRegisters* m_registers;
Expand Down

0 comments on commit 5e53a12

Please sign in to comment.