SDL: Display internal FPS/VPS seperately
This commit is contained in:
parent
1400534127
commit
8aed0cc174
|
@ -483,9 +483,12 @@ void SDLInterface::RenderMainMenuBar()
|
|||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 80.0f);
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 170.0f);
|
||||
ImGui::Text("FPS: %.2f", m_fps);
|
||||
|
||||
ImGui::SetCursorPosX(ImGui::GetIO().DisplaySize.x - 80.0f);
|
||||
ImGui::Text("VPS: %.2f", m_vps);
|
||||
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
|
@ -581,12 +584,14 @@ void SDLInterface::Run()
|
|||
|
||||
// update fps counter
|
||||
{
|
||||
m_fps_counter++;
|
||||
const double time = m_fps_timer.GetTimeSeconds();
|
||||
if (time >= 0.25f)
|
||||
{
|
||||
m_fps = static_cast<float>(m_fps_counter / time);
|
||||
m_fps_counter = 0;
|
||||
m_vps = static_cast<float>(static_cast<double>(m_system->GetFrameNumber() - m_last_frame_number) / time);
|
||||
m_last_frame_number = m_system->GetFrameNumber();
|
||||
m_fps = static_cast<float>(
|
||||
static_cast<double>(m_system->GetInternalFrameNumber() - m_last_internal_frame_number) / time);
|
||||
m_last_internal_frame_number = m_system->GetInternalFrameNumber();
|
||||
m_fps_timer.Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,7 +78,9 @@ private:
|
|||
|
||||
std::shared_ptr<DigitalController> m_controller;
|
||||
|
||||
float m_vps = 0.0f;
|
||||
float m_fps = 0.0f;
|
||||
u32 m_fps_counter = 0;
|
||||
u32 m_last_frame_number = 0;
|
||||
u32 m_last_internal_frame_number = 0;
|
||||
Timer m_fps_timer;
|
||||
};
|
||||
|
|
|
@ -499,6 +499,7 @@ void GPU::WriteGP1(u32 value)
|
|||
{
|
||||
m_crtc_state.regs.display_address_start = param & CRTCState::Regs::DISPLAY_ADDRESS_START_MASK;
|
||||
Log_DebugPrintf("Display address start <- 0x%08X", m_crtc_state.regs.display_address_start);
|
||||
m_system->IncrementInternalFrameNumber();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@ public:
|
|||
HostInterface* GetHostInterface() const { return m_host_interface; }
|
||||
|
||||
u32 GetFrameNumber() const { return m_frame_number; }
|
||||
u32 GetInternalFrameNumber() const { return m_internal_frame_number; }
|
||||
void IncrementFrameNumber() { m_frame_number++; }
|
||||
void IncrementInternalFrameNumber() { m_internal_frame_number++; }
|
||||
|
||||
bool Initialize();
|
||||
void Reset();
|
||||
|
@ -68,4 +70,5 @@ private:
|
|||
std::unique_ptr<Timers> m_timers;
|
||||
std::unique_ptr<SPU> m_spu;
|
||||
u32 m_frame_number = 1;
|
||||
u32 m_internal_frame_number = 1;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue