mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-11 13:36:24 +02:00
Linux warning fixes
This commit is contained in:
1 parent
0f9c97c2a0
commit
01d96fd949
2 files changed
+46
-25
No files matched your search
+14
-10
@@ -4,6 +4,8 @@
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/Buffer.h"
|
||||
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/HW/Display.h"
|
||||
#include "Core/FrameTiming.h"
|
||||
@@ -452,32 +454,34 @@ void DrawFPS(UIContext *ctx, const Bounds &bounds) {
|
||||
float vps, fps, actual_fps;
|
||||
__DisplayGetFPS(&vps, &fps, &actual_fps);
|
||||
|
||||
char fpsbuf[256];
|
||||
fpsbuf[0] = '\0';
|
||||
Buffer buffer;
|
||||
if ((g_Config.iShowStatusFlags & ((int)ShowStatusFlags::FPS_COUNTER | (int)ShowStatusFlags::SPEED_COUNTER)) == ((int)ShowStatusFlags::FPS_COUNTER | (int)ShowStatusFlags::SPEED_COUNTER)) {
|
||||
snprintf(fpsbuf, sizeof(fpsbuf), "%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / ((g_Config.iDisplayRefreshRate / 60.0f * 59.94f) / 100.0f));
|
||||
// Both at the same time gets a shorter formulation.
|
||||
buffer.Printf("%0.0f/%0.0f (%0.1f%%)", actual_fps, fps, vps / ((g_Config.iDisplayRefreshRate / 60.0f * 59.94f) / 100.0f));
|
||||
} else {
|
||||
if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::FPS_COUNTER) {
|
||||
snprintf(fpsbuf, sizeof(fpsbuf), "FPS: %0.1f", actual_fps);
|
||||
buffer.Printf("FPS: %0.1f", actual_fps);
|
||||
} else if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::SPEED_COUNTER) {
|
||||
snprintf(fpsbuf, sizeof(fpsbuf), "Speed: %0.1f%%", vps / (59.94f / 100.0f));
|
||||
buffer.Printf("Speed: %0.1f%%", vps / (59.94f / 100.0f));
|
||||
}
|
||||
}
|
||||
|
||||
if (System_GetPropertyBool(SYSPROP_CAN_READ_BATTERY_PERCENTAGE)) {
|
||||
if (g_Config.iShowStatusFlags & (int)ShowStatusFlags::BATTERY_PERCENT) {
|
||||
char temp[256];
|
||||
const int percentage = System_GetPropertyInt(SYSPROP_BATTERY_PERCENTAGE);
|
||||
snprintf(temp, sizeof(temp), "%s Battery: %d%%", fpsbuf, percentage);
|
||||
snprintf(fpsbuf, sizeof(fpsbuf), "%s", temp);
|
||||
// Just plain append battery. Add linebreak?
|
||||
buffer.Printf(" Battery: %d%%", percentage);
|
||||
}
|
||||
}
|
||||
|
||||
ctx->Flush();
|
||||
|
||||
std::string fpsBuf;
|
||||
buffer.TakeAll(&fpsBuf);
|
||||
ctx->BindFontTexture();
|
||||
ctx->Draw()->SetFontScale(0.7f, 0.7f);
|
||||
ctx->Draw()->DrawText(ubuntu24, fpsbuf, bounds.x2() - 8, 20, 0xc0000000, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII);
|
||||
ctx->Draw()->DrawText(ubuntu24, fpsbuf, bounds.x2() - 10, 19, 0xFF3fFF3f, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII);
|
||||
ctx->Draw()->DrawText(ubuntu24, fpsBuf, bounds.x2() - 8, 20, 0xc0000000, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII);
|
||||
ctx->Draw()->DrawText(ubuntu24, fpsBuf, bounds.x2() - 10, 19, 0xFF3fFF3f, ALIGN_TOPRIGHT | FLAG_DYNAMIC_ASCII);
|
||||
ctx->Draw()->SetFontScale(1.0f, 1.0f);
|
||||
ctx->Flush();
|
||||
ctx->RebindTexture();
|
||||
|
||||
Reference in new issue
Block a user