mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Added StatsRows setting
This commit is contained in:
parent
2e859b0918
commit
17098e518d
@ -31,6 +31,7 @@
|
||||
#include <Config/Settings/SpriteTexCoord.h>
|
||||
#include <Config/Settings/StatsColumns.h>
|
||||
#include <Config/Settings/StatsHotKey.h>
|
||||
#include <Config/Settings/StatsRows.h>
|
||||
#include <Config/Settings/SupportedResolutions.h>
|
||||
#include <Config/Settings/SupportedDepthFormats.h>
|
||||
#include <Config/Settings/SupportedTextureFormats.h>
|
||||
@ -76,6 +77,7 @@ namespace Config
|
||||
Settings::SpriteTexCoord spriteTexCoord;
|
||||
Settings::StatsColumns statsColumns;
|
||||
Settings::StatsHotKey statsHotKey;
|
||||
Settings::StatsRows statsRows;
|
||||
Settings::SupportedResolutions supportedResolutions;
|
||||
Settings::SupportedDepthFormats supportedDepthFormats;
|
||||
Settings::SupportedTextureFormats supportedTextureFormats;
|
||||
|
55
DDrawCompat/Config/Settings/StatsRows.h
Normal file
55
DDrawCompat/Config/Settings/StatsRows.h
Normal file
@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <Config/EnumListSetting.h>
|
||||
|
||||
namespace Config
|
||||
{
|
||||
namespace Settings
|
||||
{
|
||||
class StatsRows : public EnumListSetting
|
||||
{
|
||||
public:
|
||||
enum Values {
|
||||
LABEL,
|
||||
PRESENTCOUNT,
|
||||
PRESENTRATE,
|
||||
PRESENTTIME,
|
||||
FLIPCOUNT,
|
||||
FLIPRATE,
|
||||
FLIPTIME,
|
||||
BLITCOUNT,
|
||||
BLITRATE,
|
||||
BLITTIME,
|
||||
LOCKCOUNT,
|
||||
LOCKRATE,
|
||||
LOCKTIME,
|
||||
DDIUSAGE,
|
||||
GDIOBJECTS
|
||||
};
|
||||
|
||||
StatsRows()
|
||||
: EnumListSetting("StatsRows", "label, presentrate, fliprate, blitcount, lockcount, ddiusage",
|
||||
{
|
||||
"label",
|
||||
"presentcount",
|
||||
"presentrate",
|
||||
"presenttime",
|
||||
"flipcount",
|
||||
"fliprate",
|
||||
"fliptime",
|
||||
"blitcount",
|
||||
"blitrate",
|
||||
"blittime",
|
||||
"lockcount",
|
||||
"lockrate",
|
||||
"locktime",
|
||||
"ddiusage",
|
||||
"gdiobjects"
|
||||
})
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
extern Settings::StatsRows statsRows;
|
||||
}
|
@ -195,6 +195,7 @@
|
||||
<ClInclude Include="Config\Settings\SpriteTexCoord.h" />
|
||||
<ClInclude Include="Config\Settings\StatsColumns.h" />
|
||||
<ClInclude Include="Config\Settings\StatsHotKey.h" />
|
||||
<ClInclude Include="Config\Settings\StatsRows.h" />
|
||||
<ClInclude Include="Config\Settings\SupportedDepthFormats.h" />
|
||||
<ClInclude Include="Config\Settings\SupportedResolutions.h" />
|
||||
<ClInclude Include="Config\Settings\SupportedTextureFormats.h" />
|
||||
|
@ -675,6 +675,9 @@
|
||||
<ClInclude Include="Config\BoolSetting.h">
|
||||
<Filter>Header Files\Config</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Config\Settings\StatsRows.h">
|
||||
<Filter>Header Files\Config\Settings</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Gdi\Gdi.cpp">
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
const int NAME_LABEL_WIDTH = 70;
|
||||
const int NAME_LABEL_WIDTH = 80;
|
||||
const int VALUE_LABEL_WIDTH = 40;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <Common/Time.h>
|
||||
#include <Config/Settings/StatsHotKey.h>
|
||||
#include <Config/Settings/StatsRows.h>
|
||||
#include <Gdi/GuiThread.h>
|
||||
#include <Input/Input.h>
|
||||
#include <Overlay/ConfigWindow.h>
|
||||
@ -61,29 +62,49 @@ namespace
|
||||
|
||||
StatsQueue& m_statsQueue;
|
||||
};
|
||||
|
||||
const int ROW_HEIGHT = 15;
|
||||
}
|
||||
|
||||
namespace Overlay
|
||||
{
|
||||
StatsWindow::StatsWindow()
|
||||
: Window(nullptr, { 0, 0, StatsControl::getWidth(), 105 + BORDER}, 0, Config::statsHotKey.get())
|
||||
: Window(nullptr,
|
||||
{ 0, 0, StatsControl::getWidth(), static_cast<int>(Config::statsRows.get().size()) * ROW_HEIGHT + BORDER },
|
||||
0, Config::statsHotKey.get())
|
||||
{
|
||||
addControl("", [](StatsQueue::TickCount) { return std::array<std::string, 4>{ "cur", "avg", "min", "max" }; },
|
||||
WS_VISIBLE | WS_DISABLED).update(0);
|
||||
addControl("Present rate", UpdateStats(m_present.m_rate));
|
||||
addControl("Flip rate", UpdateStats(m_flip.m_rate));
|
||||
addControl("Blit count", UpdateStats(m_blit.m_count));
|
||||
addControl("Lock count", UpdateStats(m_lock.m_count));
|
||||
addControl("DDI usage", UpdateStats(m_ddiUsage));
|
||||
addControl("GDI objects", UpdateStats(m_gdiObjects));
|
||||
m_statsRows.push_back({ "", [](auto) { return std::array<std::string, 4>{ "cur", "avg", "min", "max" }; },
|
||||
WS_VISIBLE | WS_DISABLED });
|
||||
m_statsRows.push_back({ "Present count", UpdateStats(m_present.m_count) });
|
||||
m_statsRows.push_back({ "Present rate", UpdateStats(m_present.m_rate) });
|
||||
m_statsRows.push_back({ "Present time", UpdateStats(m_present.m_time) });
|
||||
m_statsRows.push_back({ "Flip count", UpdateStats(m_flip.m_count) });
|
||||
m_statsRows.push_back({ "Flip rate", UpdateStats(m_flip.m_rate) });
|
||||
m_statsRows.push_back({ "Flip time", UpdateStats(m_flip.m_time) });
|
||||
m_statsRows.push_back({ "Blit count", UpdateStats(m_blit.m_count) });
|
||||
m_statsRows.push_back({ "Blit rate", UpdateStats(m_blit.m_rate) });
|
||||
m_statsRows.push_back({ "Blit time", UpdateStats(m_blit.m_time) });
|
||||
m_statsRows.push_back({ "Lock count", UpdateStats(m_lock.m_count) });
|
||||
m_statsRows.push_back({ "Lock rate", UpdateStats(m_lock.m_rate) });
|
||||
m_statsRows.push_back({ "Lock time", UpdateStats(m_lock.m_time) });
|
||||
m_statsRows.push_back({ "DDI usage", UpdateStats(m_ddiUsage) });
|
||||
m_statsRows.push_back({ "GDI objects", UpdateStats(m_gdiObjects) });
|
||||
|
||||
for (auto statsRowIndex : Config::statsRows.get())
|
||||
{
|
||||
auto& statsRow = m_statsRows[statsRowIndex];
|
||||
auto& statsControl = addControl(statsRow.name, statsRow.updateFunc, statsRow.style);
|
||||
if (statsRow.style & WS_DISABLED)
|
||||
{
|
||||
statsControl.update(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatsControl& StatsWindow::addControl(const std::string& name, StatsControl::UpdateFunc updateFunc, DWORD style)
|
||||
{
|
||||
const int index = m_statsControls.size();
|
||||
const int rowHeight = 15;
|
||||
|
||||
RECT rect = { 0, index * rowHeight + BORDER / 2, m_rect.right, (index + 1) * rowHeight + BORDER / 2 };
|
||||
RECT rect = { 0, index * ROW_HEIGHT + BORDER / 2, m_rect.right, (index + 1) * ROW_HEIGHT + BORDER / 2 };
|
||||
return m_statsControls.emplace_back(*this, rect, name, updateFunc, style);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <Overlay/StatsControl.h>
|
||||
#include <Overlay/StatsEventGroup.h>
|
||||
@ -27,12 +28,20 @@ namespace Overlay
|
||||
StatsQueue m_gdiObjects;
|
||||
|
||||
private:
|
||||
struct StatsRow
|
||||
{
|
||||
const char* name;
|
||||
StatsControl::UpdateFunc updateFunc;
|
||||
DWORD style;
|
||||
};
|
||||
|
||||
StatsControl& addControl(const std::string& name, StatsControl::UpdateFunc updateFunc, DWORD style = WS_VISIBLE);
|
||||
|
||||
virtual RECT calculateRect(const RECT& monitorRect) const override;
|
||||
virtual HWND getTopmost() const override;
|
||||
|
||||
std::list<StatsControl> m_statsControls;
|
||||
std::vector<StatsRow> m_statsRows;
|
||||
uint64_t m_tickCount;
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user