ImDebugger: Fix issue with HLE Modules window always showing, more granular sleep logging

This commit is contained in:
Henrik Rydgård 2024-11-21 15:47:37 +01:00
parent 659af60613
commit 5a3eeb9d9b
5 changed files with 9 additions and 6 deletions

View File

@ -252,6 +252,7 @@ double Instant::ElapsedSeconds() const {
#endif #endif
void sleep_ms(int ms, const char *reason) { void sleep_ms(int ms, const char *reason) {
// INFO_LOG(Log::System, "Sleep %d ms: %s", ms, reason);
#ifdef _WIN32 #ifdef _WIN32
Sleep(ms); Sleep(ms);
#elif defined(HAVE_LIBNX) #elif defined(HAVE_LIBNX)

View File

@ -32,10 +32,10 @@
FrameTiming g_frameTiming; FrameTiming g_frameTiming;
void WaitUntil(double now, double timestamp) { void WaitUntil(double now, double timestamp, const char *reason) {
#ifdef _WIN32 #ifdef _WIN32
while (time_now_d() < timestamp) { while (time_now_d() < timestamp) {
sleep_ms(1, "wait-until"); // Sleep for 1ms on this thread sleep_ms(1, reason); // Sleep for 1ms on this thread
} }
#else #else
const double left = timestamp - now; const double left = timestamp - now;
@ -71,7 +71,7 @@ void FrameTiming::DeferWaitUntil(double until, double *curTimePtr) {
void FrameTiming::PostSubmit() { void FrameTiming::PostSubmit() {
if (waitUntil_ != 0.0) { if (waitUntil_ != 0.0) {
WaitUntil(time_now_d(), waitUntil_); WaitUntil(time_now_d(), waitUntil_, "post-submit");
if (curTimePtr_) { if (curTimePtr_) {
*curTimePtr_ = waitUntil_; *curTimePtr_ = waitUntil_;
curTimePtr_ = nullptr; curTimePtr_ = nullptr;

View File

@ -27,4 +27,4 @@ extern FrameTiming g_frameTiming;
Draw::PresentMode ComputePresentMode(Draw::DrawContext *draw, int *interval); Draw::PresentMode ComputePresentMode(Draw::DrawContext *draw, int *interval);
void WaitUntil(double now, double timestamp); void WaitUntil(double now, double timestamp, const char *reason);

View File

@ -445,7 +445,7 @@ static void DoFrameTiming(bool throttle, bool *skipFrame, float scaledTimestep,
if (endOfFrame) { if (endOfFrame) {
g_frameTiming.DeferWaitUntil(nextFrameTime, &curFrameTime); g_frameTiming.DeferWaitUntil(nextFrameTime, &curFrameTime);
} else { } else {
WaitUntil(curFrameTime, nextFrameTime); WaitUntil(curFrameTime, nextFrameTime, "display-wait");
curFrameTime = time_now_d(); // I guess we could also just set it to nextFrameTime... curFrameTime = time_now_d(); // I guess we could also just set it to nextFrameTime...
} }
} }

View File

@ -418,7 +418,9 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug) {
DrawAtracView(cfg_); DrawAtracView(cfg_);
} }
if (cfg_.hleModulesOpen) {
DrawHLEModules(cfg_); DrawHLEModules(cfg_);
}
if (cfg_.structViewerOpen) { if (cfg_.structViewerOpen) {
structViewer_.Draw(mipsDebug, &cfg_.structViewerOpen); structViewer_.Draw(mipsDebug, &cfg_.structViewerOpen);