From 83d948ef24e55fa682d2bba13e0506fc546f8509 Mon Sep 17 00:00:00 2001 From: Tobi-D7 Date: Fri, 22 Jul 2022 14:55:16 +0200 Subject: [PATCH] Calculate MT CPU/GPU Persentage by Framerate --- bmp.hpp | 2 +- renderd7.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bmp.hpp b/bmp.hpp index 251a364..82d8674 100644 --- a/bmp.hpp +++ b/bmp.hpp @@ -241,7 +241,7 @@ struct BMP { uint32_t channels = bmp_info_header.bit_count / 8; for (uint32_t y = y0; y < y0 + h; ++y) { for (uint32_t x = x0; x < x0 + w; ++x) { - if (!(x + w > (uint32_t)bmp_info_header.width) || this->bmp_info_header.height - y - h < (uint32_t)0) { + if ((x + w < (uint32_t)bmp_info_header.width) || this->bmp_info_header.height - y - h > 0) { data[channels * (y * bmp_info_header.width + x) + 0] = B; data[channels * (y * bmp_info_header.width + x) + 1] = G; diff --git a/renderd7.cpp b/renderd7.cpp index 936c572..6f0d90f 100644 --- a/renderd7.cpp +++ b/renderd7.cpp @@ -1144,8 +1144,8 @@ void RenderD7::DrawMetrikOvl() std::string info = "RenderD7 " + __C + " Debug Overlay"; float infoy = 240 - RenderD7::GetTextHeight(mt_txtSize, info); mt_fps = "FPS: " + RenderD7::GetFramerate(); - mt_cpu = "CPU: " + std::to_string(C3D_GetProcessingTime()*6.0f).substr(0, 4) + "%/" + std::to_string(C3D_GetProcessingTime()).substr(0, 4) + "ms"; - mt_gpu = "GPU: " + std::to_string(C3D_GetDrawingTime()*6.0f).substr(0, 4) + "%/" + std::to_string(C3D_GetDrawingTime()).substr(0, 4) + "ms"; + mt_cpu = "CPU: " + std::to_string(C3D_GetProcessingTime()*(d11framerate/10)).substr(0, 4) + "%/" + std::to_string(C3D_GetProcessingTime()).substr(0, 4) + "ms"; + mt_gpu = "GPU: " + std::to_string(C3D_GetDrawingTime()*(d11framerate/10)).substr(0, 4) + "%/" + std::to_string(C3D_GetDrawingTime()).substr(0, 4) + "ms"; mt_cmd = "CMD: " + std::to_string(C3D_GetCmdBufUsage()*100.0f).substr(0, 4) + "%/" + std::to_string(C3D_GetCmdBufUsage()).substr(0, 4) + "ms"; RenderD7::DrawRect(0, 0, RenderD7::GetTextWidth(mt_txtSize, mt_fps), RenderD7::GetTextHeight(mt_txtSize, mt_fps), mt_color); RenderD7::DrawRect(0, 50, RenderD7::GetTextWidth(mt_txtSize, mt_cpu), RenderD7::GetTextHeight(mt_txtSize, mt_cpu), mt_color); @@ -1325,6 +1325,7 @@ void RenderD7::RSettings::Logic(u32 hDown, u32 hHeld, u32 hUp, touchPosition tou if (d7_hDown & KEY_TOUCH && RenderD7::touchTObj(d7_touch, buttons[3]) && !metrikd) { cfgstruct["settings"]["forceFrameRate"] = Kbd(2, SWKBD_TYPE_NUMPAD); + C3D_FrameRate(RenderD7::Convert::StringtoFloat(cfgstruct["settings"]["forceFrameRate"])); } if (d7_hDown & KEY_TOUCH && RenderD7::touchTObj(d7_touch, buttons[4])) {