summaryrefslogtreecommitdiffstats
path: root/src/yuzu_cmd
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-10-04 21:51:03 +0200
committerGitHub <noreply@github.com>2019-10-04 21:51:03 +0200
commit94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35 (patch)
treec24ee7f0b9938cc9186ebd335e5de3a4841619cf /src/yuzu_cmd
parentMerge pull request #2936 from VPeruS/use-isallzeroarray (diff)
parentAdd FPS to SDL title bar (diff)
downloadyuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.tar
yuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.tar.gz
yuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.tar.bz2
yuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.tar.lz
yuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.tar.xz
yuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.tar.zst
yuzu-94c34f23d7ba951e5f2b3afa7f1ad5a5ea170e35.zip
Diffstat (limited to 'src/yuzu_cmd')
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.cpp12
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2.h3
-rw-r--r--src/yuzu_cmd/yuzu.cpp4
3 files changed, 17 insertions, 2 deletions
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
index a6edc089a..aa69cc9c8 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp
@@ -4,6 +4,8 @@
#include <SDL.h>
#include "common/logging/log.h"
+#include "common/scm_rev.h"
+#include "core/core.h"
#include "input_common/keyboard.h"
#include "input_common/main.h"
#include "input_common/motion_emu.h"
@@ -170,6 +172,16 @@ void EmuWindow_SDL2::PollEvents() {
break;
}
}
+
+ const u32 current_time = SDL_GetTicks();
+ if (current_time > last_time + 2000) {
+ const auto results = Core::System::GetInstance().GetAndResetPerfStats();
+ const auto title = fmt::format(
+ "yuzu {} | {}-{} | FPS: {:.0f} ({:.0%})", Common::g_build_fullname,
+ Common::g_scm_branch, Common::g_scm_desc, results.game_fps, results.emulation_speed);
+ SDL_SetWindowTitle(render_window, title.c_str());
+ last_time = current_time;
+ }
}
void EmuWindow_SDL2::OnMinimalClientAreaChangeRequest(std::pair<unsigned, unsigned> minimal_size) {
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.h b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
index d8051ebdf..eaa971f77 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2.h
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.h
@@ -60,4 +60,7 @@ protected:
/// Internal SDL2 render window
SDL_Window* render_window;
+
+ /// Keeps track of how often to update the title bar during gameplay
+ u32 last_time = 0;
};
diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp
index bac05b959..3ee088a91 100644
--- a/src/yuzu_cmd/yuzu.cpp
+++ b/src/yuzu_cmd/yuzu.cpp
@@ -186,8 +186,6 @@ int main(int argc, char** argv) {
system.SetFilesystem(std::make_shared<FileSys::RealVfsFilesystem>());
system.GetFileSystemController().CreateFactories(*system.GetFilesystem());
- SCOPE_EXIT({ system.Shutdown(); });
-
const Core::System::ResultStatus load_result{system.Load(*emu_window, filepath)};
switch (load_result) {
@@ -227,6 +225,8 @@ int main(int argc, char** argv) {
system.RunLoop();
}
+ system.Shutdown();
+
detached_tasks.WaitForAllTasks();
return 0;
}