ImDebugger: Add a Time window to check various counters

This commit is contained in:
Henrik Rydgård
2025-04-23 17:10:31 +02:00
parent ecff4d03ee
commit ef97eb668a
5 changed files with 49 additions and 9 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ const int PSP_TIME_INVALID_MINUTES = -5;
const int PSP_TIME_INVALID_SECONDS = -6;
const int PSP_TIME_INVALID_MICROSECONDS = -7;
static u64 __RtcGetCurrentTick()
u64 __RtcGetCurrentTick()
{
// TODO: It's probably expecting ticks since January 1, 0001?
return CoreTiming::GetGlobalTimeUs() + rtcBaseTicks;
+1
View File
@@ -32,6 +32,7 @@ struct PSPTimeval {
void __RtcTimeOfDay(PSPTimeval *tv);
int32_t RtcBaseTime(int32_t *micro = nullptr);
void RtcSetBaseTime(int32_t seconds, int32_t micro = 0);
u64 __RtcGetCurrentTick();
void Register_sceRtc();
void __RtcInit();
+34
View File
@@ -44,6 +44,7 @@
#include "Core/HLE/AtracCtx.h"
#include "Core/HLE/sceSas.h"
#include "Core/HW/SasAudio.h"
#include "Core/HW/Display.h"
#include "Core/CoreTiming.h"
// Threads window
@@ -150,6 +151,33 @@ void ImClickableValueFloat(const char *id, float value) {
ImGui::PopID();
}
void DrawTimeView(ImConfig &cfg) {
ImGui::SetNextWindowSize(ImVec2(420, 300), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Time", &cfg.timeOpen)) {
ImGui::End();
return;
}
// Display timing
if (ImGui::CollapsingHeader("Display Timing", ImGuiTreeNodeFlags_DefaultOpen)) {
ImGui::Text("Num VBlanks: %d", __DisplayGetNumVblanks());
ImGui::Text("FlipCount: %d", __DisplayGetFlipCount());
ImGui::Text("VCount: %d", __DisplayGetVCount());
ImGui::Text("HCount cur: %d accum: %d", __DisplayGetCurrentHcount(), __DisplayGetAccumulatedHcount());
ImGui::Text("IsVblank: %d", DisplayIsVblank());
}
// RTC
if (ImGui::CollapsingHeader("RTC", ImGuiTreeNodeFlags_DefaultOpen)) {
PSPTimeval tv;
__RtcTimeOfDay(&tv);
ImGui::Text("RtcTimeOfDay: %d.%06d", tv.tv_sec, tv.tv_usec);
ImGui::Text("RtcGetCurrentTick: %lld", (long long)__RtcGetCurrentTick());
}
ImGui::End();
}
void DrawSchedulerView(ImConfig &cfg) {
ImGui::SetNextWindowSize(ImVec2(420, 300), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Event Scheduler", &cfg.schedulerOpen)) {
@@ -1943,6 +1971,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
}
if (ImGui::BeginMenu("Core")) {
ImGui::MenuItem("Scheduler", nullptr, &cfg_.schedulerOpen);
ImGui::MenuItem("Time", nullptr, &cfg_.timeOpen);
ImGui::EndMenu();
}
if (ImGui::BeginMenu("CPU")) {
@@ -2193,6 +2222,10 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebu
DrawSchedulerView(cfg_);
}
if (cfg_.timeOpen) {
DrawTimeView(cfg_);
}
if (cfg_.pixelViewerOpen) {
pixelViewer_.Draw(cfg_, control, gpuDebug, draw);
}
@@ -2360,6 +2393,7 @@ void ImConfig::SyncConfig(IniFile *ini, bool save) {
sync.Sync("geStateOpen", &geStateOpen, false);
sync.Sync("geVertsOpen", &geVertsOpen, false);
sync.Sync("schedulerOpen", &schedulerOpen, false);
sync.Sync("timeOpen", &timeOpen, false);
sync.Sync("socketsOpen", &socketsOpen, false);
sync.Sync("npOpen", &npOpen, false);
sync.Sync("adhocOpen", &adhocOpen, false);
+1
View File
@@ -71,6 +71,7 @@ struct ImConfig {
bool geStateOpen;
bool geVertsOpen;
bool schedulerOpen;
bool timeOpen;
bool watchOpen;
bool pixelViewerOpen;
bool npOpen;
+12 -8
View File
@@ -1078,18 +1078,22 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
SetDlgItemText(m_hDlg, IDC_GEDBG_TEXADDR, L"");
SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, L"");
gpuDebug->SetBreakNext(GPUDebug::BreakNext::NONE);
if (gpuDebug) {
gpuDebug->SetBreakNext(GPUDebug::BreakNext::NONE);
}
break;
case IDC_GEDBG_RECORD:
gpuDebug->GetRecorder()->RecordNextFrame([](const Path &path) {
// Opens a Windows Explorer window with the file, when done.
System_ShowFileInFolder(path);
});
if (gpuDebug) {
gpuDebug->GetRecorder()->RecordNextFrame([](const Path &path) {
// Opens a Windows Explorer window with the file, when done.
System_ShowFileInFolder(path);
});
}
break;
case IDC_GEDBG_FLUSH:
if (gpuDebug != nullptr) {
if (gpuDebug) {
if (!autoFlush_)
GPU_FlushDrawing();
UpdatePreviews();
@@ -1101,14 +1105,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break;
case IDC_GEDBG_FORCEOPAQUE:
if (gpuDebug != nullptr) {
if (gpuDebug) {
forceOpaque_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_FORCEOPAQUE), BM_GETCHECK, 0, 0) != 0;
UpdatePreviews();
}
break;
case IDC_GEDBG_SHOWCLUT:
if (gpuDebug != nullptr) {
if (gpuDebug) {
showClut_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_SHOWCLUT), BM_GETCHECK, 0, 0) != 0;
UpdatePreviews();
}