diff options
Diffstat (limited to 'src')
29 files changed, 127 insertions, 87 deletions
diff --git a/src/core/arm/unicorn/arm_unicorn.cpp b/src/core/arm/unicorn/arm_unicorn.cpp index 4c11f35a4..6bc349460 100644 --- a/src/core/arm/unicorn/arm_unicorn.cpp +++ b/src/core/arm/unicorn/arm_unicorn.cpp | |||
| @@ -203,7 +203,7 @@ void ARM_Unicorn::ExecuteInstructions(int num_instructions) { | |||
| 203 | } | 203 | } |
| 204 | Kernel::Thread* thread = Kernel::GetCurrentThread(); | 204 | Kernel::Thread* thread = Kernel::GetCurrentThread(); |
| 205 | SaveContext(thread->context); | 205 | SaveContext(thread->context); |
| 206 | if (last_bkpt_hit || (num_instructions == 1)) { | 206 | if (last_bkpt_hit || GDBStub::GetCpuStepFlag()) { |
| 207 | last_bkpt_hit = false; | 207 | last_bkpt_hit = false; |
| 208 | GDBStub::Break(); | 208 | GDBStub::Break(); |
| 209 | GDBStub::SendTrap(thread, 5); | 209 | GDBStub::SendTrap(thread, 5); |
diff --git a/src/core/core.cpp b/src/core/core.cpp index e01c45cdd..085ba68d0 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -62,7 +62,6 @@ System::ResultStatus System::RunLoop(bool tight_loop) { | |||
| 62 | // execute. Otherwise, get out of the loop function. | 62 | // execute. Otherwise, get out of the loop function. |
| 63 | if (GDBStub::GetCpuHaltFlag()) { | 63 | if (GDBStub::GetCpuHaltFlag()) { |
| 64 | if (GDBStub::GetCpuStepFlag()) { | 64 | if (GDBStub::GetCpuStepFlag()) { |
| 65 | GDBStub::SetCpuStepFlag(false); | ||
| 66 | tight_loop = false; | 65 | tight_loop = false; |
| 67 | } else { | 66 | } else { |
| 68 | return ResultStatus::Success; | 67 | return ResultStatus::Success; |
| @@ -78,6 +77,10 @@ System::ResultStatus System::RunLoop(bool tight_loop) { | |||
| 78 | } | 77 | } |
| 79 | } | 78 | } |
| 80 | 79 | ||
| 80 | if (GDBStub::IsServerEnabled()) { | ||
| 81 | GDBStub::SetCpuStepFlag(false); | ||
| 82 | } | ||
| 83 | |||
| 81 | return status; | 84 | return status; |
| 82 | } | 85 | } |
| 83 | 86 | ||
diff --git a/src/core/core.h b/src/core/core.h index a3be88aa8..c8ca4b247 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -82,6 +82,17 @@ public: | |||
| 82 | */ | 82 | */ |
| 83 | ResultStatus SingleStep(); | 83 | ResultStatus SingleStep(); |
| 84 | 84 | ||
| 85 | /** | ||
| 86 | * Invalidate the CPU instruction caches | ||
| 87 | * This function should only be used by GDB Stub to support breakpoints, memory updates and | ||
| 88 | * step/continue commands. | ||
| 89 | */ | ||
| 90 | void InvalidateCpuInstructionCaches() { | ||
| 91 | for (auto& cpu : cpu_cores) { | ||
| 92 | cpu->ArmInterface().ClearInstructionCache(); | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 85 | /// Shutdown the emulated system. | 96 | /// Shutdown the emulated system. |
| 86 | void Shutdown(); | 97 | void Shutdown(); |
| 87 | 98 | ||
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/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index 884e64e99..332e5c3d0 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp | |||
| @@ -173,6 +173,7 @@ struct Breakpoint { | |||
| 173 | bool active; | 173 | bool active; |
| 174 | VAddr addr; | 174 | VAddr addr; |
| 175 | u64 len; | 175 | u64 len; |
| 176 | std::array<u8, 4> inst; | ||
| 176 | }; | 177 | }; |
| 177 | 178 | ||
| 178 | using BreakpointMap = std::map<VAddr, Breakpoint>; | 179 | using BreakpointMap = std::map<VAddr, Breakpoint>; |
| @@ -453,6 +454,8 @@ static void RemoveBreakpoint(BreakpointType type, VAddr addr) { | |||
| 453 | 454 | ||
| 454 | LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}", | 455 | LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}", |
| 455 | bp->second.len, bp->second.addr, static_cast<int>(type)); | 456 | bp->second.len, bp->second.addr, static_cast<int>(type)); |
| 457 | Memory::WriteBlock(bp->second.addr, bp->second.inst.data(), bp->second.inst.size()); | ||
| 458 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); | ||
| 456 | p.erase(addr); | 459 | p.erase(addr); |
| 457 | } | 460 | } |
| 458 | 461 | ||
| @@ -937,6 +940,7 @@ static void WriteMemory() { | |||
| 937 | 940 | ||
| 938 | GdbHexToMem(data.data(), len_pos + 1, len); | 941 | GdbHexToMem(data.data(), len_pos + 1, len); |
| 939 | Memory::WriteBlock(addr, data.data(), len); | 942 | Memory::WriteBlock(addr, data.data(), len); |
| 943 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); | ||
| 940 | SendReply("OK"); | 944 | SendReply("OK"); |
| 941 | } | 945 | } |
| 942 | 946 | ||
| @@ -956,6 +960,7 @@ static void Step() { | |||
| 956 | step_loop = true; | 960 | step_loop = true; |
| 957 | halt_loop = true; | 961 | halt_loop = true; |
| 958 | send_trap = true; | 962 | send_trap = true; |
| 963 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); | ||
| 959 | } | 964 | } |
| 960 | 965 | ||
| 961 | /// Tell the CPU if we hit a memory breakpoint. | 966 | /// Tell the CPU if we hit a memory breakpoint. |
| @@ -972,6 +977,7 @@ static void Continue() { | |||
| 972 | memory_break = false; | 977 | memory_break = false; |
| 973 | step_loop = false; | 978 | step_loop = false; |
| 974 | halt_loop = false; | 979 | halt_loop = false; |
| 980 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); | ||
| 975 | } | 981 | } |
| 976 | 982 | ||
| 977 | /** | 983 | /** |
| @@ -988,6 +994,10 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u64 len) { | |||
| 988 | breakpoint.active = true; | 994 | breakpoint.active = true; |
| 989 | breakpoint.addr = addr; | 995 | breakpoint.addr = addr; |
| 990 | breakpoint.len = len; | 996 | breakpoint.len = len; |
| 997 | Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size()); | ||
| 998 | static constexpr std::array<u8, 4> btrap{{0xd4, 0x20, 0x7d, 0x0}}; | ||
| 999 | Memory::WriteBlock(addr, btrap.data(), btrap.size()); | ||
| 1000 | Core::System::GetInstance().InvalidateCpuInstructionCaches(); | ||
| 991 | p.insert({addr, breakpoint}); | 1001 | p.insert({addr, breakpoint}); |
| 992 | 1002 | ||
| 993 | LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}", | 1003 | LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}", |
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: | |||
| 47 | private: | 46 | private: |
| 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 | ||
| 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/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 | ||
| 561 | class CachedSurface final { | 572 | class 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 | ||
| 18 | AboutDialog::~AboutDialog() {} | 18 | AboutDialog::~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 | ||
| 17 | public: | 17 | public: |
| 18 | explicit AboutDialog(QWidget* parent); | 18 | explicit AboutDialog(QWidget* parent); |
| 19 | ~AboutDialog(); | 19 | ~AboutDialog() override; |
| 20 | 20 | ||
| 21 | private: | 21 | private: |
| 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 | ||
| 107 | public: | 107 | public: |
| 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 | ||
| 27 | ConfigureDebug::~ConfigureDebug() {} | 27 | ConfigureDebug::~ConfigureDebug() = default; |
| 28 | 28 | ||
| 29 | void ConfigureDebug::setConfiguration() { | 29 | void 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_debug.ui b/src/yuzu/configuration/configure_debug.ui index 118e91cf1..5ae7276bd 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui | |||
| @@ -23,13 +23,6 @@ | |||
| 23 | </property> | 23 | </property> |
| 24 | <layout class="QVBoxLayout" name="verticalLayout_3"> | 24 | <layout class="QVBoxLayout" name="verticalLayout_3"> |
| 25 | <item> | 25 | <item> |
| 26 | <widget class="QLabel" name="label_1"> | ||
| 27 | <property name="text"> | ||
| 28 | <string>The GDB Stub only works correctly when the CPU JIT is off.</string> | ||
| 29 | </property> | ||
| 30 | </widget> | ||
| 31 | </item> | ||
| 32 | <item> | ||
| 33 | <layout class="QHBoxLayout" name="horizontalLayout_1"> | 26 | <layout class="QHBoxLayout" name="horizontalLayout_1"> |
| 34 | <item> | 27 | <item> |
| 35 | <widget class="QCheckBox" name="toggle_gdbstub"> | 28 | <widget class="QCheckBox" name="toggle_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 | ||
| 15 | ConfigureDialog::~ConfigureDialog() {} | 15 | ConfigureDialog::~ConfigureDialog() = default; |
| 16 | 16 | ||
| 17 | void ConfigureDialog::setConfiguration() {} | 17 | void 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 | ||
| 27 | ConfigureGeneral::~ConfigureGeneral() {} | 27 | ConfigureGeneral::~ConfigureGeneral() = default; |
| 28 | 28 | ||
| 29 | void ConfigureGeneral::setConfiguration() { | 29 | void 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 | ||
| 17 | ConfigureGraphics::~ConfigureGraphics() {} | 17 | ConfigureGraphics::~ConfigureGraphics() = default; |
| 18 | 18 | ||
| 19 | enum class Resolution : int { | 19 | enum 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 | ||
| 38 | ConfigureSystem::~ConfigureSystem() {} | 38 | ConfigureSystem::~ConfigureSystem() = default; |
| 39 | 39 | ||
| 40 | void ConfigureSystem::setConfiguration() { | 40 | void 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 | ||
| 35 | SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) | 35 | SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_) |
| 36 | : QLabel(parent), surface_widget(surface_widget_) {} | 36 | : QLabel(parent), surface_widget(surface_widget_) {} |
| 37 | SurfacePicture::~SurfacePicture() {} | 37 | |
| 38 | SurfacePicture::~SurfacePicture() = default; | ||
| 38 | 39 | ||
| 39 | void SurfacePicture::mousePressEvent(QMouseEvent* event) { | 40 | void 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 { | |||
| 22 | public: | 22 | public: |
| 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 | ||
| 27 | protected slots: | 27 | protected 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 | ||
| 31 | private: | 31 | private: |
| 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 | ||
| 17 | WaitTreeItem::~WaitTreeItem() {} | 17 | WaitTreeItem::~WaitTreeItem() = default; |
| 18 | 18 | ||
| 19 | QColor WaitTreeItem::GetColor() const { | 19 | QColor 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; | |||
| 25 | class WaitTreeItem : public QObject { | 25 | class WaitTreeItem : public QObject { |
| 26 | Q_OBJECT | 26 | Q_OBJECT |
| 27 | public: | 27 | public: |
| 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.cpp b/src/yuzu/game_list.cpp index bfce3671f..24f38a3c7 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -162,15 +162,15 @@ void GameList::onTextChanged(const QString& newText) { | |||
| 162 | } | 162 | } |
| 163 | search_field->setFilterResult(rowCount, rowCount); | 163 | search_field->setFilterResult(rowCount, rowCount); |
| 164 | } else { | 164 | } else { |
| 165 | QStandardItem* child_file; | ||
| 166 | QString file_path, file_name, file_title, file_programmid; | ||
| 167 | int result_count = 0; | 165 | int result_count = 0; |
| 168 | for (int i = 0; i < rowCount; ++i) { | 166 | for (int i = 0; i < rowCount; ++i) { |
| 169 | child_file = item_model->item(i, 0); | 167 | const QStandardItem* child_file = item_model->item(i, 0); |
| 170 | file_path = child_file->data(GameListItemPath::FullPathRole).toString().toLower(); | 168 | const QString file_path = |
| 171 | file_name = file_path.mid(file_path.lastIndexOf("/") + 1); | 169 | child_file->data(GameListItemPath::FullPathRole).toString().toLower(); |
| 172 | file_title = child_file->data(GameListItemPath::TitleRole).toString().toLower(); | 170 | QString file_name = file_path.mid(file_path.lastIndexOf('/') + 1); |
| 173 | file_programmid = | 171 | const QString file_title = |
| 172 | child_file->data(GameListItemPath::TitleRole).toString().toLower(); | ||
| 173 | const QString file_programmid = | ||
| 174 | child_file->data(GameListItemPath::ProgramIdRole).toString().toLower(); | 174 | child_file->data(GameListItemPath::ProgramIdRole).toString().toLower(); |
| 175 | 175 | ||
| 176 | // Only items which filename in combination with its title contains all words | 176 | // Only items which filename in combination with its title contains all words |
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) { | |||
| 27 | class GameListItem : public QStandardItem { | 28 | class GameListItem : public QStandardItem { |
| 28 | 29 | ||
| 29 | public: | 30 | public: |
| 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 { | |||
| 75 | public: | 74 | public: |
| 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 | ||
| 112 | public: | 111 | public: |
| 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 | ||
| 116 | public slots: | 115 | public 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 | ||
| 82 | void GMainWindow::ShowCallouts() {} | 82 | void GMainWindow::ShowCallouts() {} |
| 83 | 83 | ||
| 84 | const int GMainWindow::max_recent_files_item; | ||
| 85 | |||
| 84 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { | 86 | GMainWindow::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 | ||
| 581 | void GMainWindow::UpdateRecentFiles() { | 583 | void 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 | ||
| 606 | void GMainWindow::OnGameListLoadFile(QString game_path) { | 604 | void GMainWindow::OnGameListLoadFile(QString game_path) { |
| @@ -631,9 +629,15 @@ void GMainWindow::OnMenuLoadFile() { | |||
| 631 | } | 629 | } |
| 632 | 630 | ||
| 633 | void GMainWindow::OnMenuLoadFolder() { | 631 | void 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 | ||
| 48 | signals: | 48 | signals: |
| 49 | 49 | ||