mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-14 08:12:16 +00:00
imgui: Displays FPS color based on FPS (#2437)
This commit is contained in:
parent
82cacec8eb
commit
bdf4a5249d
3 changed files with 20 additions and 0 deletions
|
@ -68,6 +68,7 @@ static bool vkCrashDiagnostic = false;
|
||||||
static bool vkHostMarkers = false;
|
static bool vkHostMarkers = false;
|
||||||
static bool vkGuestMarkers = false;
|
static bool vkGuestMarkers = false;
|
||||||
static bool rdocEnable = false;
|
static bool rdocEnable = false;
|
||||||
|
static bool isFpsColor = true;
|
||||||
static s16 cursorState = HideCursorState::Idle;
|
static s16 cursorState = HideCursorState::Idle;
|
||||||
static int cursorHideTimeout = 5; // 5 seconds (default)
|
static int cursorHideTimeout = 5; // 5 seconds (default)
|
||||||
static bool useUnifiedInputConfig = true;
|
static bool useUnifiedInputConfig = true;
|
||||||
|
@ -282,6 +283,10 @@ bool isRdocEnabled() {
|
||||||
return rdocEnable;
|
return rdocEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool fpsColor() {
|
||||||
|
return isFpsColor;
|
||||||
|
}
|
||||||
|
|
||||||
u32 vblankDiv() {
|
u32 vblankDiv() {
|
||||||
return vblankDivider;
|
return vblankDivider;
|
||||||
}
|
}
|
||||||
|
@ -757,6 +762,7 @@ void load(const std::filesystem::path& path) {
|
||||||
|
|
||||||
isDebugDump = toml::find_or<bool>(debug, "DebugDump", false);
|
isDebugDump = toml::find_or<bool>(debug, "DebugDump", false);
|
||||||
isShaderDebug = toml::find_or<bool>(debug, "CollectShader", false);
|
isShaderDebug = toml::find_or<bool>(debug, "CollectShader", false);
|
||||||
|
isFpsColor = toml::find_or<bool>(debug, "FPSColor", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.contains("GUI")) {
|
if (data.contains("GUI")) {
|
||||||
|
@ -881,6 +887,7 @@ void save(const std::filesystem::path& path) {
|
||||||
data["Vulkan"]["rdocEnable"] = rdocEnable;
|
data["Vulkan"]["rdocEnable"] = rdocEnable;
|
||||||
data["Debug"]["DebugDump"] = isDebugDump;
|
data["Debug"]["DebugDump"] = isDebugDump;
|
||||||
data["Debug"]["CollectShader"] = isShaderDebug;
|
data["Debug"]["CollectShader"] = isShaderDebug;
|
||||||
|
data["Debug"]["FPSColor"] = isFpsColor;
|
||||||
|
|
||||||
data["Keys"]["TrophyKey"] = trophyKey;
|
data["Keys"]["TrophyKey"] = trophyKey;
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ bool copyGPUCmdBuffers();
|
||||||
bool dumpShaders();
|
bool dumpShaders();
|
||||||
bool patchShaders();
|
bool patchShaders();
|
||||||
bool isRdocEnabled();
|
bool isRdocEnabled();
|
||||||
|
bool fpsColor();
|
||||||
u32 vblankDiv();
|
u32 vblankDiv();
|
||||||
|
|
||||||
void setDebugDump(bool enable);
|
void setDebugDump(bool enable);
|
||||||
|
|
|
@ -259,7 +259,19 @@ void L::DrawAdvanced() {
|
||||||
|
|
||||||
void L::DrawSimple() {
|
void L::DrawSimple() {
|
||||||
const float frameRate = DebugState.Framerate;
|
const float frameRate = DebugState.Framerate;
|
||||||
|
if (Config::fpsColor()) {
|
||||||
|
if (frameRate < 10) {
|
||||||
|
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); // Red
|
||||||
|
} else if (frameRate >= 10 && frameRate < 20) {
|
||||||
|
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.5f, 0.0f, 1.0f)); // Orange
|
||||||
|
} else {
|
||||||
|
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); // White
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 1.0f, 1.0f, 1.0f)); // White
|
||||||
|
}
|
||||||
Text("%d FPS (%.1f ms)", static_cast<int>(std::round(frameRate)), 1000.0f / frameRate);
|
Text("%d FPS (%.1f ms)", static_cast<int>(std::round(frameRate)), 1000.0f / frameRate);
|
||||||
|
PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadSettings(const char* line) {
|
static void LoadSettings(const char* line) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue