summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/core_timing.cpp4
-rw-r--r--src/core/core_timing.h3
-rw-r--r--src/core/hle/kernel/event.h12
-rw-r--r--src/core/perf_stats.cpp17
-rw-r--r--src/core/perf_stats.h8
-rw-r--r--src/video_core/engines/maxwell_3d.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp14
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h11
-rw-r--r--src/yuzu/about_dialog.cpp2
-rw-r--r--src/yuzu/about_dialog.h2
-rw-r--r--src/yuzu/bootmanager.h2
-rw-r--r--src/yuzu/configuration/configure_debug.cpp2
-rw-r--r--src/yuzu/configuration/configure_dialog.cpp2
-rw-r--r--src/yuzu/configuration/configure_general.cpp2
-rw-r--r--src/yuzu/configuration/configure_graphics.cpp2
-rw-r--r--src/yuzu/configuration/configure_system.cpp2
-rw-r--r--src/yuzu/debugger/graphics/graphics_surface.cpp3
-rw-r--r--src/yuzu/debugger/graphics/graphics_surface.h6
-rw-r--r--src/yuzu/debugger/wait_tree.cpp4
-rw-r--r--src/yuzu/debugger/wait_tree.h4
-rw-r--r--src/yuzu/game_list_p.h17
-rw-r--r--src/yuzu/main.cpp42
-rw-r--r--src/yuzu/main.h2
23 files changed, 94 insertions, 71 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index b2e3a495a..d3bb6f818 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -226,8 +226,8 @@ void Idle() {
226 downcount = 0; 226 downcount = 0;
227} 227}
228 228
229u64 GetGlobalTimeUs() { 229std::chrono::microseconds GetGlobalTimeUs() {
230 return GetTicks() * 1000000 / BASE_CLOCK_RATE; 230 return std::chrono::microseconds{GetTicks() * 1000000 / BASE_CLOCK_RATE};
231} 231}
232 232
233int GetDowncount() { 233int GetDowncount() {
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index 5bbde47f4..dfa161c0d 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -17,6 +17,7 @@
17 * ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever") 17 * ScheduleEvent(periodInCycles - cyclesLate, callback, "whatever")
18 */ 18 */
19 19
20#include <chrono>
20#include <functional> 21#include <functional>
21#include <string> 22#include <string>
22#include "common/common_types.h" 23#include "common/common_types.h"
@@ -86,7 +87,7 @@ void ClearPendingEvents();
86 87
87void ForceExceptionCheck(s64 cycles); 88void ForceExceptionCheck(s64 cycles);
88 89
89u64 GetGlobalTimeUs(); 90std::chrono::microseconds GetGlobalTimeUs();
90 91
91int GetDowncount(); 92int GetDowncount();
92 93
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index 1c99911b2..3c20c05e8 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -31,10 +31,9 @@ public:
31 return HANDLE_TYPE; 31 return HANDLE_TYPE;
32 } 32 }
33 33
34 ResetType reset_type; ///< Current ResetType 34 ResetType GetResetType() const {
35 35 return reset_type;
36 bool signaled; ///< Whether the event has already been signaled 36 }
37 std::string name; ///< Name of event (optional)
38 37
39 bool ShouldWait(Thread* thread) const override; 38 bool ShouldWait(Thread* thread) const override;
40 void Acquire(Thread* thread) override; 39 void Acquire(Thread* thread) override;
@@ -47,6 +46,11 @@ public:
47private: 46private:
48 Event(); 47 Event();
49 ~Event() override; 48 ~Event() override;
49
50 ResetType reset_type; ///< Current ResetType
51
52 bool signaled; ///< Whether the event has already been signaled
53 std::string name; ///< Name of event (optional)
50}; 54};
51 55
52} // namespace Kernel 56} // namespace Kernel
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp
index 5f53b16d3..8e09b9b63 100644
--- a/src/core/perf_stats.cpp
+++ b/src/core/perf_stats.cpp
@@ -40,22 +40,21 @@ void PerfStats::EndGameFrame() {
40 game_frames += 1; 40 game_frames += 1;
41} 41}
42 42
43PerfStats::Results PerfStats::GetAndResetStats(u64 current_system_time_us) { 43PerfStats::Results PerfStats::GetAndResetStats(microseconds current_system_time_us) {
44 std::lock_guard<std::mutex> lock(object_mutex); 44 std::lock_guard<std::mutex> lock(object_mutex);
45 45
46 auto now = Clock::now(); 46 const auto now = Clock::now();
47 // Walltime elapsed since stats were reset 47 // Walltime elapsed since stats were reset
48 auto interval = duration_cast<DoubleSecs>(now - reset_point).count(); 48 const auto interval = duration_cast<DoubleSecs>(now - reset_point).count();
49 49
50 auto system_us_per_second = 50 const auto system_us_per_second = (current_system_time_us - reset_point_system_us) / interval;
51 static_cast<double>(current_system_time_us - reset_point_system_us) / interval;
52 51
53 Results results{}; 52 Results results{};
54 results.system_fps = static_cast<double>(system_frames) / interval; 53 results.system_fps = static_cast<double>(system_frames) / interval;
55 results.game_fps = static_cast<double>(game_frames) / interval; 54 results.game_fps = static_cast<double>(game_frames) / interval;
56 results.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() / 55 results.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() /
57 static_cast<double>(system_frames); 56 static_cast<double>(system_frames);
58 results.emulation_speed = system_us_per_second / 1'000'000.0; 57 results.emulation_speed = system_us_per_second.count() / 1'000'000.0;
59 58
60 // Reset counters 59 // Reset counters
61 reset_point = now; 60 reset_point = now;
@@ -74,10 +73,10 @@ double PerfStats::GetLastFrameTimeScale() {
74 return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; 73 return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH;
75} 74}
76 75
77void FrameLimiter::DoFrameLimiting(u64 current_system_time_us) { 76void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) {
78 // Max lag caused by slow frames. Can be adjusted to compensate for too many slow frames. Higher 77 // Max lag caused by slow frames. Can be adjusted to compensate for too many slow frames. Higher
79 // values increase the time needed to recover and limit framerate again after spikes. 78 // values increase the time needed to recover and limit framerate again after spikes.
80 constexpr microseconds MAX_LAG_TIME_US = 25ms; 79 constexpr microseconds MAX_LAG_TIME_US = 25us;
81 80
82 if (!Settings::values.toggle_framelimit) { 81 if (!Settings::values.toggle_framelimit) {
83 return; 82 return;
@@ -85,7 +84,7 @@ void FrameLimiter::DoFrameLimiting(u64 current_system_time_us) {
85 84
86 auto now = Clock::now(); 85 auto now = Clock::now();
87 86
88 frame_limiting_delta_err += microseconds(current_system_time_us - previous_system_time_us); 87 frame_limiting_delta_err += current_system_time_us - previous_system_time_us;
89 frame_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); 88 frame_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime);
90 frame_limiting_delta_err = 89 frame_limiting_delta_err =
91 std::clamp(frame_limiting_delta_err, -MAX_LAG_TIME_US, MAX_LAG_TIME_US); 90 std::clamp(frame_limiting_delta_err, -MAX_LAG_TIME_US, MAX_LAG_TIME_US);
diff --git a/src/core/perf_stats.h b/src/core/perf_stats.h
index 362b205c8..6e4619701 100644
--- a/src/core/perf_stats.h
+++ b/src/core/perf_stats.h
@@ -33,7 +33,7 @@ public:
33 void EndSystemFrame(); 33 void EndSystemFrame();
34 void EndGameFrame(); 34 void EndGameFrame();
35 35
36 Results GetAndResetStats(u64 current_system_time_us); 36 Results GetAndResetStats(std::chrono::microseconds current_system_time_us);
37 37
38 /** 38 /**
39 * Gets the ratio between walltime and the emulated time of the previous system frame. This is 39 * Gets the ratio between walltime and the emulated time of the previous system frame. This is
@@ -47,7 +47,7 @@ private:
47 /// Point when the cumulative counters were reset 47 /// Point when the cumulative counters were reset
48 Clock::time_point reset_point = Clock::now(); 48 Clock::time_point reset_point = Clock::now();
49 /// System time when the cumulative counters were reset 49 /// System time when the cumulative counters were reset
50 u64 reset_point_system_us = 0; 50 std::chrono::microseconds reset_point_system_us{0};
51 51
52 /// Cumulative duration (excluding v-sync/frame-limiting) of frames since last reset 52 /// Cumulative duration (excluding v-sync/frame-limiting) of frames since last reset
53 Clock::duration accumulated_frametime = Clock::duration::zero(); 53 Clock::duration accumulated_frametime = Clock::duration::zero();
@@ -68,11 +68,11 @@ class FrameLimiter {
68public: 68public:
69 using Clock = std::chrono::high_resolution_clock; 69 using Clock = std::chrono::high_resolution_clock;
70 70
71 void DoFrameLimiting(u64 current_system_time_us); 71 void DoFrameLimiting(std::chrono::microseconds current_system_time_us);
72 72
73private: 73private:
74 /// Emulated system time (in microseconds) at the last limiter invocation 74 /// Emulated system time (in microseconds) at the last limiter invocation
75 u64 previous_system_time_us = 0; 75 std::chrono::microseconds previous_system_time_us{0};
76 /// Walltime at the last limiter invocation 76 /// Walltime at the last limiter invocation
77 Clock::time_point previous_walltime = Clock::now(); 77 Clock::time_point previous_walltime = Clock::now();
78 78
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index a235b543e..5c0ae8009 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -285,8 +285,6 @@ Texture::TICEntry Maxwell3D::GetTICEntry(u32 tic_index) const {
285 285
286 // TODO(Subv): Different data types for separate components are not supported 286 // TODO(Subv): Different data types for separate components are not supported
287 ASSERT(r_type == g_type && r_type == b_type && r_type == a_type); 287 ASSERT(r_type == g_type && r_type == b_type && r_type == a_type);
288 // TODO(Subv): Only UNORM formats are supported for now.
289 ASSERT(r_type == Texture::ComponentType::UNORM);
290 288
291 return tic_entry; 289 return tic_entry;
292} 290}
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index c8f0c4e28..257aa9571 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -46,6 +46,8 @@ struct FormatTuple {
46 params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format)); 46 params.height = Common::AlignUp(config.tic.Height(), GetCompressionFactor(params.pixel_format));
47 params.unaligned_height = config.tic.Height(); 47 params.unaligned_height = config.tic.Height();
48 params.size_in_bytes = params.SizeInBytes(); 48 params.size_in_bytes = params.SizeInBytes();
49 params.cache_width = Common::AlignUp(params.width, 16);
50 params.cache_height = Common::AlignUp(params.height, 16);
49 return params; 51 return params;
50} 52}
51 53
@@ -63,6 +65,8 @@ struct FormatTuple {
63 params.height = config.height; 65 params.height = config.height;
64 params.unaligned_height = config.height; 66 params.unaligned_height = config.height;
65 params.size_in_bytes = params.SizeInBytes(); 67 params.size_in_bytes = params.SizeInBytes();
68 params.cache_width = Common::AlignUp(params.width, 16);
69 params.cache_height = Common::AlignUp(params.height, 16);
66 return params; 70 return params;
67} 71}
68 72
@@ -82,6 +86,8 @@ struct FormatTuple {
82 params.height = zeta_height; 86 params.height = zeta_height;
83 params.unaligned_height = zeta_height; 87 params.unaligned_height = zeta_height;
84 params.size_in_bytes = params.SizeInBytes(); 88 params.size_in_bytes = params.SizeInBytes();
89 params.cache_width = Common::AlignUp(params.width, 16);
90 params.cache_height = Common::AlignUp(params.height, 16);
85 return params; 91 return params;
86} 92}
87 93
@@ -680,12 +686,12 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params) {
680 // If use_accurate_framebuffers is enabled, always load from memory 686 // If use_accurate_framebuffers is enabled, always load from memory
681 FlushSurface(surface); 687 FlushSurface(surface);
682 UnregisterSurface(surface); 688 UnregisterSurface(surface);
683 } else if (surface->GetSurfaceParams() != params) { 689 } else if (surface->GetSurfaceParams().IsCompatibleSurface(params)) {
684 // If surface parameters changed, recreate the surface from the old one
685 return RecreateSurface(surface, params);
686 } else {
687 // Use the cached surface as-is 690 // Use the cached surface as-is
688 return surface; 691 return surface;
692 } else {
693 // If surface parameters changed, recreate the surface from the old one
694 return RecreateSurface(surface, params);
689 } 695 }
690 } 696 }
691 697
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 4e1e18d9c..39fcf22b4 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -9,6 +9,7 @@
9#include <memory> 9#include <memory>
10#include <vector> 10#include <vector>
11#include <boost/icl/interval_map.hpp> 11#include <boost/icl/interval_map.hpp>
12
12#include "common/common_types.h" 13#include "common/common_types.h"
13#include "common/math_util.h" 14#include "common/math_util.h"
14#include "video_core/engines/maxwell_3d.h" 15#include "video_core/engines/maxwell_3d.h"
@@ -546,6 +547,12 @@ struct SurfaceParams {
546 return !operator==(other); 547 return !operator==(other);
547 } 548 }
548 549
550 /// Checks if surfaces are compatible for caching
551 bool IsCompatibleSurface(const SurfaceParams& other) const {
552 return std::tie(pixel_format, type, cache_width, cache_height) ==
553 std::tie(other.pixel_format, other.type, other.cache_width, other.cache_height);
554 }
555
549 Tegra::GPUVAddr addr; 556 Tegra::GPUVAddr addr;
550 bool is_tiled; 557 bool is_tiled;
551 u32 block_height; 558 u32 block_height;
@@ -556,6 +563,10 @@ struct SurfaceParams {
556 u32 height; 563 u32 height;
557 u32 unaligned_height; 564 u32 unaligned_height;
558 size_t size_in_bytes; 565 size_t size_in_bytes;
566
567 // Parameters used for caching only
568 u32 cache_width;
569 u32 cache_height;
559}; 570};
560 571
561class CachedSurface final { 572class CachedSurface final {
diff --git a/src/yuzu/about_dialog.cpp b/src/yuzu/about_dialog.cpp
index 39ed3bccf..a81ad2888 100644
--- a/src/yuzu/about_dialog.cpp
+++ b/src/yuzu/about_dialog.cpp
@@ -15,4 +15,4 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent), ui(new Ui::AboutDia
15 Common::g_scm_desc, QString(Common::g_build_date).left(10))); 15 Common::g_scm_desc, QString(Common::g_build_date).left(10)));
16} 16}
17 17
18AboutDialog::~AboutDialog() {} 18AboutDialog::~AboutDialog() = default;
diff --git a/src/yuzu/about_dialog.h b/src/yuzu/about_dialog.h
index 2eb6e28f5..18e8c11a7 100644
--- a/src/yuzu/about_dialog.h
+++ b/src/yuzu/about_dialog.h
@@ -16,7 +16,7 @@ class AboutDialog : public QDialog {
16 16
17public: 17public:
18 explicit AboutDialog(QWidget* parent); 18 explicit AboutDialog(QWidget* parent);
19 ~AboutDialog(); 19 ~AboutDialog() override;
20 20
21private: 21private:
22 std::unique_ptr<Ui::AboutDialog> ui; 22 std::unique_ptr<Ui::AboutDialog> ui;
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h
index 130bc613b..d0f990c64 100644
--- a/src/yuzu/bootmanager.h
+++ b/src/yuzu/bootmanager.h
@@ -106,7 +106,7 @@ class GRenderWindow : public QWidget, public EmuWindow {
106 106
107public: 107public:
108 GRenderWindow(QWidget* parent, EmuThread* emu_thread); 108 GRenderWindow(QWidget* parent, EmuThread* emu_thread);
109 ~GRenderWindow(); 109 ~GRenderWindow() override;
110 110
111 // EmuWindow implementation 111 // EmuWindow implementation
112 void SwapBuffers() override; 112 void SwapBuffers() override;
diff --git a/src/yuzu/configuration/configure_debug.cpp b/src/yuzu/configuration/configure_debug.cpp
index 7fd07539a..45d84f19a 100644
--- a/src/yuzu/configuration/configure_debug.cpp
+++ b/src/yuzu/configuration/configure_debug.cpp
@@ -24,7 +24,7 @@ ConfigureDebug::ConfigureDebug(QWidget* parent) : QWidget(parent), ui(new Ui::Co
24 }); 24 });
25} 25}
26 26
27ConfigureDebug::~ConfigureDebug() {} 27ConfigureDebug::~ConfigureDebug() = default;
28 28
29void ConfigureDebug::setConfiguration() { 29void ConfigureDebug::setConfiguration() {
30 ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub); 30 ui->toggle_gdbstub->setChecked(Settings::values.use_gdbstub);
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp
index f66abf870..1ca7e876c 100644
--- a/src/yuzu/configuration/configure_dialog.cpp
+++ b/src/yuzu/configuration/configure_dialog.cpp
@@ -12,7 +12,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent) : QDialog(parent), ui(new Ui::
12 this->setConfiguration(); 12 this->setConfiguration();
13} 13}
14 14
15ConfigureDialog::~ConfigureDialog() {} 15ConfigureDialog::~ConfigureDialog() = default;
16 16
17void ConfigureDialog::setConfiguration() {} 17void ConfigureDialog::setConfiguration() {}
18 18
diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp
index cb7d3f8bf..04afc8724 100644
--- a/src/yuzu/configuration/configure_general.cpp
+++ b/src/yuzu/configuration/configure_general.cpp
@@ -24,7 +24,7 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent)
24 ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn()); 24 ui->use_docked_mode->setEnabled(!Core::System::GetInstance().IsPoweredOn());
25} 25}
26 26
27ConfigureGeneral::~ConfigureGeneral() {} 27ConfigureGeneral::~ConfigureGeneral() = default;
28 28
29void ConfigureGeneral::setConfiguration() { 29void ConfigureGeneral::setConfiguration() {
30 ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan); 30 ui->toggle_deepscan->setChecked(UISettings::values.gamedir_deepscan);
diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp
index 3379b7963..4afe0f81b 100644
--- a/src/yuzu/configuration/configure_graphics.cpp
+++ b/src/yuzu/configuration/configure_graphics.cpp
@@ -14,7 +14,7 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent)
14 this->setConfiguration(); 14 this->setConfiguration();
15} 15}
16 16
17ConfigureGraphics::~ConfigureGraphics() {} 17ConfigureGraphics::~ConfigureGraphics() = default;
18 18
19enum class Resolution : int { 19enum class Resolution : int {
20 Auto, 20 Auto,
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 9be2c939c..e9ed9c38f 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -35,7 +35,7 @@ ConfigureSystem::ConfigureSystem(QWidget* parent) : QWidget(parent), ui(new Ui::
35 this->setConfiguration(); 35 this->setConfiguration();
36} 36}
37 37
38ConfigureSystem::~ConfigureSystem() {} 38ConfigureSystem::~ConfigureSystem() = default;
39 39
40void ConfigureSystem::setConfiguration() { 40void ConfigureSystem::setConfiguration() {
41 enabled = !Core::System::GetInstance().IsPoweredOn(); 41 enabled = !Core::System::GetInstance().IsPoweredOn();
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp
index ff3efcdaa..3f7103ab9 100644
--- a/src/yuzu/debugger/graphics/graphics_surface.cpp
+++ b/src/yuzu/debugger/graphics/graphics_surface.cpp
@@ -34,7 +34,8 @@ static Tegra::Texture::TextureFormat ConvertToTextureFormat(
34 34
35SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) 35SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_)
36 : QLabel(parent), surface_widget(surface_widget_) {} 36 : QLabel(parent), surface_widget(surface_widget_) {}
37SurfacePicture::~SurfacePicture() {} 37
38SurfacePicture::~SurfacePicture() = default;
38 39
39void SurfacePicture::mousePressEvent(QMouseEvent* event) { 40void SurfacePicture::mousePressEvent(QMouseEvent* event) {
40 // Only do something while the left mouse button is held down 41 // Only do something while the left mouse button is held down
diff --git a/src/yuzu/debugger/graphics/graphics_surface.h b/src/yuzu/debugger/graphics/graphics_surface.h
index 58f9db465..323e39d94 100644
--- a/src/yuzu/debugger/graphics/graphics_surface.h
+++ b/src/yuzu/debugger/graphics/graphics_surface.h
@@ -22,11 +22,11 @@ class SurfacePicture : public QLabel {
22public: 22public:
23 explicit SurfacePicture(QWidget* parent = nullptr, 23 explicit SurfacePicture(QWidget* parent = nullptr,
24 GraphicsSurfaceWidget* surface_widget = nullptr); 24 GraphicsSurfaceWidget* surface_widget = nullptr);
25 ~SurfacePicture(); 25 ~SurfacePicture() override;
26 26
27protected slots: 27protected slots:
28 virtual void mouseMoveEvent(QMouseEvent* event); 28 void mouseMoveEvent(QMouseEvent* event) override;
29 virtual void mousePressEvent(QMouseEvent* event); 29 void mousePressEvent(QMouseEvent* event) override;
30 30
31private: 31private:
32 GraphicsSurfaceWidget* surface_widget; 32 GraphicsSurfaceWidget* surface_widget;
diff --git a/src/yuzu/debugger/wait_tree.cpp b/src/yuzu/debugger/wait_tree.cpp
index f5a5697a0..d0926d723 100644
--- a/src/yuzu/debugger/wait_tree.cpp
+++ b/src/yuzu/debugger/wait_tree.cpp
@@ -14,7 +14,7 @@
14#include "core/hle/kernel/timer.h" 14#include "core/hle/kernel/timer.h"
15#include "core/hle/kernel/wait_object.h" 15#include "core/hle/kernel/wait_object.h"
16 16
17WaitTreeItem::~WaitTreeItem() {} 17WaitTreeItem::~WaitTreeItem() = default;
18 18
19QColor WaitTreeItem::GetColor() const { 19QColor WaitTreeItem::GetColor() const {
20 return QColor(Qt::GlobalColor::black); 20 return QColor(Qt::GlobalColor::black);
@@ -316,7 +316,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeEvent::GetChildren() const {
316 316
317 list.push_back(std::make_unique<WaitTreeText>( 317 list.push_back(std::make_unique<WaitTreeText>(
318 tr("reset type = %1") 318 tr("reset type = %1")
319 .arg(GetResetTypeQString(static_cast<const Kernel::Event&>(object).reset_type)))); 319 .arg(GetResetTypeQString(static_cast<const Kernel::Event&>(object).GetResetType()))));
320 return list; 320 return list;
321} 321}
322 322
diff --git a/src/yuzu/debugger/wait_tree.h b/src/yuzu/debugger/wait_tree.h
index 6cbce6856..513b3c45d 100644
--- a/src/yuzu/debugger/wait_tree.h
+++ b/src/yuzu/debugger/wait_tree.h
@@ -25,11 +25,13 @@ class WaitTreeThread;
25class WaitTreeItem : public QObject { 25class WaitTreeItem : public QObject {
26 Q_OBJECT 26 Q_OBJECT
27public: 27public:
28 ~WaitTreeItem() override;
29
28 virtual bool IsExpandable() const; 30 virtual bool IsExpandable() const;
29 virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const; 31 virtual std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const;
30 virtual QString GetText() const = 0; 32 virtual QString GetText() const = 0;
31 virtual QColor GetColor() const; 33 virtual QColor GetColor() const;
32 virtual ~WaitTreeItem(); 34
33 void Expand(); 35 void Expand();
34 WaitTreeItem* Parent() const; 36 WaitTreeItem* Parent() const;
35 const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const; 37 const std::vector<std::unique_ptr<WaitTreeItem>>& Children() const;
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index a758b77aa..aa69a098f 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -5,6 +5,7 @@
5#pragma once 5#pragma once
6 6
7#include <atomic> 7#include <atomic>
8#include <utility>
8#include <QImage> 9#include <QImage>
9#include <QRunnable> 10#include <QRunnable>
10#include <QStandardItem> 11#include <QStandardItem>
@@ -27,9 +28,8 @@ static QPixmap GetDefaultIcon(bool large) {
27class GameListItem : public QStandardItem { 28class GameListItem : public QStandardItem {
28 29
29public: 30public:
30 GameListItem() : QStandardItem() {} 31 GameListItem() = default;
31 GameListItem(const QString& string) : QStandardItem(string) {} 32 explicit GameListItem(const QString& string) : QStandardItem(string) {}
32 virtual ~GameListItem() override {}
33}; 33};
34 34
35/** 35/**
@@ -45,9 +45,8 @@ public:
45 static const int TitleRole = Qt::UserRole + 2; 45 static const int TitleRole = Qt::UserRole + 2;
46 static const int ProgramIdRole = Qt::UserRole + 3; 46 static const int ProgramIdRole = Qt::UserRole + 3;
47 47
48 GameListItemPath() : GameListItem() {} 48 GameListItemPath() = default;
49 GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id) 49 GameListItemPath(const QString& game_path, const std::vector<u8>& smdh_data, u64 program_id) {
50 : GameListItem() {
51 setData(game_path, FullPathRole); 50 setData(game_path, FullPathRole);
52 setData(qulonglong(program_id), ProgramIdRole); 51 setData(qulonglong(program_id), ProgramIdRole);
53 } 52 }
@@ -75,8 +74,8 @@ class GameListItemSize : public GameListItem {
75public: 74public:
76 static const int SizeRole = Qt::UserRole + 1; 75 static const int SizeRole = Qt::UserRole + 1;
77 76
78 GameListItemSize() : GameListItem() {} 77 GameListItemSize() = default;
79 GameListItemSize(const qulonglong size_bytes) : GameListItem() { 78 explicit GameListItemSize(const qulonglong size_bytes) {
80 setData(size_bytes, SizeRole); 79 setData(size_bytes, SizeRole);
81 } 80 }
82 81
@@ -111,7 +110,7 @@ class GameListWorker : public QObject, public QRunnable {
111 110
112public: 111public:
113 GameListWorker(QString dir_path, bool deep_scan) 112 GameListWorker(QString dir_path, bool deep_scan)
114 : QObject(), QRunnable(), dir_path(dir_path), deep_scan(deep_scan) {} 113 : dir_path(std::move(dir_path)), deep_scan(deep_scan) {}
115 114
116public slots: 115public slots:
117 /// Starts the processing of directory tree information. 116 /// Starts the processing of directory tree information.
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index e28679cd1..dd71bd763 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -81,6 +81,8 @@ static void ShowCalloutMessage(const QString& message, CalloutFlag flag) {
81 81
82void GMainWindow::ShowCallouts() {} 82void GMainWindow::ShowCallouts() {}
83 83
84const int GMainWindow::max_recent_files_item;
85
84GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { 86GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
85 87
86 debug_context = Tegra::DebugContext::Construct(); 88 debug_context = Tegra::DebugContext::Construct();
@@ -579,11 +581,11 @@ void GMainWindow::StoreRecentFile(const QString& filename) {
579} 581}
580 582
581void GMainWindow::UpdateRecentFiles() { 583void GMainWindow::UpdateRecentFiles() {
582 unsigned int num_recent_files = 584 const int num_recent_files =
583 std::min(UISettings::values.recent_files.size(), static_cast<int>(max_recent_files_item)); 585 std::min(UISettings::values.recent_files.size(), max_recent_files_item);
584 586
585 for (unsigned int i = 0; i < num_recent_files; i++) { 587 for (int i = 0; i < num_recent_files; i++) {
586 QString text = QString("&%1. %2").arg(i + 1).arg( 588 const QString text = QString("&%1. %2").arg(i + 1).arg(
587 QFileInfo(UISettings::values.recent_files[i]).fileName()); 589 QFileInfo(UISettings::values.recent_files[i]).fileName());
588 actions_recent_files[i]->setText(text); 590 actions_recent_files[i]->setText(text);
589 actions_recent_files[i]->setData(UISettings::values.recent_files[i]); 591 actions_recent_files[i]->setData(UISettings::values.recent_files[i]);
@@ -595,12 +597,8 @@ void GMainWindow::UpdateRecentFiles() {
595 actions_recent_files[j]->setVisible(false); 597 actions_recent_files[j]->setVisible(false);
596 } 598 }
597 599
598 // Grey out the recent files menu if the list is empty 600 // Enable the recent files menu if the list isn't empty
599 if (num_recent_files == 0) { 601 ui.menu_recent_files->setEnabled(num_recent_files != 0);
600 ui.menu_recent_files->setEnabled(false);
601 } else {
602 ui.menu_recent_files->setEnabled(true);
603 }
604} 602}
605 603
606void GMainWindow::OnGameListLoadFile(QString game_path) { 604void GMainWindow::OnGameListLoadFile(QString game_path) {
@@ -631,9 +629,15 @@ void GMainWindow::OnMenuLoadFile() {
631} 629}
632 630
633void GMainWindow::OnMenuLoadFolder() { 631void GMainWindow::OnMenuLoadFolder() {
634 QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory")); 632 const QString dir_path =
633 QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory"));
634
635 if (dir_path.isNull()) {
636 return;
637 }
635 638
636 QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files); 639 const QDir dir{dir_path};
640 const QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
637 if (matching_main.size() == 1) { 641 if (matching_main.size() == 1) {
638 BootGame(dir.path() + DIR_SEP + matching_main[0]); 642 BootGame(dir.path() + DIR_SEP + matching_main[0]);
639 } else { 643 } else {
@@ -654,9 +658,8 @@ void GMainWindow::OnMenuRecentFile() {
654 QAction* action = qobject_cast<QAction*>(sender()); 658 QAction* action = qobject_cast<QAction*>(sender());
655 assert(action); 659 assert(action);
656 660
657 QString filename = action->data().toString(); 661 const QString filename = action->data().toString();
658 QFileInfo file_info(filename); 662 if (QFileInfo::exists(filename)) {
659 if (file_info.exists()) {
660 BootGame(filename); 663 BootGame(filename);
661 } else { 664 } else {
662 // Display an error message and remove the file from the list. 665 // Display an error message and remove the file from the list.
@@ -947,15 +950,14 @@ void GMainWindow::UpdateUITheme() {
947 QStringList theme_paths(default_theme_paths); 950 QStringList theme_paths(default_theme_paths);
948 if (UISettings::values.theme != UISettings::themes[0].second && 951 if (UISettings::values.theme != UISettings::themes[0].second &&
949 !UISettings::values.theme.isEmpty()) { 952 !UISettings::values.theme.isEmpty()) {
950 QString theme_uri(":" + UISettings::values.theme + "/style.qss"); 953 const QString theme_uri(":" + UISettings::values.theme + "/style.qss");
951 QFile f(theme_uri); 954 QFile f(theme_uri);
952 if (!f.exists()) { 955 if (f.open(QFile::ReadOnly | QFile::Text)) {
953 LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
954 } else {
955 f.open(QFile::ReadOnly | QFile::Text);
956 QTextStream ts(&f); 956 QTextStream ts(&f);
957 qApp->setStyleSheet(ts.readAll()); 957 qApp->setStyleSheet(ts.readAll());
958 GMainWindow::setStyleSheet(ts.readAll()); 958 GMainWindow::setStyleSheet(ts.readAll());
959 } else {
960 LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found");
959 } 961 }
960 theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme}); 962 theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme});
961 QIcon::setThemeName(":/icons/" + UISettings::values.theme); 963 QIcon::setThemeName(":/icons/" + UISettings::values.theme);
diff --git a/src/yuzu/main.h b/src/yuzu/main.h
index 074bba3f9..a60d831b9 100644
--- a/src/yuzu/main.h
+++ b/src/yuzu/main.h
@@ -43,7 +43,7 @@ public:
43 void filterBarSetChecked(bool state); 43 void filterBarSetChecked(bool state);
44 void UpdateUITheme(); 44 void UpdateUITheme();
45 GMainWindow(); 45 GMainWindow();
46 ~GMainWindow(); 46 ~GMainWindow() override;
47 47
48signals: 48signals:
49 49