Merge pull request #19614 from hrydgard/imgui-fixes
Some checks failed
Build / build-windows (ARM64) (push) Has been cancelled
Build / build-windows (x64) (push) Has been cancelled
Build / build-uwp (push) Has been cancelled
Build / build (./b.sh --headless --unittest --fat --no-png --no-sdl2, clang, clang++, test, macos, macos-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, clang, clang++, test, clang-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --headless --unittest, gcc, g++, gcc-normal, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --ios, clang, clang++, ios, ios, macos-latest) (push) Has been cancelled
Build / build (./b.sh --libretro_android ppsspp_libretro, clang, clang++, android, android-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (./b.sh --qt, gcc, g++, qt, qt, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a OPENXR=1, clang, clang++, android, android-vr, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=arm64-v8a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm64, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=armeabi-v7a UNITTEST=1 HEADLESS=1, clang, clang++, android, android-arm32, ubuntu-latest) (push) Has been cancelled
Build / build (cd android && ./ab.sh -j2 APP_ABI=x86_64 UNITTEST=1 HEADLESS=1, clang, clang++, android, android-x86_64, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, clang, clang++, libretro, clang-libretro, ubuntu-latest) (push) Has been cancelled
Build / build (make -C libretro -f Makefile -j2, gcc, g++, libretro, gcc-libretro, ubuntu-latest) (push) Has been cancelled
Build / build_test_headless_alpine (push) Has been cancelled
Generate Docker Layer / build (push) Has been cancelled
Build / test-windows (push) Has been cancelled
Build / test (macos-latest) (push) Has been cancelled
Build / test (ubuntu-latest) (push) Has been cancelled

More minor ImGui fixes
This commit is contained in:
Henrik Rydgård 2024-11-07 20:25:33 +01:00 committed by GitHub
commit da0168f41a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 38 additions and 26 deletions

View File

@ -244,8 +244,8 @@ void MIPSDebugInterface::toggleBreakpoint(unsigned int address)
int MIPSDebugInterface::getColor(unsigned int address, bool darkMode) const {
int colors[6] = { 0xe0FFFF, 0xFFe0e0, 0xe8e8FF, 0xFFe0FF, 0xe0FFe0, 0xFFFFe0 };
int colorsDark[6] = { ~0xe0FFFF, ~0xFFe0e0, ~0xe8e8FF, ~0xFFe0FF, ~0xe0FFe0, ~0xFFFFe0 };
uint32_t colors[6] = { 0xFFe0FFFF, 0xFFFFe0e0, 0xFFe8e8FF, 0xFFFFe0FF, 0xFFe0FFe0, 0xFFFFFFe0 };
uint32_t colorsDark[6] = { 0xFF301010, 0xFF103030, 0xFF403010, 0xFF103000, 0xFF301030, 0xFF101030 };
int n = g_symbolMap->GetFunctionNum(address);
if (n == -1) {

View File

@ -163,6 +163,11 @@ namespace MIPSStackWalk {
std::vector<StackFrame> Walk(u32 pc, u32 ra, u32 sp, u32 threadEntry, u32 threadStackTop) {
std::vector<StackFrame> frames;
if (!Memory::IsValidAddress(pc) || !Memory::IsValidAddress(sp) || !Memory::IsValidAddress(ra)) {
return frames;
}
StackFrame current;
current.pc = pc;
current.sp = sp;

View File

@ -955,7 +955,7 @@ bool EmuScreen::UnsyncKey(const KeyInput &key) {
if (UI::IsFocusMovementEnabled() || (imguiVisible_ && imguiInited_)) {
// Note: Allow some Vkeys through, so we can toggle the imgui for example (since we actually block the control mapper otherwise in imgui mode).
// We need to manually implement it here :/
if (imguiVisible_ && imguiInited_) {
if (imguiVisible_ && imguiInited_ && (key.flags & (KEY_UP | KEY_DOWN))) {
InputMapping mapping(key.deviceId, key.keyCode);
std::vector<int> pspButtons;
bool mappingFound = KeyMap::InputMappingToPspButton(mapping, &pspButtons);
@ -1643,7 +1643,7 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
ImGui_ImplThin3d_Init(draw);
}
if (imguiVisible_ && imguiInited_) {
if (imguiVisible_ && imguiInited_ && PSP_IsInited()) {
_dbg_assert_(imDebugger_);
ImGui_ImplPlatform_NewFrame();

View File

@ -57,7 +57,7 @@ void DrawRegisterView(MIPSDebugInterface *mipsDebug, bool *open) {
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("FPR")) {
if (ImGui::BeginTabItem("FPU")) {
if (ImGui::BeginTable("fpr", 3, ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersH)) {
ImGui::TableSetupColumn("regname", ImGuiTableColumnFlags_WidthFixed);
ImGui::TableSetupColumn("value", ImGuiTableColumnFlags_WidthFixed);
@ -79,7 +79,7 @@ void DrawRegisterView(MIPSDebugInterface *mipsDebug, bool *open) {
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("VPR")) {
if (ImGui::BeginTabItem("VFPU")) {
ImGui::Text("TODO");
ImGui::EndTabItem();
}
@ -93,10 +93,10 @@ static const char *ThreadStatusToString(u32 status) {
case THREADSTATUS_RUNNING: return "Running";
case THREADSTATUS_READY: return "Ready";
case THREADSTATUS_WAIT: return "Wait";
case THREADSTATUS_SUSPEND: return "Suspend";
case THREADSTATUS_SUSPEND: return "Suspended";
case THREADSTATUS_DORMANT: return "Dormant";
case THREADSTATUS_DEAD: return "Dead";
case THREADSTATUS_WAITSUSPEND: return "WaitSuspend";
case THREADSTATUS_WAITSUSPEND: return "WaitSuspended";
default:
break;
}
@ -198,7 +198,7 @@ void DrawCallStacks(MIPSDebugInterface *debug, bool *open) {
}
void DrawModules(MIPSDebugInterface *debug, bool *open) {
if (!ImGui::Begin("Modules", open)) {
if (!ImGui::Begin("Modules", open) || !g_symbolMap) {
ImGui::End();
return;
}
@ -379,12 +379,11 @@ void ImDisasmWindow::Draw(MIPSDebugInterface *mipsDebug, bool *open, CoreState c
while (clipper.Step()) {
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
if (ImGui::Selectable(symCache_[i].name.c_str(), false)) {
disasmView_.setCurAddress(symCache_[i].address);
disasmView_.gotoAddr(symCache_[i].address);
disasmView_.scrollAddressIntoView();
}
}
}
clipper.End();
ImGui::EndListBox();
}

View File

@ -375,7 +375,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
ImColor textColor = 0xFFFFFFFF;
if (isInInterval(address, line.totalSize, debugger->getPC())) {
backgroundColor = scaleColor(backgroundColor, 1.15f);
backgroundColor = scaleColor(backgroundColor, 1.3f);
}
if (address >= selectRangeStart_ && address < selectRangeEnd_ && searching_ == false) {
@ -383,7 +383,7 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
backgroundColor = ImColor(address == curAddress_ ? 0xFFFF8822 : 0xFFFF9933);
textColor = ImColor(0xFF000000);
} else {
backgroundColor = ImColor(0xFFC0C0C0);
backgroundColor = ImColor(0xFF606060);
}
}
@ -404,10 +404,12 @@ void ImDisasmView::Draw(ImDrawList *drawList) {
drawList->AddText(ImVec2(rect.left + pixelPositions_.addressStart, rect.top + rowY1 + 2), textColor, addressText);
if (isInInterval(address, line.totalSize, debugger->getPC())) {
// Show the current PC with a little square.
drawList->AddRectFilled(
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - rowHeight_, canvas_p0.y + rowY1 + 2),
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - 4, canvas_p0.y + rowY1 + rowHeight_ - 2), 0xFFFFFFFF);
// Show the current PC with a little triangle.
drawList->AddTriangleFilled(
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - rowHeight_ * 0.7f, canvas_p0.y + rowY1 + 2),
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - rowHeight_ * 0.7f, canvas_p0.y + rowY1 + rowHeight_ - 2),
ImVec2(canvas_p0.x + pixelPositions_.opcodeStart - 4, canvas_p0.y + rowY1 + rowHeight_ * 0.5f),
0xFFFFFFFF);
}
// display whether the condition of a branch is met
@ -498,7 +500,8 @@ void ImDisasmView::ScrollRelative(int amount) {
ScanVisibleFunctions();
}
void ImDisasmView::followBranch() {
// Follows branches and jumps.
void ImDisasmView::FollowBranch() {
DisassemblyLineInfo line;
manager.getLine(curAddress_, true, line);
@ -644,7 +647,7 @@ void ImDisasmView::onKeyDown(ImGuiKey key) {
}
return;
case VK_RIGHT:
followBranch();
FollowBranch();
return;
case VK_TAB:
displaySymbols_ = !displaySymbols_;
@ -797,7 +800,7 @@ void ImDisasmView::PopupMenu() {
debugger->setPC(curAddress_);
}
if (ImGui::MenuItem("Follow branch")) {
followBranch();
FollowBranch();
}
if (ImGui::MenuItem("Run to here")) {
// CBreakPoints::AddBreakPoint(pos, true);

View File

@ -125,7 +125,7 @@ private:
std::string disassembleRange(u32 start, u32 size);
void disassembleToFile();
void search(bool continueSearch);
void followBranch();
void FollowBranch();
void calculatePixelPositions();
bool getDisasmAddressText(u32 address, char* dest, bool abbreviateLabels, bool showData);
void updateStatusBarText();

View File

@ -22,10 +22,10 @@ void ImGui_ImplPlatform_KeyEvent(const KeyInput &key) {
default:
{
ImGuiKey keyCode = KeyCodeToImGui(key.keyCode);
if (keyCode == ImGuiKey_None) {
WARN_LOG(Log::System, "Unmapped ImGui keycode conversion from %d", key.keyCode);
} else {
if (keyCode != ImGuiKey_None) {
io.AddKeyEvent(keyCode, true);
} else {
WARN_LOG(Log::System, "KeyDown: Unmapped ImGui keycode conversion from %d", key.keyCode);
}
break;
}
@ -33,10 +33,15 @@ void ImGui_ImplPlatform_KeyEvent(const KeyInput &key) {
}
if (key.flags & KEY_UP) {
ImGuiKey keyCode = KeyCodeToImGui(key.keyCode);
if (keyCode != ImGuiKey_None) {
io.AddKeyEvent(keyCode, false);
} else {
WARN_LOG(Log::System, "KeyUp: Unmapped ImGui keycode conversion from %d", key.keyCode);
}
}
if (key.flags & KEY_CHAR) {
const int unichar = key.unicodeChar;
if (unichar >= 0x20) {
// Insert it! (todo: do it with a string insert)
char buf[16];