Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion UI/ImDebugger/ImDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,21 @@ static void DrawBreakpointsView(MIPSDebugInterface *mipsDebug, ImConfig &cfg) {
if (ImGui::BeginChild("mc_edit")) {
auto &mc = mcs[cfg.selectedMemCheck];
ImGui::TextUnformatted("Edit memcheck");
if (ImGui::BeginCombo("Condition", MemCheckConditionToString(mc.cond))) {
if (ImGui::Selectable("Read", mc.cond == MemCheckCondition::MEMCHECK_READ)) {
mc.cond = MemCheckCondition::MEMCHECK_READ;
}
if (ImGui::Selectable("Write", mc.cond == MemCheckCondition::MEMCHECK_WRITE)) {
mc.cond = MemCheckCondition::MEMCHECK_WRITE;
}
if (ImGui::Selectable("Read / Write", mc.cond == MemCheckCondition::MEMCHECK_READWRITE)) {
mc.cond = MemCheckCondition::MEMCHECK_READWRITE;
}
if (ImGui::Selectable("Write On Change", mc.cond == MemCheckCondition::MEMCHECK_WRITE_ONCHANGE)) {
mc.cond = MemCheckCondition::MEMCHECK_WRITE_ONCHANGE;
}
ImGui::EndCombo();
}
ImGui::CheckboxFlags("Enabled", (int *)&mc.result, (int)BREAK_ACTION_PAUSE);
ImGui::InputScalar("Start", ImGuiDataType_U32, &mc.start, NULL, NULL, "%08x", ImGuiInputTextFlags_CharsHexadecimal);
ImGui::InputScalar("End", ImGuiDataType_U32, &mc.end, NULL, NULL, "%08x", ImGuiInputTextFlags_CharsHexadecimal);
Expand Down Expand Up @@ -1019,7 +1034,7 @@ void DrawMediaDecodersView(ImConfig &cfg, ImControl &control) {
auto iter = mpegCtxs.find(cfg.selectedMpegCtx);
if (iter != mpegCtxs.end()) {
const MpegContext *ctx = iter->second;
char temp[16];
char temp[28];
snprintf(temp, sizeof(temp), "sceMpeg context at %08x", iter->first);
if (ctx && ImGui::CollapsingHeader(temp, ImGuiTreeNodeFlags_DefaultOpen)) {
// ImGui::ProgressBar((float)sas->CurPos() / (float)info.fileDataEnd, ImVec2(200.0f, 0.0f));
Expand Down
20 changes: 20 additions & 0 deletions UI/ImDebugger/ImMemView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ void ImMemView::Draw(ImDrawList *drawList) {
const ImColor secondarySelFg = 0xFFFFFFFF;
const ImColor secondarySelBg = 0xFF808080;

const ImColor zeroColor = 0x888888ff;

if (address + j >= selectRangeStart_ && address + j < selectRangeEnd_ && !searching_) {
if (asciiSelected_) {
hexBGCol = secondarySelBg;
Expand Down Expand Up @@ -180,6 +182,10 @@ void ImMemView::Draw(ImDrawList *drawList) {
int bgWidth = 2; // continueRect ? 3 : 2;
drawList->AddRectFilled(ImVec2(canvas_p0.x + hexX - 1, canvas_p0.y + rowY), ImVec2(canvas_p0.x + hexX + charWidth_ * bgWidth, canvas_p0.y + rowY + charHeight_), bg);
}
if (drawZeroDark_ && temp[0] == '0' && temp[1] == '0') {
// if the byte is all zero make it darker
fg = zeroColor;
}
drawList->AddText(ImVec2(canvas_p0.x + hexX, canvas_p0.y + rowY), fg, &temp[0], &temp[2]);
if (underline >= 0) {
float x = canvas_p0.x + hexX + underline * charWidth_;
Expand Down Expand Up @@ -835,6 +841,10 @@ void ImMemView::setHighlightType(MemBlockFlags flags) {
}
}

void ImMemView::toggleDrawZeroDark(bool toggle) {
drawZeroDark_ = toggle;
}

void ImMemDumpWindow::Draw(ImConfig &cfg, MIPSDebugInterface *debug) {
ImGui::SetNextWindowSize(ImVec2(200, 300), ImGuiCond_FirstUseEver);

Expand Down Expand Up @@ -911,6 +921,16 @@ void ImMemWindow::Draw(MIPSDebugInterface *mipsDebug, ImConfig &cfg, ImControl &
if (ImGui::SmallButton("Go")) {
memView_.gotoAddr(gotoAddr_);
}
ImGui::SameLine();
if (ImGui::SmallButton("Settings")) {
ImGui::OpenPopup("disSettings");
}
if (ImGui::BeginPopup("disSettings")) {
if(ImGui::Checkbox("Darken Zeros", &drawZeroDark_)) {
memView_.toggleDrawZeroDark(drawZeroDark_);
}
ImGui::EndPopup();
}

ImVec2 size(0, -ImGui::GetFrameHeightWithSpacing());

Expand Down
6 changes: 6 additions & 0 deletions UI/ImDebugger/ImMemView.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class ImMemView {
void toggleOffsetScale(CommonToggles toggle);
void setHighlightType(MemBlockFlags flags);

void toggleDrawZeroDark(bool toggle);

const std::string &StatusMessage() const {
return statusMessage_;
}
Expand Down Expand Up @@ -109,6 +111,8 @@ class ImMemView {
// Number of rows visible as of last redraw.
int visibleRows_ = 0;

bool drawZeroDark_ = false;

// Last used search query, used when continuing a search.
std::string searchQuery_;
// Address of last match when continuing search.
Expand Down Expand Up @@ -177,6 +181,8 @@ class ImMemWindow {
int selectedSymbol_ = -1;
char selectedSymbolName_[128];

bool drawZeroDark_ = false;

ImMemView memView_;
char searchTerm_[64]{};

Expand Down
Loading