diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core_timing.cpp | 4 | ||||
| -rw-r--r-- | src/core/core_timing.h | 3 | ||||
| -rw-r--r-- | src/core/hle/service/audio/audout_a.cpp | 2 | ||||
| -rw-r--r-- | src/core/memory.h | 23 | ||||
| -rw-r--r-- | src/core/perf_stats.cpp | 17 | ||||
| -rw-r--r-- | src/core/perf_stats.h | 8 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 14 |
7 files changed, 33 insertions, 38 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 | ||
| 229 | u64 GetGlobalTimeUs() { | 229 | std::chrono::microseconds GetGlobalTimeUs() { |
| 230 | return GetTicks() * 1000000 / BASE_CLOCK_RATE; | 230 | return std::chrono::microseconds{GetTicks() * 1000000 / BASE_CLOCK_RATE}; |
| 231 | } | 231 | } |
| 232 | 232 | ||
| 233 | int GetDowncount() { | 233 | int 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 | ||
| 87 | void ForceExceptionCheck(s64 cycles); | 88 | void ForceExceptionCheck(s64 cycles); |
| 88 | 89 | ||
| 89 | u64 GetGlobalTimeUs(); | 90 | std::chrono::microseconds GetGlobalTimeUs(); |
| 90 | 91 | ||
| 91 | int GetDowncount(); | 92 | int GetDowncount(); |
| 92 | 93 | ||
diff --git a/src/core/hle/service/audio/audout_a.cpp b/src/core/hle/service/audio/audout_a.cpp index 57b934dd6..bf8d40157 100644 --- a/src/core/hle/service/audio/audout_a.cpp +++ b/src/core/hle/service/audio/audout_a.cpp | |||
| @@ -2,8 +2,6 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "core/hle/service/audio/audout_a.h" | 5 | #include "core/hle/service/audio/audout_a.h" |
| 8 | 6 | ||
| 9 | namespace Service::Audio { | 7 | namespace Service::Audio { |
diff --git a/src/core/memory.h b/src/core/memory.h index b5d885b8a..b7fb3b9ed 100644 --- a/src/core/memory.h +++ b/src/core/memory.h | |||
| @@ -140,10 +140,10 @@ void SetCurrentPageTable(PageTable* page_table); | |||
| 140 | PageTable* GetCurrentPageTable(); | 140 | PageTable* GetCurrentPageTable(); |
| 141 | 141 | ||
| 142 | /// Determines if the given VAddr is valid for the specified process. | 142 | /// Determines if the given VAddr is valid for the specified process. |
| 143 | bool IsValidVirtualAddress(const Kernel::Process& process, const VAddr vaddr); | 143 | bool IsValidVirtualAddress(const Kernel::Process& process, VAddr vaddr); |
| 144 | bool IsValidVirtualAddress(const VAddr addr); | 144 | bool IsValidVirtualAddress(VAddr vaddr); |
| 145 | /// Determines if the given VAddr is a kernel address | 145 | /// Determines if the given VAddr is a kernel address |
| 146 | bool IsKernelVirtualAddress(const VAddr addr); | 146 | bool IsKernelVirtualAddress(VAddr vaddr); |
| 147 | 147 | ||
| 148 | u8 Read8(VAddr addr); | 148 | u8 Read8(VAddr addr); |
| 149 | u16 Read16(VAddr addr); | 149 | u16 Read16(VAddr addr); |
| @@ -155,18 +155,17 @@ void Write16(VAddr addr, u16 data); | |||
| 155 | void Write32(VAddr addr, u32 data); | 155 | void Write32(VAddr addr, u32 data); |
| 156 | void Write64(VAddr addr, u64 data); | 156 | void Write64(VAddr addr, u64 data); |
| 157 | 157 | ||
| 158 | void ReadBlock(const Kernel::Process& process, const VAddr src_addr, void* dest_buffer, | 158 | void ReadBlock(const Kernel::Process& process, VAddr src_addr, void* dest_buffer, size_t size); |
| 159 | size_t size); | 159 | void ReadBlock(VAddr src_addr, void* dest_buffer, size_t size); |
| 160 | void ReadBlock(const VAddr src_addr, void* dest_buffer, size_t size); | 160 | void WriteBlock(const Kernel::Process& process, VAddr dest_addr, const void* src_buffer, |
| 161 | void WriteBlock(const Kernel::Process& process, const VAddr dest_addr, const void* src_buffer, | ||
| 162 | size_t size); | 161 | size_t size); |
| 163 | void WriteBlock(const VAddr dest_addr, const void* src_buffer, size_t size); | 162 | void WriteBlock(VAddr dest_addr, const void* src_buffer, size_t size); |
| 164 | void ZeroBlock(const VAddr dest_addr, const size_t size); | 163 | void ZeroBlock(const Kernel::Process& process, VAddr dest_addr, size_t size); |
| 165 | void CopyBlock(VAddr dest_addr, VAddr src_addr, size_t size); | 164 | void CopyBlock(VAddr dest_addr, VAddr src_addr, size_t size); |
| 166 | 165 | ||
| 167 | u8* GetPointer(VAddr virtual_address); | 166 | u8* GetPointer(VAddr vaddr); |
| 168 | 167 | ||
| 169 | std::string ReadCString(VAddr virtual_address, std::size_t max_length); | 168 | std::string ReadCString(VAddr vaddr, std::size_t max_length); |
| 170 | 169 | ||
| 171 | enum class FlushMode { | 170 | enum class FlushMode { |
| 172 | /// Write back modified surfaces to RAM | 171 | /// Write back modified surfaces to RAM |
| @@ -180,7 +179,7 @@ enum class FlushMode { | |||
| 180 | /** | 179 | /** |
| 181 | * Mark each page touching the region as cached. | 180 | * Mark each page touching the region as cached. |
| 182 | */ | 181 | */ |
| 183 | void RasterizerMarkRegionCached(Tegra::GPUVAddr start, u64 size, bool cached); | 182 | void RasterizerMarkRegionCached(Tegra::GPUVAddr gpu_addr, u64 size, bool cached); |
| 184 | 183 | ||
| 185 | /** | 184 | /** |
| 186 | * Flushes and invalidates any externally cached rasterizer resources touching the given virtual | 185 | * Flushes and invalidates any externally cached rasterizer resources touching the given virtual |
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 | ||
| 43 | PerfStats::Results PerfStats::GetAndResetStats(u64 current_system_time_us) { | 43 | PerfStats::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 | ||
| 77 | void FrameLimiter::DoFrameLimiting(u64 current_system_time_us) { | 76 | void 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 { | |||
| 68 | public: | 68 | public: |
| 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 | ||
| 73 | private: | 73 | private: |
| 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/yuzu/main.cpp b/src/yuzu/main.cpp index e28679cd1..d0415a7dc 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -654,9 +654,8 @@ void GMainWindow::OnMenuRecentFile() { | |||
| 654 | QAction* action = qobject_cast<QAction*>(sender()); | 654 | QAction* action = qobject_cast<QAction*>(sender()); |
| 655 | assert(action); | 655 | assert(action); |
| 656 | 656 | ||
| 657 | QString filename = action->data().toString(); | 657 | const QString filename = action->data().toString(); |
| 658 | QFileInfo file_info(filename); | 658 | if (QFileInfo::exists(filename)) { |
| 659 | if (file_info.exists()) { | ||
| 660 | BootGame(filename); | 659 | BootGame(filename); |
| 661 | } else { | 660 | } else { |
| 662 | // Display an error message and remove the file from the list. | 661 | // Display an error message and remove the file from the list. |
| @@ -947,15 +946,14 @@ void GMainWindow::UpdateUITheme() { | |||
| 947 | QStringList theme_paths(default_theme_paths); | 946 | QStringList theme_paths(default_theme_paths); |
| 948 | if (UISettings::values.theme != UISettings::themes[0].second && | 947 | if (UISettings::values.theme != UISettings::themes[0].second && |
| 949 | !UISettings::values.theme.isEmpty()) { | 948 | !UISettings::values.theme.isEmpty()) { |
| 950 | QString theme_uri(":" + UISettings::values.theme + "/style.qss"); | 949 | const QString theme_uri(":" + UISettings::values.theme + "/style.qss"); |
| 951 | QFile f(theme_uri); | 950 | QFile f(theme_uri); |
| 952 | if (!f.exists()) { | 951 | 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); | 952 | QTextStream ts(&f); |
| 957 | qApp->setStyleSheet(ts.readAll()); | 953 | qApp->setStyleSheet(ts.readAll()); |
| 958 | GMainWindow::setStyleSheet(ts.readAll()); | 954 | GMainWindow::setStyleSheet(ts.readAll()); |
| 955 | } else { | ||
| 956 | LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found"); | ||
| 959 | } | 957 | } |
| 960 | theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme}); | 958 | theme_paths.append(QStringList{":/icons/default", ":/icons/" + UISettings::values.theme}); |
| 961 | QIcon::setThemeName(":/icons/" + UISettings::values.theme); | 959 | QIcon::setThemeName(":/icons/" + UISettings::values.theme); |