Core: Apply DPI scaling to debug windows

This commit is contained in:
Connor McLaughlin 2020-02-28 16:59:51 +10:00
parent ce31c85983
commit 82eb14efb1
6 changed files with 30 additions and 19 deletions

View file

@ -1594,8 +1594,9 @@ void CDROM::DrawDebugWindow()
{
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 1.0f};
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
ImGui::SetNextWindowSize(ImVec2(800, 500), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(800.0f * framebuffer_scale, 500.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("CDROM State", &m_system->GetSettings().debugging.show_cdrom_state))
{
ImGui::End();

View file

@ -869,7 +869,9 @@ bool GPU::DumpVRAMToFile(const char* filename, u32 width, u32 height, u32 stride
void GPU::DrawDebugStateWindow()
{
ImGui::SetNextWindowSize(ImVec2(450, 550), ImGuiCond_FirstUseEver);
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
ImGui::SetNextWindowSize(ImVec2(450.0f * framebuffer_scale, 550.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("GPU", &m_system->GetSettings().debugging.show_gpu_state))
{
ImGui::End();
@ -888,7 +890,7 @@ void GPU::DrawDebugStateWindow()
const Stats& stats = m_last_stats;
ImGui::Columns(2);
ImGui::SetColumnWidth(0, 200.0f);
ImGui::SetColumnWidth(0, 200.0f * framebuffer_scale);
ImGui::TextUnformatted("Idle Frame: ");
ImGui::NextColumn();

View file

@ -475,7 +475,7 @@ void GPU_HW::DrawRendererStats(bool is_idle_frame)
const auto& stats = m_last_renderer_stats;
ImGui::Columns(2);
ImGui::SetColumnWidth(0, 200.0f);
ImGui::SetColumnWidth(0, 200.0f * ImGui::GetIO().DisplayFramebufferScale.x);
ImGui::TextUnformatted("Batches Drawn:");
ImGui::NextColumn();

View file

@ -705,7 +705,9 @@ void MDEC::HandleSetScaleCommand()
void MDEC::DrawDebugStateWindow()
{
ImGui::SetNextWindowSize(ImVec2(300, 350), ImGuiCond_FirstUseEver);
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
ImGui::SetNextWindowSize(ImVec2(300.0f * framebuffer_scale, 350.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("MDEC State", &m_system->GetSettings().debugging.show_mdec_state))
{
ImGui::End();

View file

@ -789,7 +789,8 @@ static constexpr ADSRTableEntries ComputeADSRTableEntries()
{
entries[decreasing][rate].ticks = 1;
if (decreasing != 0)
entries[decreasing][rate].step = static_cast<s32>(static_cast<u32>(-8 + static_cast<s32>(rate & 3)) << (11 - (rate >> 2)));
entries[decreasing][rate].step =
static_cast<s32>(static_cast<u32>(-8 + static_cast<s32>(rate & 3)) << (11 - (rate >> 2)));
else
entries[decreasing][rate].step = (7 - static_cast<s32>(rate & 3)) << (11 - (rate >> 2));
}
@ -1146,8 +1147,9 @@ void SPU::DrawDebugStateWindow()
{
static const ImVec4 active_color{1.0f, 1.0f, 1.0f, 1.0f};
static const ImVec4 inactive_color{0.4f, 0.4f, 0.4f, 1.0f};
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
ImGui::SetNextWindowSize(ImVec2(800, 600), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(800.0f * framebuffer_scale, 600.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("SPU State", &m_system->GetSettings().debugging.show_spu_state))
{
ImGui::End();
@ -1157,9 +1159,11 @@ void SPU::DrawDebugStateWindow()
// status
if (ImGui::CollapsingHeader("Status", ImGuiTreeNodeFlags_DefaultOpen))
{
static constexpr std::array<float, 6> offsets = {{100.0f, 200.0f, 300.0f, 420.0f, 500.0f, 600.0f}};
static constexpr std::array<const char*, 4> transfer_modes = {
{"Transfer Stopped", "Manual Write", "DMA Write", "DMA Read"}};
const std::array<float, 6> offsets = {{100.0f * framebuffer_scale, 200.0f * framebuffer_scale,
300.0f * framebuffer_scale, 420.0f * framebuffer_scale,
500.0f * framebuffer_scale, 600.0f * framebuffer_scale}};
ImGui::Text("Control: ");
ImGui::SameLine(offsets[0]);

View file

@ -341,7 +341,9 @@ void Timers::DrawDebugStateWindow()
{{"SysClk", "HBlank", "SysClk", "HBlank"}},
{{"SysClk", "DotClk", "SysClk/8", "SysClk/8"}}}};
ImGui::SetNextWindowSize(ImVec2(800, 100), ImGuiCond_FirstUseEver);
const float framebuffer_scale = ImGui::GetIO().DisplayFramebufferScale.x;
ImGui::SetNextWindowSize(ImVec2(800.0f * framebuffer_scale, 100.0f * framebuffer_scale), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Timer State", &m_system->GetSettings().debugging.show_timers_state))
{
ImGui::End();
@ -349,16 +351,16 @@ void Timers::DrawDebugStateWindow()
}
ImGui::Columns(NUM_COLUMNS);
ImGui::SetColumnWidth(0, 20.0f);
ImGui::SetColumnWidth(1, 50.0f);
ImGui::SetColumnWidth(2, 50.0f);
ImGui::SetColumnWidth(3, 100.0f);
ImGui::SetColumnWidth(4, 80.0f);
ImGui::SetColumnWidth(5, 80.0f);
ImGui::SetColumnWidth(6, 80.0f);
ImGui::SetColumnWidth(7, 80.0f);
ImGui::SetColumnWidth(8, 80.0f);
ImGui::SetColumnWidth(9, 80.0f);
ImGui::SetColumnWidth(0, 20.0f * framebuffer_scale);
ImGui::SetColumnWidth(1, 50.0f * framebuffer_scale);
ImGui::SetColumnWidth(2, 50.0f * framebuffer_scale);
ImGui::SetColumnWidth(3, 100.0f * framebuffer_scale);
ImGui::SetColumnWidth(4, 80.0f * framebuffer_scale);
ImGui::SetColumnWidth(5, 80.0f * framebuffer_scale);
ImGui::SetColumnWidth(6, 80.0f * framebuffer_scale);
ImGui::SetColumnWidth(7, 80.0f * framebuffer_scale);
ImGui::SetColumnWidth(8, 80.0f * framebuffer_scale);
ImGui::SetColumnWidth(9, 80.0f * framebuffer_scale);
for (const char* title : column_names)
{