core/core: Replace includes with forward declarations where applicable

The follow-up to e2457418da, which
replaces most of the includes in the core header with forward declarations.

This makes it so that if any of the headers the core header was
previously including change, then no one will need to rebuild the bulk
of the core, due to core.h being quite a prevalent inclusion.

This should make turnaround for changes much faster for developers.
This commit is contained in:
Lioncash 2018-08-31 12:21:34 -04:00
parent 42588493d5
commit 4a587b81b2
29 changed files with 185 additions and 66 deletions

View file

@ -9,6 +9,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/arm/dynarmic/arm_dynarmic.h" #include "core/arm/dynarmic/arm_dynarmic.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_cpu.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/svc.h" #include "core/hle/kernel/svc.h"

View file

@ -2,24 +2,35 @@
// Licensed under GPLv2 or any later version // Licensed under GPLv2 or any later version
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <array>
#include <map>
#include <memory> #include <memory>
#include <thread>
#include <utility> #include <utility>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/arm/exclusive_monitor.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_cpu.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/sm/controller.h" #include "core/hle/service/sm/controller.h"
#include "core/hle/service/sm/sm.h" #include "core/hle/service/sm/sm.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/perf_stats.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/telemetry_session.h"
#include "file_sys/vfs_concat.h" #include "file_sys/vfs_concat.h"
#include "file_sys/vfs_real.h" #include "file_sys/vfs_real.h"
#include "video_core/debug_utils/debug_utils.h"
#include "video_core/gpu.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
@ -258,7 +269,7 @@ struct System::Impl {
} }
} }
PerfStats::Results GetAndResetPerfStats() { PerfStatsResults GetAndResetPerfStats() {
return perf_stats.GetAndResetStats(CoreTiming::GetGlobalTimeUs()); return perf_stats.GetAndResetStats(CoreTiming::GetGlobalTimeUs());
} }
@ -326,7 +337,7 @@ void System::PrepareReschedule() {
CurrentCpuCore().PrepareReschedule(); CurrentCpuCore().PrepareReschedule();
} }
PerfStats::Results System::GetAndResetPerfStats() { PerfStatsResults System::GetAndResetPerfStats() {
return impl->GetAndResetPerfStats(); return impl->GetAndResetPerfStats();
} }
@ -433,11 +444,11 @@ std::shared_ptr<Tegra::DebugContext> System::GetGPUDebugContext() const {
return impl->debug_context; return impl->debug_context;
} }
void System::SetFilesystem(FileSys::VirtualFilesystem vfs) { void System::SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs) {
impl->virtual_filesystem = std::move(vfs); impl->virtual_filesystem = std::move(vfs);
} }
FileSys::VirtualFilesystem System::GetFilesystem() const { std::shared_ptr<FileSys::VfsFilesystem> System::GetFilesystem() const {
return impl->virtual_filesystem; return impl->virtual_filesystem;
} }

View file

@ -4,41 +4,55 @@
#pragma once #pragma once
#include <array> #include <cstddef>
#include <map>
#include <memory> #include <memory>
#include <string> #include <string>
#include <thread>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/arm/exclusive_monitor.h"
#include "core/core_cpu.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/scheduler.h"
#include "core/loader/loader.h"
#include "core/memory.h"
#include "core/perf_stats.h"
#include "core/telemetry_session.h"
#include "file_sys/vfs_real.h"
#include "hle/service/filesystem/filesystem.h"
#include "video_core/debug_utils/debug_utils.h"
#include "video_core/gpu.h"
namespace Core::Frontend { namespace Core::Frontend {
class EmuWindow; class EmuWindow;
} } // namespace Core::Frontend
namespace FileSys {
class VfsFilesystem;
} // namespace FileSys
namespace Kernel {
class KernelCore;
class Process;
class Scheduler;
} // namespace Kernel
namespace Loader {
class AppLoader;
enum class ResultStatus : u16;
} // namespace Loader
namespace Service::SM { namespace Service::SM {
class ServiceManager; class ServiceManager;
} } // namespace Service::SM
namespace Tegra {
class DebugContext;
class GPU;
} // namespace Tegra
namespace VideoCore { namespace VideoCore {
class RendererBase; class RendererBase;
} } // namespace VideoCore
namespace Core { namespace Core {
class ARM_Interface; class ARM_Interface;
class Cpu;
class ExclusiveMonitor;
class FrameLimiter;
class PerfStats;
class TelemetrySession;
struct PerfStatsResults;
class System { class System {
public: public:
@ -125,7 +139,7 @@ public:
void PrepareReschedule(); void PrepareReschedule();
/// Gets and resets core performance statistics /// Gets and resets core performance statistics
PerfStats::Results GetAndResetPerfStats(); PerfStatsResults GetAndResetPerfStats();
/// Gets an ARM interface to the CPU core that is currently running /// Gets an ARM interface to the CPU core that is currently running
ARM_Interface& CurrentArmInterface(); ARM_Interface& CurrentArmInterface();
@ -197,9 +211,9 @@ public:
std::shared_ptr<Tegra::DebugContext> GetGPUDebugContext() const; std::shared_ptr<Tegra::DebugContext> GetGPUDebugContext() const;
void SetFilesystem(FileSys::VirtualFilesystem vfs); void SetFilesystem(std::shared_ptr<FileSys::VfsFilesystem> vfs);
FileSys::VirtualFilesystem GetFilesystem() const; std::shared_ptr<FileSys::VfsFilesystem> GetFilesystem() const;
private: private:
System(); System();

View file

@ -7,6 +7,7 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/file_sys/savedata_factory.h" #include "core/file_sys/savedata_factory.h"
#include "core/file_sys/vfs.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
namespace FileSys { namespace FileSys {

View file

@ -8,6 +8,7 @@
#include <string> #include <string>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/swap.h" #include "common/swap.h"
#include "core/file_sys/vfs.h"
#include "core/hle/result.h" #include "core/hle/result.h"
namespace FileSys { namespace FileSys {

View file

@ -8,9 +8,11 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_cpu.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/memory.h" #include "core/memory.h"

View file

@ -18,6 +18,7 @@
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"

View file

@ -13,6 +13,7 @@
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"
#include "core/hle/kernel/session.h" #include "core/hle/kernel/session.h"
@ -104,11 +105,10 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
// The ServerSession received a sync request, this means that there's new data available // The ServerSession received a sync request, this means that there's new data available
// from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or // from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or
// similar. // similar.
auto& handle_table = Core::System::GetInstance().Kernel().HandleTable();
Kernel::HLERequestContext context(this); Kernel::HLERequestContext context(this);
u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress()); u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress());
context.PopulateFromIncomingCommandBuffer(cmd_buf, *Core::CurrentProcess(), handle_table); context.PopulateFromIncomingCommandBuffer(cmd_buf, *Core::CurrentProcess(),
kernel.HandleTable());
ResultCode result = RESULT_SUCCESS; ResultCode result = RESULT_SUCCESS;
// If the session has been converted to a domain, handle the domain request // If the session has been converted to a domain, handle the domain request

View file

@ -12,16 +12,20 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/arm/exclusive_monitor.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_cpu.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/kernel/address_arbiter.h" #include "core/hle/kernel/address_arbiter.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/client_session.h" #include "core/hle/kernel/client_session.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/mutex.h" #include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/shared_memory.h" #include "core/hle/kernel/shared_memory.h"
#include "core/hle/kernel/svc.h" #include "core/hle/kernel/svc.h"
#include "core/hle/kernel/svc_wrap.h" #include "core/hle/kernel/svc_wrap.h"

View file

@ -16,6 +16,7 @@
#include "common/thread_queue_list.h" #include "common/thread_queue_list.h"
#include "core/arm/arm_interface.h" #include "core/arm/arm_interface.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_cpu.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/core_timing_util.h" #include "core/core_timing_util.h"
#include "core/hle/kernel/errors.h" #include "core/hle/kernel/errors.h"
@ -23,8 +24,8 @@
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/lock.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/memory.h" #include "core/memory.h"

View file

@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/file_sys/directory.h" #include "core/file_sys/directory.h"
#include "core/file_sys/vfs.h"
#include "core/hle/result.h" #include "core/hle/result.h"
namespace FileSys { namespace FileSys {

View file

@ -11,6 +11,7 @@
#include "core/file_sys/control_metadata.h" #include "core/file_sys/control_metadata.h"
#include "core/file_sys/romfs_factory.h" #include "core/file_sys/romfs_factory.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/filesystem/filesystem.h"

View file

@ -10,6 +10,7 @@
#include "common/file_util.h" #include "common/file_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/loader/elf.h" #include "core/loader/elf.h"

View file

@ -14,6 +14,7 @@
#include "core/file_sys/control_metadata.h" #include "core/file_sys/control_metadata.h"
#include "core/file_sys/vfs_offset.h" #include "core/file_sys/vfs_offset.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/loader/nro.h" #include "core/loader/nro.h"

View file

@ -11,6 +11,7 @@
#include "common/swap.h" #include "common/swap.h"
#include "core/core.h" #include "core/core.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/resource_limit.h" #include "core/hle/kernel/resource_limit.h"
#include "core/loader/nso.h" #include "core/loader/nso.h"

View file

@ -40,7 +40,7 @@ void PerfStats::EndGameFrame() {
game_frames += 1; game_frames += 1;
} }
PerfStats::Results PerfStats::GetAndResetStats(microseconds current_system_time_us) { PerfStatsResults PerfStats::GetAndResetStats(microseconds current_system_time_us) {
std::lock_guard<std::mutex> lock(object_mutex); std::lock_guard<std::mutex> lock(object_mutex);
const auto now = Clock::now(); const auto now = Clock::now();
@ -49,7 +49,7 @@ PerfStats::Results PerfStats::GetAndResetStats(microseconds current_system_time_
const auto system_us_per_second = (current_system_time_us - reset_point_system_us) / interval; const auto system_us_per_second = (current_system_time_us - reset_point_system_us) / interval;
Results results{}; PerfStatsResults results{};
results.system_fps = static_cast<double>(system_frames) / interval; results.system_fps = static_cast<double>(system_frames) / interval;
results.game_fps = static_cast<double>(game_frames) / interval; results.game_fps = static_cast<double>(game_frames) / interval;
results.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() / results.frametime = duration_cast<DoubleSecs>(accumulated_frametime).count() /

View file

@ -10,6 +10,17 @@
namespace Core { namespace Core {
struct PerfStatsResults {
/// System FPS (LCD VBlanks) in Hz
double system_fps;
/// Game FPS (GSP frame submissions) in Hz
double game_fps;
/// Walltime per system frame, in seconds, excluding any waits
double frametime;
/// Ratio of walltime / emulated time elapsed
double emulation_speed;
};
/** /**
* Class to manage and query performance/timing statistics. All public functions of this class are * Class to manage and query performance/timing statistics. All public functions of this class are
* thread-safe unless stated otherwise. * thread-safe unless stated otherwise.
@ -18,22 +29,11 @@ class PerfStats {
public: public:
using Clock = std::chrono::high_resolution_clock; using Clock = std::chrono::high_resolution_clock;
struct Results {
/// System FPS (LCD VBlanks) in Hz
double system_fps;
/// Game FPS (GSP frame submissions) in Hz
double game_fps;
/// Walltime per system frame, in seconds, excluding any waits
double frametime;
/// Ratio of walltime / emulated time elapsed
double emulation_speed;
};
void BeginSystemFrame(); void BeginSystemFrame();
void EndSystemFrame(); void EndSystemFrame();
void EndGameFrame(); void EndGameFrame();
Results GetAndResetStats(std::chrono::microseconds current_system_time_us); PerfStatsResults GetAndResetStats(std::chrono::microseconds current_system_time_us);
/** /**
* Gets the ratio between walltime and the emulated time of the previous system frame. This is * Gets the ratio between walltime and the emulated time of the previous system frame. This is

View file

@ -7,6 +7,7 @@
#include "common/file_util.h" #include "common/file_util.h"
#include "core/core.h" #include "core/core.h"
#include "core/loader/loader.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/telemetry_session.h" #include "core/telemetry_session.h"

View file

@ -5,13 +5,12 @@
#include <cinttypes> #include <cinttypes>
#include "common/assert.h" #include "common/assert.h"
#include "core/core.h" #include "core/core.h"
#include "core/memory.h"
#include "video_core/debug_utils/debug_utils.h" #include "video_core/debug_utils/debug_utils.h"
#include "video_core/engines/maxwell_3d.h" #include "video_core/engines/maxwell_3d.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
#include "video_core/textures/decoders.h"
#include "video_core/textures/texture.h" #include "video_core/textures/texture.h"
#include "video_core/video_core.h"
namespace Tegra { namespace Tegra {
namespace Engines { namespace Engines {

View file

@ -7,11 +7,10 @@
#include <set> #include <set>
#include <boost/icl/interval_map.hpp> #include <boost/icl/interval_map.hpp>
#include <boost/range/iterator_range_core.hpp>
#include "common/common_types.h" #include "common/common_types.h"
#include "core/core.h" #include "core/core.h"
#include "core/memory.h"
#include "video_core/memory_manager.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"

View file

@ -10,12 +10,14 @@
#include <glad/glad.h> #include <glad/glad.h>
#include "common/assert.h" #include "common/assert.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/telemetry.h"
#include "core/core.h" #include "core/core.h"
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "core/memory.h" #include "core/memory.h"
#include "core/perf_stats.h" #include "core/perf_stats.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/telemetry_session.h"
#include "core/tracer/recorder.h" #include "core/tracer/recorder.h"
#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/renderer_opengl/renderer_opengl.h"

View file

@ -9,11 +9,14 @@
#include "core/core.h" #include "core/core.h"
#include "core/hle/kernel/event.h" #include "core/hle/kernel/event.h"
#include "core/hle/kernel/handle_table.h" #include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/mutex.h" #include "core/hle/kernel/mutex.h"
#include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/kernel/timer.h" #include "core/hle/kernel/timer.h"
#include "core/hle/kernel/wait_object.h" #include "core/hle/kernel/wait_object.h"
WaitTreeItem::WaitTreeItem() = default;
WaitTreeItem::~WaitTreeItem() = default; WaitTreeItem::~WaitTreeItem() = default;
QColor WaitTreeItem::GetColor() const { QColor WaitTreeItem::GetColor() const {
@ -71,6 +74,7 @@ std::vector<std::unique_ptr<WaitTreeThread>> WaitTreeItem::MakeThreadItemList()
} }
WaitTreeText::WaitTreeText(const QString& t) : text(t) {} WaitTreeText::WaitTreeText(const QString& t) : text(t) {}
WaitTreeText::~WaitTreeText() = default;
QString WaitTreeText::GetText() const { QString WaitTreeText::GetText() const {
return text; return text;
@ -84,6 +88,8 @@ WaitTreeMutexInfo::WaitTreeMutexInfo(VAddr mutex_address) : mutex_address(mutex_
owner = handle_table.Get<Kernel::Thread>(owner_handle); owner = handle_table.Get<Kernel::Thread>(owner_handle);
} }
WaitTreeMutexInfo::~WaitTreeMutexInfo() = default;
QString WaitTreeMutexInfo::GetText() const { QString WaitTreeMutexInfo::GetText() const {
return tr("waiting for mutex 0x%1").arg(mutex_address, 16, 16, QLatin1Char('0')); return tr("waiting for mutex 0x%1").arg(mutex_address, 16, 16, QLatin1Char('0'));
} }
@ -102,6 +108,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeMutexInfo::GetChildren() cons
} }
WaitTreeCallstack::WaitTreeCallstack(const Kernel::Thread& thread) : thread(thread) {} WaitTreeCallstack::WaitTreeCallstack(const Kernel::Thread& thread) : thread(thread) {}
WaitTreeCallstack::~WaitTreeCallstack() = default;
QString WaitTreeCallstack::GetText() const { QString WaitTreeCallstack::GetText() const {
return tr("Call stack"); return tr("Call stack");
@ -126,6 +133,10 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeCallstack::GetChildren() cons
} }
WaitTreeWaitObject::WaitTreeWaitObject(const Kernel::WaitObject& o) : object(o) {} WaitTreeWaitObject::WaitTreeWaitObject(const Kernel::WaitObject& o) : object(o) {}
WaitTreeWaitObject::~WaitTreeWaitObject() = default;
WaitTreeExpandableItem::WaitTreeExpandableItem() = default;
WaitTreeExpandableItem::~WaitTreeExpandableItem() = default;
bool WaitTreeExpandableItem::IsExpandable() const { bool WaitTreeExpandableItem::IsExpandable() const {
return true; return true;
@ -180,6 +191,8 @@ WaitTreeObjectList::WaitTreeObjectList(
const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& list, bool w_all) const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& list, bool w_all)
: object_list(list), wait_all(w_all) {} : object_list(list), wait_all(w_all) {}
WaitTreeObjectList::~WaitTreeObjectList() = default;
QString WaitTreeObjectList::GetText() const { QString WaitTreeObjectList::GetText() const {
if (wait_all) if (wait_all)
return tr("waiting for all objects"); return tr("waiting for all objects");
@ -194,6 +207,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeObjectList::GetChildren() con
} }
WaitTreeThread::WaitTreeThread(const Kernel::Thread& thread) : WaitTreeWaitObject(thread) {} WaitTreeThread::WaitTreeThread(const Kernel::Thread& thread) : WaitTreeWaitObject(thread) {}
WaitTreeThread::~WaitTreeThread() = default;
QString WaitTreeThread::GetText() const { QString WaitTreeThread::GetText() const {
const auto& thread = static_cast<const Kernel::Thread&>(object); const auto& thread = static_cast<const Kernel::Thread&>(object);
@ -312,6 +326,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
} }
WaitTreeEvent::WaitTreeEvent(const Kernel::Event& object) : WaitTreeWaitObject(object) {} WaitTreeEvent::WaitTreeEvent(const Kernel::Event& object) : WaitTreeWaitObject(object) {}
WaitTreeEvent::~WaitTreeEvent() = default;
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeEvent::GetChildren() const { std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeEvent::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren()); std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
@ -323,6 +338,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeEvent::GetChildren() const {
} }
WaitTreeTimer::WaitTreeTimer(const Kernel::Timer& object) : WaitTreeWaitObject(object) {} WaitTreeTimer::WaitTreeTimer(const Kernel::Timer& object) : WaitTreeWaitObject(object) {}
WaitTreeTimer::~WaitTreeTimer() = default;
std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeTimer::GetChildren() const { std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeTimer::GetChildren() const {
std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren()); std::vector<std::unique_ptr<WaitTreeItem>> list(WaitTreeWaitObject::GetChildren());
@ -340,6 +356,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeTimer::GetChildren() const {
WaitTreeThreadList::WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list) WaitTreeThreadList::WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list)
: thread_list(list) {} : thread_list(list) {}
WaitTreeThreadList::~WaitTreeThreadList() = default;
QString WaitTreeThreadList::GetText() const { QString WaitTreeThreadList::GetText() const {
return tr("waited by thread"); return tr("waited by thread");
@ -353,6 +370,7 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThreadList::GetChildren() con
} }
WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {} WaitTreeModel::WaitTreeModel(QObject* parent) : QAbstractItemModel(parent) {}
WaitTreeModel::~WaitTreeModel() = default;
QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const { QModelIndex WaitTreeModel::index(int row, int column, const QModelIndex& parent) const {
if (!hasIndex(row, column, parent)) if (!hasIndex(row, column, parent))
@ -421,6 +439,8 @@ WaitTreeWidget::WaitTreeWidget(QWidget* parent) : QDockWidget(tr("Wait Tree"), p
setEnabled(false); setEnabled(false);
} }
WaitTreeWidget::~WaitTreeWidget() = default;
void WaitTreeWidget::OnDebugModeEntered() { void WaitTreeWidget::OnDebugModeEntered() {
if (!Core::System::GetInstance().IsPoweredOn()) if (!Core::System::GetInstance().IsPoweredOn())
return; return;

View file

@ -4,11 +4,15 @@
#pragma once #pragma once
#include <cstddef>
#include <memory>
#include <vector>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QDockWidget> #include <QDockWidget>
#include <QTreeView> #include <QTreeView>
#include <boost/container/flat_set.hpp> #include <boost/container/flat_set.hpp>
#include "core/core.h" #include "common/common_types.h"
#include "core/hle/kernel/object.h" #include "core/hle/kernel/object.h"
class EmuThread; class EmuThread;
@ -25,6 +29,7 @@ class WaitTreeThread;
class WaitTreeItem : public QObject { class WaitTreeItem : public QObject {
Q_OBJECT Q_OBJECT
public: public:
WaitTreeItem();
~WaitTreeItem() override; ~WaitTreeItem() override;
virtual bool IsExpandable() const; virtual bool IsExpandable() const;
@ -49,6 +54,8 @@ class WaitTreeText : public WaitTreeItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeText(const QString& text); explicit WaitTreeText(const QString& text);
~WaitTreeText() override;
QString GetText() const override; QString GetText() const override;
private: private:
@ -58,6 +65,9 @@ private:
class WaitTreeExpandableItem : public WaitTreeItem { class WaitTreeExpandableItem : public WaitTreeItem {
Q_OBJECT Q_OBJECT
public: public:
WaitTreeExpandableItem();
~WaitTreeExpandableItem() override;
bool IsExpandable() const override; bool IsExpandable() const override;
}; };
@ -65,6 +75,8 @@ class WaitTreeMutexInfo : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeMutexInfo(VAddr mutex_address); explicit WaitTreeMutexInfo(VAddr mutex_address);
~WaitTreeMutexInfo() override;
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@ -79,6 +91,8 @@ class WaitTreeCallstack : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeCallstack(const Kernel::Thread& thread); explicit WaitTreeCallstack(const Kernel::Thread& thread);
~WaitTreeCallstack() override;
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@ -90,6 +104,8 @@ class WaitTreeWaitObject : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeWaitObject(const Kernel::WaitObject& object); explicit WaitTreeWaitObject(const Kernel::WaitObject& object);
~WaitTreeWaitObject() override;
static std::unique_ptr<WaitTreeWaitObject> make(const Kernel::WaitObject& object); static std::unique_ptr<WaitTreeWaitObject> make(const Kernel::WaitObject& object);
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@ -105,6 +121,8 @@ class WaitTreeObjectList : public WaitTreeExpandableItem {
public: public:
WaitTreeObjectList(const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& list, WaitTreeObjectList(const std::vector<Kernel::SharedPtr<Kernel::WaitObject>>& list,
bool wait_all); bool wait_all);
~WaitTreeObjectList() override;
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@ -117,6 +135,8 @@ class WaitTreeThread : public WaitTreeWaitObject {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeThread(const Kernel::Thread& thread); explicit WaitTreeThread(const Kernel::Thread& thread);
~WaitTreeThread() override;
QString GetText() const override; QString GetText() const override;
QColor GetColor() const override; QColor GetColor() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@ -126,6 +146,8 @@ class WaitTreeEvent : public WaitTreeWaitObject {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeEvent(const Kernel::Event& object); explicit WaitTreeEvent(const Kernel::Event& object);
~WaitTreeEvent() override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
}; };
@ -133,6 +155,8 @@ class WaitTreeTimer : public WaitTreeWaitObject {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeTimer(const Kernel::Timer& object); explicit WaitTreeTimer(const Kernel::Timer& object);
~WaitTreeTimer() override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
}; };
@ -140,6 +164,8 @@ class WaitTreeThreadList : public WaitTreeExpandableItem {
Q_OBJECT Q_OBJECT
public: public:
explicit WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list); explicit WaitTreeThreadList(const std::vector<Kernel::SharedPtr<Kernel::Thread>>& list);
~WaitTreeThreadList() override;
QString GetText() const override; QString GetText() const override;
std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override; std::vector<std::unique_ptr<WaitTreeItem>> GetChildren() const override;
@ -152,6 +178,7 @@ class WaitTreeModel : public QAbstractItemModel {
public: public:
explicit WaitTreeModel(QObject* parent = nullptr); explicit WaitTreeModel(QObject* parent = nullptr);
~WaitTreeModel() override;
QVariant data(const QModelIndex& index, int role) const override; QVariant data(const QModelIndex& index, int role) const override;
QModelIndex index(int row, int column, const QModelIndex& parent) const override; QModelIndex index(int row, int column, const QModelIndex& parent) const override;
@ -171,6 +198,7 @@ class WaitTreeWidget : public QDockWidget {
public: public:
explicit WaitTreeWidget(QWidget* parent = nullptr); explicit WaitTreeWidget(QWidget* parent = nullptr);
~WaitTreeWidget() override;
public slots: public slots:
void OnDebugModeEntered(); void OnDebugModeEntered();

View file

@ -23,10 +23,12 @@
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#include "core/file_sys/romfs.h" #include "core/file_sys/romfs.h"
#include "core/file_sys/vfs_real.h" #include "core/file_sys/vfs_real.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "game_list.h" #include "yuzu/game_list.h"
#include "game_list_p.h" #include "yuzu/game_list_p.h"
#include "ui_settings.h" #include "yuzu/main.h"
#include "yuzu/ui_settings.h"
GameList::SearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist) : gamelist{gamelist} {} GameList::SearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist) : gamelist{gamelist} {}
@ -481,6 +483,14 @@ static void GetMetadataFromControlNCA(const std::shared_ptr<FileSys::NCA>& nca,
} }
} }
GameListWorker::GameListWorker(
FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan,
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list)
: vfs(std::move(vfs)), dir_path(std::move(dir_path)), deep_scan(deep_scan),
compatibility_list(compatibility_list) {}
GameListWorker::~GameListWorker() = default;
void GameListWorker::AddInstalledTitlesToGameList(std::shared_ptr<FileSys::RegisteredCache> cache) { void GameListWorker::AddInstalledTitlesToGameList(std::shared_ptr<FileSys::RegisteredCache> cache) {
const auto installed_games = cache->ListEntriesFilter(FileSys::TitleType::Application, const auto installed_games = cache->ListEntriesFilter(FileSys::TitleType::Application,
FileSys::ContentRecordType::Program); FileSys::ContentRecordType::Program);

View file

@ -4,6 +4,8 @@
#pragma once #pragma once
#include <unordered_map>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QLabel> #include <QLabel>
@ -17,9 +19,13 @@
#include <QTreeView> #include <QTreeView>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget> #include <QWidget>
#include "main.h"
class GameListWorker; class GameListWorker;
class GMainWindow;
namespace FileSys {
class VfsFilesystem;
}
enum class GameListOpenTarget { SaveData }; enum class GameListOpenTarget { SaveData };
@ -62,7 +68,7 @@ public:
QToolButton* button_filter_close = nullptr; QToolButton* button_filter_close = nullptr;
}; };
explicit GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent = nullptr); explicit GameList(std::shared_ptr<FileSys::VfsFilesystem> vfs, GMainWindow* parent = nullptr);
~GameList() override; ~GameList() override;
void clearFilter(); void clearFilter();
@ -97,7 +103,7 @@ private:
void PopupContextMenu(const QPoint& menu_location); void PopupContextMenu(const QPoint& menu_location);
void RefreshGameDirectory(); void RefreshGameDirectory();
FileSys::VirtualFilesystem vfs; std::shared_ptr<FileSys::VfsFilesystem> vfs;
SearchField* search_field; SearchField* search_field;
GMainWindow* main_window = nullptr; GMainWindow* main_window = nullptr;
QVBoxLayout* layout = nullptr; QVBoxLayout* layout = nullptr;

View file

@ -18,10 +18,15 @@
#include <QString> #include <QString>
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/file_sys/content_archive.h" #include "yuzu/ui_settings.h"
#include "ui_settings.h"
#include "yuzu/util/util.h" #include "yuzu/util/util.h"
namespace FileSys {
class NCA;
class RegisteredCache;
class VfsFilesystem;
} // namespace FileSys
/** /**
* Gets the default icon (for games without valid SMDH) * Gets the default icon (for games without valid SMDH)
* @param large If true, returns large icon (48x48), otherwise returns small icon (24x24) * @param large If true, returns large icon (48x48), otherwise returns small icon (24x24)
@ -196,10 +201,9 @@ class GameListWorker : public QObject, public QRunnable {
public: public:
GameListWorker( GameListWorker(
FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan, std::shared_ptr<FileSys::VfsFilesystem> vfs, QString dir_path, bool deep_scan,
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list) const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list);
: vfs(std::move(vfs)), dir_path(std::move(dir_path)), deep_scan(deep_scan), ~GameListWorker() override;
compatibility_list(compatibility_list) {}
public slots: public slots:
/// Starts the processing of directory tree information. /// Starts the processing of directory tree information.
@ -222,7 +226,7 @@ signals:
void Finished(QStringList watch_list); void Finished(QStringList watch_list);
private: private:
FileSys::VirtualFilesystem vfs; std::shared_ptr<FileSys::VfsFilesystem> vfs;
std::map<u64, std::shared_ptr<FileSys::NCA>> nca_control_map; std::map<u64, std::shared_ptr<FileSys::NCA>> nca_control_map;
QStringList watch_list; QStringList watch_list;
QString dir_path; QString dir_path;

View file

@ -21,22 +21,22 @@
#include "common/logging/backend.h" #include "common/logging/backend.h"
#include "common/logging/filter.h" #include "common/logging/filter.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/logging/text_formatter.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "common/scm_rev.h" #include "common/scm_rev.h"
#include "common/scope_exit.h" #include "common/scope_exit.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/telemetry.h"
#include "core/core.h" #include "core/core.h"
#include "core/crypto/key_manager.h" #include "core/crypto/key_manager.h"
#include "core/file_sys/bis_factory.h"
#include "core/file_sys/card_image.h" #include "core/file_sys/card_image.h"
#include "core/file_sys/registered_cache.h" #include "core/file_sys/registered_cache.h"
#include "core/file_sys/savedata_factory.h" #include "core/file_sys/savedata_factory.h"
#include "core/file_sys/vfs_real.h" #include "core/file_sys/vfs_real.h"
#include "core/gdbstub/gdbstub.h" #include "core/hle/service/filesystem/filesystem.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/perf_stats.h"
#include "core/settings.h" #include "core/settings.h"
#include "game_list_p.h" #include "core/telemetry_session.h"
#include "video_core/debug_utils/debug_utils.h" #include "video_core/debug_utils/debug_utils.h"
#include "yuzu/about_dialog.h" #include "yuzu/about_dialog.h"
#include "yuzu/bootmanager.h" #include "yuzu/bootmanager.h"
@ -48,6 +48,7 @@
#include "yuzu/debugger/profiler.h" #include "yuzu/debugger/profiler.h"
#include "yuzu/debugger/wait_tree.h" #include "yuzu/debugger/wait_tree.h"
#include "yuzu/game_list.h" #include "yuzu/game_list.h"
#include "yuzu/game_list_p.h"
#include "yuzu/hotkeys.h" #include "yuzu/hotkeys.h"
#include "yuzu/main.h" #include "yuzu/main.h"
#include "yuzu/ui_settings.h" #include "yuzu/ui_settings.h"

View file

@ -5,6 +5,7 @@
#pragma once #pragma once
#include <memory> #include <memory>
#include <unordered_map>
#include <QMainWindow> #include <QMainWindow>
#include <QTimer> #include <QTimer>
#include "core/core.h" #include "core/core.h"
@ -23,6 +24,10 @@ class ProfilerWidget;
class WaitTreeWidget; class WaitTreeWidget;
enum class GameListOpenTarget; enum class GameListOpenTarget;
namespace FileSys {
class VfsFilesystem;
}
namespace Tegra { namespace Tegra {
class DebugContext; class DebugContext;
} }
@ -169,7 +174,7 @@ private:
QString game_path; QString game_path;
// FS // FS
FileSys::VirtualFilesystem vfs; std::shared_ptr<FileSys::VfsFilesystem> vfs;
// Debugger panes // Debugger panes
ProfilerWidget* profilerWidget; ProfilerWidget* profilerWidget;

View file

@ -17,10 +17,13 @@
#include "common/scm_rev.h" #include "common/scm_rev.h"
#include "common/scope_exit.h" #include "common/scope_exit.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "common/telemetry.h"
#include "core/core.h" #include "core/core.h"
#include "core/file_sys/vfs_real.h"
#include "core/gdbstub/gdbstub.h" #include "core/gdbstub/gdbstub.h"
#include "core/loader/loader.h" #include "core/loader/loader.h"
#include "core/settings.h" #include "core/settings.h"
#include "core/telemetry_session.h"
#include "yuzu_cmd/config.h" #include "yuzu_cmd/config.h"
#include "yuzu_cmd/emu_window/emu_window_sdl2.h" #include "yuzu_cmd/emu_window/emu_window_sdl2.h"