From f8b8b6e53cf518a53c0ae5f0201660c1250c0393 Mon Sep 17 00:00:00 2001 From: GPUCode <47210458+GPUCode@users.noreply.github.com> Date: Tue, 1 Aug 2023 03:57:38 +0300 Subject: [PATCH] core: De-globalize movie (#6659) --- src/android/app/src/main/jni/native.cpp | 3 +- src/audio_core/hle/hle.cpp | 1 + src/citra/citra.cpp | 8 ++---- src/citra_qt/compatdb.cpp | 1 + .../configuration/configure_storage.cpp | 1 + src/citra_qt/debugger/wait_tree.cpp | 3 +- src/citra_qt/discord_impl.cpp | 12 +++++--- src/citra_qt/discord_impl.h | 9 +++++- src/citra_qt/main.cpp | 12 ++++---- src/citra_qt/movie/movie_play_dialog.cpp | 16 ++++++----- src/citra_qt/movie/movie_play_dialog.h | 7 ++++- src/citra_qt/movie/movie_record_dialog.cpp | 8 +++--- src/citra_qt/movie/movie_record_dialog.h | 7 ++++- src/core/core.cpp | 22 +++++++++++---- src/core/core.h | 28 +++++++++++++++---- src/core/file_sys/ncch_container.h | 2 +- src/core/hle/kernel/hle_ipc.cpp | 1 + src/core/hle/kernel/kernel.cpp | 4 +-- src/core/hle/kernel/kernel.h | 5 ++-- src/core/hle/kernel/memory.cpp | 5 ++-- src/core/hle/kernel/shared_page.cpp | 10 +++---- src/core/hle/kernel/shared_page.h | 2 +- src/core/hle/kernel/svc.cpp | 2 +- src/core/hle/kernel/vm_manager.h | 1 + src/core/hle/service/act/act.cpp | 1 + src/core/hle/service/apt/applet_manager.cpp | 2 ++ src/core/hle/service/apt/apt.cpp | 2 ++ src/core/hle/service/frd/frd.cpp | 2 +- src/core/hle/service/hid/hid.cpp | 8 +++--- src/core/hle/service/ir/extra_hid.cpp | 7 ++--- src/core/hle/service/ir/extra_hid.h | 4 ++- src/core/hle/service/ir/ir_rst.cpp | 2 +- src/core/hle/service/ir/ir_user.cpp | 4 +-- src/core/hle/service/nfc/nfc_device.cpp | 3 +- src/core/hle/service/nim/nim_u.cpp | 1 + src/core/hle/service/service.cpp | 1 + src/core/loader/loader.h | 1 - src/core/loader/ncch.cpp | 1 + src/core/movie.cpp | 13 +++++---- src/core/movie.h | 26 +++++++++-------- src/core/savestate.cpp | 24 +++++++++------- src/core/savestate.h | 2 +- src/core/telemetry_session.cpp | 1 + src/tests/audio_core/hle/hle.cpp | 1 + src/tests/audio_core/lle/lle.cpp | 1 + .../custom_textures/custom_tex_manager.cpp | 2 ++ .../renderer_opengl/gl_shader_disk_cache.cpp | 3 +- .../renderer_opengl/gl_shader_gen.cpp | 1 + src/video_core/renderer_opengl/pica_to_gl.h | 1 + .../renderer_vulkan/vk_shader_gen.cpp | 1 + .../renderer_vulkan/vk_shader_gen_spv.cpp | 1 + 51 files changed, 182 insertions(+), 104 deletions(-) diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 00e6667c2..3fddd13fa 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -26,6 +26,7 @@ #include "core/hle/service/nfc/nfc.h" #include "core/loader/loader.h" #include "core/savestate.h" +#include "core/telemetry_session.h" #include "jni/android_common/android_common.h" #include "jni/applets/mii_selector.h" #include "jni/applets/swkbd.h" @@ -621,7 +622,7 @@ jobjectArray Java_org_citra_citra_1emu_NativeLibrary_GetSavestateInfo( return nullptr; } - const auto savestates = Core::ListSaveStates(title_id); + const auto savestates = Core::ListSaveStates(title_id, system.Movie().GetCurrentMovieID()); const jobjectArray array = env->NewObjectArray(static_cast(savestates.size()), savestate_info_class, nullptr); for (std::size_t i = 0; i < savestates.size(); ++i) { diff --git a/src/audio_core/hle/hle.cpp b/src/audio_core/hle/hle.cpp index 38632d252..f24176ca8 100644 --- a/src/audio_core/hle/hle.cpp +++ b/src/audio_core/hle/hle.cpp @@ -8,6 +8,7 @@ #include #include #include "audio_core/audio_types.h" +#include "common/archives.h" #ifdef HAVE_MF #include "audio_core/hle/wmf_decoder.h" #elif HAVE_AUDIOTOOLBOX diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index c23324212..588f46403 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -19,7 +19,6 @@ #include "common/detached_tasks.h" #include "common/file_util.h" #include "common/logging/backend.h" -#include "common/logging/filter.h" #include "common/logging/log.h" #include "common/scm_rev.h" #include "common/scope_exit.h" @@ -28,18 +27,15 @@ #include "core/core.h" #include "core/dumping/backend.h" #include "core/dumping/ffmpeg_backend.h" -#include "core/file_sys/cia_container.h" #include "core/frontend/applets/default_applets.h" #include "core/frontend/framebuffer_layout.h" -#include "core/gdbstub/gdbstub.h" #include "core/hle/service/am/am.h" #include "core/hle/service/cfg/cfg.h" -#include "core/loader/loader.h" #include "core/movie.h" +#include "core/telemetry_session.h" #include "input_common/main.h" #include "network/network.h" #include "video_core/renderer_base.h" -#include "video_core/video_core.h" #undef _UNICODE #include @@ -331,7 +327,7 @@ int main(int argc, char** argv) { } auto& system = Core::System::GetInstance(); - auto& movie = Core::Movie::GetInstance(); + auto& movie = system.Movie(); if (!movie_record.empty()) { movie.PrepareForRecording(); diff --git a/src/citra_qt/compatdb.cpp b/src/citra_qt/compatdb.cpp index 92069dcca..ca8f5870a 100644 --- a/src/citra_qt/compatdb.cpp +++ b/src/citra_qt/compatdb.cpp @@ -9,6 +9,7 @@ #include "citra_qt/compatdb.h" #include "common/telemetry.h" #include "core/core.h" +#include "core/telemetry_session.h" #include "ui_compatdb.h" CompatDB::CompatDB(Core::TelemetrySession& telemetry_session_, QWidget* parent) diff --git a/src/citra_qt/configuration/configure_storage.cpp b/src/citra_qt/configuration/configure_storage.cpp index 694395ead..dfcfcc3cb 100644 --- a/src/citra_qt/configuration/configure_storage.cpp +++ b/src/citra_qt/configuration/configure_storage.cpp @@ -6,6 +6,7 @@ #include #include #include "citra_qt/configuration/configure_storage.h" +#include "common/file_util.h" #include "common/settings.h" #include "core/core.h" #include "ui_configure_storage.h" diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp index 2e70e1cd3..67baf0fec 100644 --- a/src/citra_qt/debugger/wait_tree.cpp +++ b/src/citra_qt/debugger/wait_tree.cpp @@ -5,11 +5,10 @@ #include #include "citra_qt/debugger/wait_tree.h" #include "citra_qt/uisettings.h" -#include "citra_qt/util/util.h" #include "common/assert.h" -#include "common/settings.h" #include "core/hle/kernel/event.h" #include "core/hle/kernel/mutex.h" +#include "core/hle/kernel/process.h" #include "core/hle/kernel/semaphore.h" #include "core/hle/kernel/thread.h" #include "core/hle/kernel/timer.h" diff --git a/src/citra_qt/discord_impl.cpp b/src/citra_qt/discord_impl.cpp index 25f97d07c..076c15fa8 100644 --- a/src/citra_qt/discord_impl.cpp +++ b/src/citra_qt/discord_impl.cpp @@ -9,10 +9,11 @@ #include "citra_qt/uisettings.h" #include "common/common_types.h" #include "core/core.h" +#include "core/loader/loader.h" namespace DiscordRPC { -DiscordImpl::DiscordImpl() { +DiscordImpl::DiscordImpl(const Core::System& system_) : system{system_} { DiscordEventHandlers handlers{}; // The number is the client ID for Citra, it's used for images and the @@ -34,12 +35,15 @@ void DiscordImpl::Update() { std::chrono::system_clock::now().time_since_epoch()) .count(); std::string title; - if (Core::System::GetInstance().IsPoweredOn()) - Core::System::GetInstance().GetAppLoader().ReadTitle(title); + const bool is_powered_on = system.IsPoweredOn(); + if (is_powered_on) { + system.GetAppLoader().ReadTitle(title); + } + DiscordRichPresence presence{}; presence.largeImageKey = "citra"; presence.largeImageText = "Citra is an emulator for the Nintendo 3DS"; - if (Core::System::GetInstance().IsPoweredOn()) { + if (is_powered_on) { presence.state = title.c_str(); presence.details = "Currently in game"; } else { diff --git a/src/citra_qt/discord_impl.h b/src/citra_qt/discord_impl.h index 067cf2e3d..25bee0696 100644 --- a/src/citra_qt/discord_impl.h +++ b/src/citra_qt/discord_impl.h @@ -6,15 +6,22 @@ #include "citra_qt/discord.h" +namespace Core { +class System; +} + namespace DiscordRPC { class DiscordImpl : public DiscordInterface { public: - DiscordImpl(); + DiscordImpl(const Core::System& system); ~DiscordImpl() override; void Pause() override; void Update() override; + +private: + const Core::System& system; }; } // namespace DiscordRPC diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 7eb2e4b7a..c9e9cdc6f 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -14,6 +14,7 @@ #include #include #include +#include "core/telemetry_session.h" #ifdef __APPLE__ #include // for chdir #endif @@ -73,7 +74,6 @@ #include "common/microprofile.h" #include "common/scm_rev.h" #include "common/scope_exit.h" -#include "common/string_util.h" #if CITRA_ARCH(x86_64) #include "common/x64/cpu_detect.h" #endif @@ -173,7 +173,7 @@ static QString PrettyProductName() { } GMainWindow::GMainWindow(Core::System& system_) - : ui{std::make_unique()}, system{system_}, movie{Core::Movie::GetInstance()}, + : ui{std::make_unique()}, system{system_}, movie{system.Movie()}, config{std::make_unique()}, emu_thread{nullptr} { Common::Log::Initialize(); Common::Log::Start(); @@ -1413,7 +1413,7 @@ void GMainWindow::UpdateSaveStates() { if (system.GetAppLoader().ReadProgramId(title_id) != Loader::ResultStatus::Success) { return; } - auto savestates = Core::ListSaveStates(title_id); + auto savestates = Core::ListSaveStates(title_id, movie.GetCurrentMovieID()); for (u32 i = 0; i < Core::SaveStateSlotCount; ++i) { actions_load_state[i]->setEnabled(false); actions_load_state[i]->setText(tr("Slot %1").arg(i + 1)); @@ -2125,7 +2125,7 @@ void GMainWindow::OnCreateGraphicsSurfaceViewer() { } void GMainWindow::OnRecordMovie() { - MovieRecordDialog dialog(this); + MovieRecordDialog dialog(this, system); if (dialog.exec() != QDialog::Accepted) { return; } @@ -2142,7 +2142,7 @@ void GMainWindow::OnRecordMovie() { } void GMainWindow::OnPlayMovie() { - MoviePlayDialog dialog(this, game_list); + MoviePlayDialog dialog(this, game_list, system); if (dialog.exec() != QDialog::Accepted) { return; } @@ -2847,7 +2847,7 @@ void GMainWindow::RetranslateStatusBar() { void GMainWindow::SetDiscordEnabled([[maybe_unused]] bool state) { #ifdef USE_DISCORD_PRESENCE if (state) { - discord_rpc = std::make_unique(); + discord_rpc = std::make_unique(system); } else { discord_rpc = std::make_unique(); } diff --git a/src/citra_qt/movie/movie_play_dialog.cpp b/src/citra_qt/movie/movie_play_dialog.cpp index 0a389985a..dfdc799f1 100644 --- a/src/citra_qt/movie/movie_play_dialog.cpp +++ b/src/citra_qt/movie/movie_play_dialog.cpp @@ -15,8 +15,9 @@ #include "core/movie.h" #include "ui_movie_play_dialog.h" -MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_) - : QDialog(parent), ui(std::make_unique()), game_list(game_list_) { +MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_, const Core::System& system_) + : QDialog(parent), + ui(std::make_unique()), game_list{game_list_}, system{system_} { ui->setupUi(this); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); @@ -26,10 +27,10 @@ MoviePlayDialog::MoviePlayDialog(QWidget* parent, GameList* game_list_) connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &MoviePlayDialog::accept); connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &MoviePlayDialog::reject); - if (Core::System::GetInstance().IsPoweredOn()) { + if (system.IsPoweredOn()) { QString note_text; note_text = tr("Current running game will be stopped."); - if (Core::Movie::GetInstance().GetPlayMode() == Core::Movie::PlayMode::Recording) { + if (system.Movie().GetPlayMode() == Core::Movie::PlayMode::Recording) { note_text.append(tr("
Current recording will be discarded.")); } ui->note2Label->setText(note_text); @@ -43,7 +44,7 @@ QString MoviePlayDialog::GetMoviePath() const { } QString MoviePlayDialog::GetGamePath() const { - const auto metadata = Core::Movie::GetInstance().GetMovieMetadata(GetMoviePath().toStdString()); + const auto metadata = system.Movie().GetMovieMetadata(GetMoviePath().toStdString()); return game_list->FindGameByProgramID(metadata.program_id, GameListItemPath::FullPathRole); } @@ -67,9 +68,10 @@ void MoviePlayDialog::UpdateUIDisplay() { ui->lengthLineEdit->clear(); ui->note1Label->setVisible(true); + const auto& movie = system.Movie(); const auto path = GetMoviePath().toStdString(); - const auto validation_result = Core::Movie::GetInstance().ValidateMovie(path); + const auto validation_result = movie.ValidateMovie(path); if (validation_result == Core::Movie::ValidationResult::Invalid) { ui->note1Label->setText(tr("Invalid movie file.")); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); @@ -94,7 +96,7 @@ void MoviePlayDialog::UpdateUIDisplay() { UNREACHABLE(); } - const auto metadata = Core::Movie::GetInstance().GetMovieMetadata(path); + const auto metadata = movie.GetMovieMetadata(path); // Format game title const auto title = diff --git a/src/citra_qt/movie/movie_play_dialog.h b/src/citra_qt/movie/movie_play_dialog.h index dc4f344a5..12d6ff991 100644 --- a/src/citra_qt/movie/movie_play_dialog.h +++ b/src/citra_qt/movie/movie_play_dialog.h @@ -11,11 +11,15 @@ namespace Ui { class MoviePlayDialog; } +namespace Core { +class System; +} + class MoviePlayDialog : public QDialog { Q_OBJECT public: - explicit MoviePlayDialog(QWidget* parent, GameList* game_list); + explicit MoviePlayDialog(QWidget* parent, GameList* game_list, const Core::System& system); ~MoviePlayDialog() override; QString GetMoviePath() const; @@ -27,4 +31,5 @@ private: std::unique_ptr ui; GameList* game_list; + const Core::System& system; }; diff --git a/src/citra_qt/movie/movie_record_dialog.cpp b/src/citra_qt/movie/movie_record_dialog.cpp index 9b7967d9a..b68914535 100644 --- a/src/citra_qt/movie/movie_record_dialog.cpp +++ b/src/citra_qt/movie/movie_record_dialog.cpp @@ -10,8 +10,8 @@ #include "core/movie.h" #include "ui_movie_record_dialog.h" -MovieRecordDialog::MovieRecordDialog(QWidget* parent) - : QDialog(parent), ui(std::make_unique()) { +MovieRecordDialog::MovieRecordDialog(QWidget* parent, const Core::System& system_) + : QDialog(parent), ui(std::make_unique()), system{system_} { ui->setupUi(this); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); @@ -23,9 +23,9 @@ MovieRecordDialog::MovieRecordDialog(QWidget* parent) connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &MovieRecordDialog::reject); QString note_text; - if (Core::System::GetInstance().IsPoweredOn()) { + if (system.IsPoweredOn()) { note_text = tr("Current running game will be restarted."); - if (Core::Movie::GetInstance().GetPlayMode() == Core::Movie::PlayMode::Recording) { + if (system.Movie().GetPlayMode() == Core::Movie::PlayMode::Recording) { note_text.append(tr("
Current recording will be discarded.")); } } else { diff --git a/src/citra_qt/movie/movie_record_dialog.h b/src/citra_qt/movie/movie_record_dialog.h index c91f1f414..4eb03af9a 100644 --- a/src/citra_qt/movie/movie_record_dialog.h +++ b/src/citra_qt/movie/movie_record_dialog.h @@ -9,11 +9,15 @@ namespace Ui { class MovieRecordDialog; } +namespace Core { +class System; +} + class MovieRecordDialog : public QDialog { Q_OBJECT public: - explicit MovieRecordDialog(QWidget* parent); + explicit MovieRecordDialog(QWidget* parent, const Core::System& system); ~MovieRecordDialog() override; QString GetPath() const; @@ -24,4 +28,5 @@ private: void UpdateUIDisplay(); std::unique_ptr ui; + const Core::System& system; }; diff --git a/src/core/core.cpp b/src/core/core.cpp index c11d8b151..a8f651723 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -2,8 +2,6 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. -#include -#include #include #include #include @@ -16,6 +14,8 @@ #include "core/arm/arm_interface.h" #include "core/arm/exclusive_monitor.h" #include "core/hle/service/cam/cam.h" +#include "core/hle/service/hid/hid.h" +#include "core/hle/service/ir/ir_user.h" #if CITRA_ARCH(x86_64) || CITRA_ARCH(arm64) #include "core/arm/dynarmic/arm_dynarmic.h" #endif @@ -35,9 +35,7 @@ #include "core/hle/service/cam/cam.h" #include "core/hle/service/fs/archive.h" #include "core/hle/service/gsp/gsp.h" -#include "core/hle/service/hid/hid.h" #include "core/hle/service/ir/ir_rst.h" -#include "core/hle/service/ir/ir_user.h" #include "core/hle/service/mic_u.h" #include "core/hle/service/plgldr/plgldr.h" #include "core/hle/service/service.h" @@ -48,6 +46,7 @@ #include "core/loader/loader.h" #include "core/movie.h" #include "core/rpc/server.h" +#include "core/telemetry_session.h" #include "network/network.h" #include "video_core/custom_textures/custom_tex_manager.h" #include "video_core/renderer_base.h" @@ -72,6 +71,8 @@ Core::Timing& Global() { return System::GetInstance().CoreTiming(); } +System::System() : movie{*this} {} + System::~System() = default; System::ResultStatus System::RunLoop(bool tight_loop) { @@ -372,7 +373,8 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, timing = std::make_unique(num_cores, Settings::values.cpu_clock_percentage.GetValue()); kernel = std::make_unique( - *memory, *timing, [this] { PrepareReschedule(); }, memory_mode, num_cores, n3ds_hw_caps); + *memory, *timing, [this] { PrepareReschedule(); }, memory_mode, num_cores, n3ds_hw_caps, + movie.GetOverrideInitTime()); exclusive_monitor = MakeExclusiveMonitor(*memory, num_cores); cpu_cores.reserve(num_cores); @@ -508,6 +510,14 @@ const VideoCore::CustomTexManager& System::CustomTexManager() const { return *custom_tex_manager; } +Core::Movie& System::Movie() { + return movie; +} + +const Core::Movie& System::Movie() const { + return movie; +} + void System::RegisterMiiSelector(std::shared_ptr mii_selector) { registered_mii_selector = std::move(mii_selector); } @@ -702,7 +712,7 @@ void System::serialize(Archive& ar, const unsigned int file_version) { ar&* kernel.get(); VideoCore::serialize(ar, file_version); if (file_version >= 1) { - ar& Movie::GetInstance(); + ar& movie; } // This needs to be set from somewhere - might as well be here! diff --git a/src/core/core.h b/src/core/core.h index af72da85c..d0ac12a3c 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -10,18 +10,17 @@ #include #include #include "common/common_types.h" -#include "core/frontend/applets/mii_selector.h" -#include "core/frontend/applets/swkbd.h" -#include "core/loader/loader.h" -#include "core/memory.h" +#include "core/arm/arm_interface.h" +#include "core/movie.h" #include "core/perf_stats.h" -#include "core/telemetry_session.h" class ARM_Interface; namespace Frontend { class EmuWindow; class ImageInterface; +class MiiSelector; +class SoftwareKeyboard; } // namespace Frontend namespace Memory { @@ -47,7 +46,9 @@ class ArchiveManager; namespace Kernel { class KernelSystem; -} +struct New3dsHwCapabilities; +enum class MemoryMode : u8; +} // namespace Kernel namespace Cheats { class CheatEngine; @@ -62,8 +63,13 @@ class CustomTexManager; class RendererBase; } // namespace VideoCore +namespace Loader { +class AppLoader; +} + namespace Core { +class TelemetrySession; class ExclusiveMonitor; class Timing; @@ -95,6 +101,7 @@ public: ErrorUnknown ///< Any other error }; + explicit System(); ~System(); /** @@ -258,6 +265,12 @@ public: /// Gets a const reference to the custom texture cache system [[nodiscard]] const VideoCore::CustomTexManager& CustomTexManager() const; + /// Gets a reference to the movie recorder + [[nodiscard]] Core::Movie& Movie(); + + /// Gets a const reference to the movie recorder + [[nodiscard]] const Core::Movie& Movie() const; + /// Video Dumper interface void RegisterVideoDumper(std::shared_ptr video_dumper); @@ -373,6 +386,9 @@ private: std::shared_ptr registered_mii_selector; std::shared_ptr registered_swkbd; + /// Movie recorder + Core::Movie movie; + /// Cheats manager std::unique_ptr cheat_engine; diff --git a/src/core/file_sys/ncch_container.h b/src/core/file_sys/ncch_container.h index a683a4ee5..ea1b66b48 100644 --- a/src/core/file_sys/ncch_container.h +++ b/src/core/file_sys/ncch_container.h @@ -12,8 +12,8 @@ #include "common/common_types.h" #include "common/file_util.h" #include "common/swap.h" -#include "core/core.h" #include "core/file_sys/romfs_reader.h" +#include "core/loader/loader.h" enum NCSDContentIndex { Main = 0, Manual = 1, DLP = 2, New3DSUpdate = 6, Update = 7 }; diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index ad5e6ee21..62b993f33 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp @@ -4,6 +4,7 @@ #include #include +#include "common/archives.h" #include "common/assert.h" #include "common/common_types.h" #include "core/core.h" diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 61612d617..d5cbf0fd6 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -25,13 +25,13 @@ namespace Kernel { KernelSystem::KernelSystem(Memory::MemorySystem& memory, Core::Timing& timing, std::function prepare_reschedule_callback, MemoryMode memory_mode, u32 num_cores, - const New3dsHwCapabilities& n3ds_hw_caps) + const New3dsHwCapabilities& n3ds_hw_caps, u64 override_init_time) : memory(memory), timing(timing), prepare_reschedule_callback(std::move(prepare_reschedule_callback)), memory_mode(memory_mode), n3ds_hw_caps(n3ds_hw_caps) { std::generate(memory_regions.begin(), memory_regions.end(), [] { return std::make_shared(); }); - MemoryInit(memory_mode, n3ds_hw_caps.memory_mode); + MemoryInit(memory_mode, n3ds_hw_caps.memory_mode, override_init_time); resource_limits = std::make_unique(*this); for (u32 core_id = 0; core_id < num_cores; ++core_id) { diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 69d267de0..c381e97cb 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -134,7 +134,8 @@ class KernelSystem { public: explicit KernelSystem(Memory::MemorySystem& memory, Core::Timing& timing, std::function prepare_reschedule_callback, MemoryMode memory_mode, - u32 num_cores, const New3dsHwCapabilities& n3ds_hw_caps); + u32 num_cores, const New3dsHwCapabilities& n3ds_hw_caps, + u64 override_init_time = 0); ~KernelSystem(); using PortPair = std::pair, std::shared_ptr>; @@ -330,7 +331,7 @@ public: Core::Timing& timing; private: - void MemoryInit(MemoryMode memory_mode, New3dsMemoryMode n3ds_mode); + void MemoryInit(MemoryMode memory_mode, New3dsMemoryMode n3ds_mode, u64 override_init_time); std::function prepare_reschedule_callback; diff --git a/src/core/hle/kernel/memory.cpp b/src/core/hle/kernel/memory.cpp index b77a14720..12fea67a1 100644 --- a/src/core/hle/kernel/memory.cpp +++ b/src/core/hle/kernel/memory.cpp @@ -37,7 +37,8 @@ static const u32 memory_region_sizes[8][3] = { {0x0B200000, 0x02E00000, 0x02000000}, // 7 }; -void KernelSystem::MemoryInit(MemoryMode memory_mode, New3dsMemoryMode n3ds_mode) { +void KernelSystem::MemoryInit(MemoryMode memory_mode, New3dsMemoryMode n3ds_mode, + u64 override_init_time) { const bool is_new_3ds = Settings::values.is_new_3ds.GetValue(); u32 mem_type_index = static_cast(memory_mode); u32 reported_mem_type = static_cast(memory_mode); @@ -73,7 +74,7 @@ void KernelSystem::MemoryInit(MemoryMode memory_mode, New3dsMemoryMode n3ds_mode config_mem.sys_mem_alloc = memory_regions[1]->size; config_mem.base_mem_alloc = memory_regions[2]->size; - shared_page_handler = std::make_shared(timing); + shared_page_handler = std::make_shared(timing, override_init_time); } std::shared_ptr KernelSystem::GetMemoryRegion(MemoryRegion region) { diff --git a/src/core/hle/kernel/shared_page.cpp b/src/core/hle/kernel/shared_page.cpp index 249c912d9..358397486 100644 --- a/src/core/hle/kernel/shared_page.cpp +++ b/src/core/hle/kernel/shared_page.cpp @@ -19,7 +19,8 @@ namespace boost::serialization { template void load_construct_data(Archive& ar, SharedPage::Handler* t, const unsigned int) { - ::new (t) SharedPage::Handler(Core::System::GetInstance().CoreTiming()); + ::new (t) SharedPage::Handler(Core::System::GetInstance().CoreTiming(), + Core::System::GetInstance().Movie().GetOverrideInitTime()); } template void load_construct_data(iarchive& ar, SharedPage::Handler* t, const unsigned int); @@ -28,8 +29,7 @@ template void load_construct_data(iarchive& ar, SharedPage::Handler* t namespace SharedPage { -static std::chrono::seconds GetInitTime() { - const u64 override_init_time = Core::Movie::GetInstance().GetOverrideInitTime(); +static std::chrono::seconds GetInitTime(u64 override_init_time) { if (override_init_time != 0) { // Override the clock init time with the one in the movie return std::chrono::seconds(override_init_time); @@ -62,7 +62,7 @@ static std::chrono::seconds GetInitTime() { } } -Handler::Handler(Core::Timing& timing) : timing(timing) { +Handler::Handler(Core::Timing& timing, u64 override_init_time) : timing(timing) { std::memset(&shared_page, 0, sizeof(shared_page)); shared_page.running_hw = 0x1; // product @@ -76,7 +76,7 @@ Handler::Handler(Core::Timing& timing) : timing(timing) { shared_page.battery_state.is_adapter_connected.Assign(1); shared_page.battery_state.is_charging.Assign(1); - init_time = GetInitTime(); + init_time = GetInitTime(override_init_time); using namespace std::placeholders; update_time_event = timing.RegisterEvent("SharedPage::UpdateTimeCallback", diff --git a/src/core/hle/kernel/shared_page.h b/src/core/hle/kernel/shared_page.h index ef7b86e5c..eebda7617 100644 --- a/src/core/hle/kernel/shared_page.h +++ b/src/core/hle/kernel/shared_page.h @@ -86,7 +86,7 @@ static_assert(sizeof(SharedPageDef) == Memory::SHARED_PAGE_SIZE, class Handler : public BackingMem { public: - Handler(Core::Timing& timing); + Handler(Core::Timing& timing, u64 override_init_time); void SetMacAddress(const MacAddress&); diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 385e64aac..41401c5c8 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -5,6 +5,7 @@ #include #include #include +#include "common/archives.h" #include "common/logging/log.h" #include "common/microprofile.h" #include "common/scm_rev.h" @@ -38,7 +39,6 @@ #include "core/hle/lock.h" #include "core/hle/result.h" #include "core/hle/service/plgldr/plgldr.h" -#include "core/hle/service/service.h" namespace Kernel { diff --git a/src/core/hle/kernel/vm_manager.h b/src/core/hle/kernel/vm_manager.h index ea0e14b2e..d520eeccb 100644 --- a/src/core/hle/kernel/vm_manager.h +++ b/src/core/hle/kernel/vm_manager.h @@ -13,6 +13,7 @@ #include #include "common/common_types.h" #include "common/memory_ref.h" +#include "core/hle/kernel/memory.h" #include "core/hle/result.h" #include "core/memory.h" #include "core/mmio.h" diff --git a/src/core/hle/service/act/act.cpp b/src/core/hle/service/act/act.cpp index cd9de87fe..96c62404d 100644 --- a/src/core/hle/service/act/act.cpp +++ b/src/core/hle/service/act/act.cpp @@ -4,6 +4,7 @@ #include "core/core.h" #include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/shared_memory.h" #include "core/hle/service/act/act.h" #include "core/hle/service/act/act_a.h" #include "core/hle/service/act/act_u.h" diff --git a/src/core/hle/service/apt/applet_manager.cpp b/src/core/hle/service/apt/applet_manager.cpp index 68f3026ee..36f401207 100644 --- a/src/core/hle/service/apt/applet_manager.cpp +++ b/src/core/hle/service/apt/applet_manager.cpp @@ -2,6 +2,8 @@ // Licensed under GPLv2 or any later version // Refer to the license.txt file included. +#include "common/archives.h" +#include "common/file_util.h" #include "common/settings.h" #include "core/core.h" #include "core/frontend/input.h" diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 998ba00d9..88d9e2953 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -33,6 +33,8 @@ #include "core/hle/service/service.h" #include "core/hw/aes/ccm.h" #include "core/hw/aes/key.h" +#include "core/loader/loader.h" +#include "core/telemetry_session.h" SERVICE_CONSTRUCT_IMPL(Service::APT::Module) diff --git a/src/core/hle/service/frd/frd.cpp b/src/core/hle/service/frd/frd.cpp index a8628b315..be8bdb8f5 100644 --- a/src/core/hle/service/frd/frd.cpp +++ b/src/core/hle/service/frd/frd.cpp @@ -5,9 +5,9 @@ #include #include #include +#include "common/archives.h" #include "common/assert.h" #include "common/logging/log.h" -#include "common/string_util.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/event.h" diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 2b81f47fb..cc4a33b46 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -150,7 +150,7 @@ void Module::UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late) { circle_pad_old_y.erase(circle_pad_old_y.begin()); circle_pad_old_y.push_back(circle_pad_new_y); - Core::Movie::GetInstance().HandlePadAndCircleStatus(state, circle_pad_x, circle_pad_y); + system.Movie().HandlePadAndCircleStatus(state, circle_pad_x, circle_pad_y); const DirectionState direction = GetStickDirectionState(circle_pad_x, circle_pad_y); state.circle_up.Assign(direction.up); @@ -200,7 +200,7 @@ void Module::UpdatePadCallback(std::uintptr_t user_data, s64 cycles_late) { touch_entry.y = static_cast(y * Core::kScreenBottomHeight); touch_entry.valid.Assign(pressed ? 1 : 0); - Core::Movie::GetInstance().HandleTouchStatus(touch_entry); + system.Movie().HandleTouchStatus(touch_entry); // TODO(bunnei): We're not doing anything with offset 0xA8 + 0x18 of HID SharedMemory, which // supposedly is "Touch-screen entry, which contains the raw coordinate data prior to being @@ -246,7 +246,7 @@ void Module::UpdateAccelerometerCallback(std::uintptr_t user_data, s64 cycles_la accelerometer_entry.y = static_cast(accel.y); accelerometer_entry.z = static_cast(accel.z); - Core::Movie::GetInstance().HandleAccelerometerStatus(accelerometer_entry); + system.Movie().HandleAccelerometerStatus(accelerometer_entry); // Make up "raw" entry // TODO(wwylele): @@ -287,7 +287,7 @@ void Module::UpdateGyroscopeCallback(std::uintptr_t user_data, s64 cycles_late) gyroscope_entry.y = static_cast(gyro.y); gyroscope_entry.z = static_cast(gyro.z); - Core::Movie::GetInstance().HandleGyroscopeStatus(gyroscope_entry); + system.Movie().HandleGyroscopeStatus(gyroscope_entry); // Make up "raw" entry mem->gyroscope.raw_entry.x = gyroscope_entry.x; diff --git a/src/core/hle/service/ir/extra_hid.cpp b/src/core/hle/service/ir/extra_hid.cpp index cddcd2edb..08af23c42 100644 --- a/src/core/hle/service/ir/extra_hid.cpp +++ b/src/core/hle/service/ir/extra_hid.cpp @@ -5,8 +5,6 @@ #include #include "common/alignment.h" #include "common/settings.h" -#include "common/string_util.h" -#include "core/core.h" #include "core/core_timing.h" #include "core/hle/service/ir/extra_hid.h" #include "core/movie.h" @@ -65,7 +63,8 @@ enum class ResponseID : u8 { ReadCalibrationData = 0x11, }; -ExtraHID::ExtraHID(SendFunc send_func, Core::Timing& timing) : IRDevice(send_func), timing(timing) { +ExtraHID::ExtraHID(SendFunc send_func, Core::Timing& timing_, Core::Movie& movie_) + : IRDevice(send_func), timing{timing_}, movie{movie_} { LoadInputDevices(); // The data below was retrieved from a New 3DS @@ -249,7 +248,7 @@ void ExtraHID::SendHIDStatus() { response.buttons.r_not_held.Assign(1); response.unknown = 0; - Core::Movie::GetInstance().HandleExtraHidResponse(response); + movie.HandleExtraHidResponse(response); std::vector response_buffer(sizeof(response)); memcpy(response_buffer.data(), &response, sizeof(response)); diff --git a/src/core/hle/service/ir/extra_hid.h b/src/core/hle/service/ir/extra_hid.h index 02974517d..5dc36b4cd 100644 --- a/src/core/hle/service/ir/extra_hid.h +++ b/src/core/hle/service/ir/extra_hid.h @@ -16,6 +16,7 @@ namespace Core { struct TimingEventType; class Timing; +class Movie; } // namespace Core namespace Service::IR { @@ -43,7 +44,7 @@ static_assert(sizeof(ExtraHIDResponse) == 6, "HID status response has wrong size */ class ExtraHID final : public IRDevice { public: - explicit ExtraHID(SendFunc send_func, Core::Timing& timing); + explicit ExtraHID(SendFunc send_func, Core::Timing& timing, Core::Movie& movie); ~ExtraHID(); void OnConnect() override; @@ -60,6 +61,7 @@ private: void LoadInputDevices(); Core::Timing& timing; + Core::Movie& movie; u8 hid_period; Core::TimingEventType* hid_polling_callback_id; std::array calibration_data; diff --git a/src/core/hle/service/ir/ir_rst.cpp b/src/core/hle/service/ir/ir_rst.cpp index ad219302a..28aba87c7 100644 --- a/src/core/hle/service/ir/ir_rst.cpp +++ b/src/core/hle/service/ir/ir_rst.cpp @@ -83,7 +83,7 @@ void IR_RST::UpdateCallback(std::uintptr_t user_data, s64 cycles_late) { s16 c_stick_x = static_cast(c_stick_x_f * MAX_CSTICK_RADIUS); s16 c_stick_y = static_cast(c_stick_y_f * MAX_CSTICK_RADIUS); - Core::Movie::GetInstance().HandleIrRst(state, c_stick_x, c_stick_y); + system.Movie().HandleIrRst(state, c_stick_x, c_stick_y); if (!raw_c_stick) { const HID::DirectionState direction = HID::GetStickDirectionState(c_stick_x, c_stick_y); diff --git a/src/core/hle/service/ir/ir_user.cpp b/src/core/hle/service/ir/ir_user.cpp index e66ca4784..856978a1d 100644 --- a/src/core/hle/service/ir/ir_user.cpp +++ b/src/core/hle/service/ir/ir_user.cpp @@ -9,7 +9,7 @@ #include #include #include -#include "common/string_util.h" +#include "common/archives.h" #include "common/swap.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" @@ -467,7 +467,7 @@ IR_USER::IR_USER(Core::System& system) : ServiceFramework("ir:USER", 1) { receive_event = system.Kernel().CreateEvent(ResetType::OneShot, "IR:ReceiveEvent"); extra_hid = std::make_unique([this](std::span data) { PutToReceive(data); }, - system.CoreTiming()); + system.CoreTiming(), system.Movie()); } IR_USER::~IR_USER() { diff --git a/src/core/hle/service/nfc/nfc_device.cpp b/src/core/hle/service/nfc/nfc_device.cpp index a48859ebd..ff0ba6244 100644 --- a/src/core/hle/service/nfc/nfc_device.cpp +++ b/src/core/hle/service/nfc/nfc_device.cpp @@ -7,13 +7,14 @@ #include #include +#include "common/file_util.h" #include "common/logging/log.h" -#include "common/string_util.h" #include "core/core.h" #include "core/hle/kernel/shared_page.h" #include "core/hle/service/nfc/amiibo_crypto.h" #include "core/hle/service/nfc/nfc_device.h" #include "core/hw/aes/key.h" +#include "core/loader/loader.h" SERVICE_CONSTRUCT_IMPL(Service::NFC::NfcDevice) diff --git a/src/core/hle/service/nim/nim_u.cpp b/src/core/hle/service/nim/nim_u.cpp index 153e86643..1462c0b02 100644 --- a/src/core/hle/service/nim/nim_u.cpp +++ b/src/core/hle/service/nim/nim_u.cpp @@ -6,6 +6,7 @@ #include "common/string_util.h" #include "core/core.h" #include "core/hle/ipc_helpers.h" +#include "core/hle/kernel/event.h" #include "core/hle/service/nim/nim_u.h" SERVICE_CONSTRUCT_IMPL(Service::NIM::NIM_U) diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index e1b8f62c5..91b56b12c 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp @@ -53,6 +53,7 @@ #include "core/hle/service/soc_u.h" #include "core/hle/service/ssl_c.h" #include "core/hle/service/y2r_u.h" +#include "core/loader/loader.h" namespace Service { diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h index 731db3808..f21c11fa6 100644 --- a/src/core/loader/loader.h +++ b/src/core/loader/loader.h @@ -14,7 +14,6 @@ #include "common/file_util.h" #include "core/file_sys/romfs_reader.h" #include "core/hle/kernel/kernel.h" -#include "core/hle/kernel/object.h" namespace Kernel { struct AddressMapping; diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 56776bfc8..bb6829d5b 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -27,6 +27,7 @@ #include "core/loader/smdh.h" #include "core/memory.h" #include "core/system_titles.h" +#include "core/telemetry_session.h" #include "network/network.h" namespace Loader { diff --git a/src/core/movie.cpp b/src/core/movie.cpp index 0453dbec7..376f8521d 100644 --- a/src/core/movie.cpp +++ b/src/core/movie.cpp @@ -10,13 +10,11 @@ #include #include #include -#include +#include "common/archives.h" #include "common/bit_field.h" -#include "common/common_types.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/scm_rev.h" -#include "common/string_util.h" #include "common/swap.h" #include "common/timer.h" #include "core/core.h" @@ -24,12 +22,11 @@ #include "core/hle/service/ir/extra_hid.h" #include "core/hle/service/ir/ir_rst.h" #include "core/hw/gpu.h" +#include "core/loader/loader.h" #include "core/movie.h" namespace Core { -/*static*/ Movie Movie::s_instance; - enum class ControllerStateType : u8 { PadAndCircle, Touch, @@ -146,6 +143,10 @@ static u64 GetInputCount(std::span input) { return input_count; } +Movie::Movie(const Core::System& system_) : system{system_} {} + +Movie::~Movie() = default; + template void Movie::serialize(Archive& ar, const unsigned int file_version) { // Only serialize what's needed to make savestates useful for TAS: @@ -565,7 +566,7 @@ void Movie::StartRecording(const std::string& movie_file, const std::string& aut // Get program ID program_id = 0; - Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id); + system.GetAppLoader().ReadProgramId(program_id); LOG_INFO(Movie, "Enabling Movie recording, ID: {:016X}", id); } diff --git a/src/core/movie.h b/src/core/movie.h index 70b999b03..3e4ff908f 100644 --- a/src/core/movie.h +++ b/src/core/movie.h @@ -23,25 +23,29 @@ union PadState; } // namespace Service namespace Core { + +class System; struct CTMHeader; struct ControllerState; class Movie { public: - enum class PlayMode { None, Recording, Playing, MovieFinished }; - enum class ValidationResult { + enum class PlayMode : u32 { + None, + Recording, + Playing, + MovieFinished, + }; + + enum class ValidationResult : u32 { OK, RevisionDismatch, InputCountDismatch, Invalid, }; - /** - * Gets the instance of the Movie singleton class. - * @returns Reference to the instance of the Movie singleton class. - */ - static Movie& GetInstance() { - return s_instance; - } + + explicit Movie(const Core::System& system); + ~Movie(); void SetPlaybackCompletionCallback(std::function completion_callback); void StartPlayback(const std::string& movie_file); @@ -133,8 +137,6 @@ public: void SaveMovie(); private: - static Movie s_instance; - void CheckInputEnd(); template @@ -159,6 +161,8 @@ private: ValidationResult ValidateHeader(const CTMHeader& header) const; ValidationResult ValidateInput(std::span input, u64 expected_count) const; +private: + const Core::System& system; PlayMode play_mode; std::string record_movie_file; diff --git a/src/core/savestate.cpp b/src/core/savestate.cpp index ccaa8d4f1..ecf8b9d4d 100644 --- a/src/core/savestate.cpp +++ b/src/core/savestate.cpp @@ -3,11 +3,14 @@ // Refer to the license.txt file included. #include +#include #include #include #include "common/archives.h" +#include "common/file_util.h" #include "common/logging/log.h" #include "common/scm_rev.h" +#include "common/swap.h" #include "common/zstd_compression.h" #include "core/core.h" #include "core/movie.h" @@ -30,8 +33,7 @@ static_assert(sizeof(CSTHeader) == 256, "CSTHeader should be 256 bytes"); constexpr std::array header_magic_bytes{{'C', 'S', 'T', 0x1B}}; -static std::string GetSaveStatePath(u64 program_id, u32 slot) { - const u64 movie_id = Movie::GetInstance().GetCurrentMovieID(); +static std::string GetSaveStatePath(u64 program_id, u64 movie_id, u32 slot) { if (movie_id) { return fmt::format("{}{:016X}.movie{:016X}.{:02d}.cst", FileUtil::GetUserPath(FileUtil::UserPath::StatesDir), program_id, @@ -43,8 +45,8 @@ static std::string GetSaveStatePath(u64 program_id, u32 slot) { } static bool ValidateSaveState(const CSTHeader& header, SaveStateInfo& info, u64 program_id, - u32 slot) { - const auto path = GetSaveStatePath(program_id, slot); + u64 movie_id, u32 slot) { + const auto path = GetSaveStatePath(program_id, movie_id, slot); if (header.filetype != header_magic_bytes) { LOG_WARNING(Core, "Invalid save state file {}", path); return false; @@ -66,11 +68,11 @@ static bool ValidateSaveState(const CSTHeader& header, SaveStateInfo& info, u64 return true; } -std::vector ListSaveStates(u64 program_id) { +std::vector ListSaveStates(u64 program_id, u64 movie_id) { std::vector result; result.reserve(SaveStateSlotCount); for (u32 slot = 1; slot <= SaveStateSlotCount; ++slot) { - const auto path = GetSaveStatePath(program_id, slot); + const auto path = GetSaveStatePath(program_id, movie_id, slot); if (!FileUtil::Exists(path)) { continue; } @@ -92,7 +94,7 @@ std::vector ListSaveStates(u64 program_id) { LOG_ERROR(Core, "Could not read from file {}", path); continue; } - if (!ValidateSaveState(header, info, program_id, slot)) { + if (!ValidateSaveState(header, info, program_id, movie_id, slot)) { continue; } @@ -111,7 +113,8 @@ void System::SaveState(u32 slot) const { const auto data = std::span{reinterpret_cast(str.data()), str.size()}; auto buffer = Common::Compression::CompressDataZSTDDefault(data); - const auto path = GetSaveStatePath(title_id, slot); + const u64 movie_id = movie.GetCurrentMovieID(); + const auto path = GetSaveStatePath(title_id, movie_id, slot); if (!FileUtil::CreateFullPath(path)) { throw std::runtime_error("Could not create path " + path); } @@ -143,7 +146,8 @@ void System::LoadState(u32 slot) { throw std::runtime_error("Unable to load while connected to multiplayer"); } - const auto path = GetSaveStatePath(title_id, slot); + const u64 movie_id = movie.GetCurrentMovieID(); + const auto path = GetSaveStatePath(title_id, movie_id, slot); std::vector decompressed; { @@ -159,7 +163,7 @@ void System::LoadState(u32 slot) { // validate header SaveStateInfo info; - if (!ValidateSaveState(header, info, title_id, slot)) { + if (!ValidateSaveState(header, info, title_id, movie_id, slot)) { throw std::runtime_error("Invalid savestate"); } diff --git a/src/core/savestate.h b/src/core/savestate.h index 2a1d1db52..84daf4778 100644 --- a/src/core/savestate.h +++ b/src/core/savestate.h @@ -20,6 +20,6 @@ struct SaveStateInfo { constexpr u32 SaveStateSlotCount = 10; // Maximum count of savestate slots -std::vector ListSaveStates(u64 program_id); +std::vector ListSaveStates(u64 program_id, u64 movie_id); } // namespace Core diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 88f493196..968e36eac 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -11,6 +11,7 @@ #include "common/scm_rev.h" #include "common/settings.h" #include "core/core.h" +#include "core/loader/loader.h" #include "core/telemetry_session.h" #include "network/network_settings.h" diff --git a/src/tests/audio_core/hle/hle.cpp b/src/tests/audio_core/hle/hle.cpp index ebc4cb361..df50de8af 100644 --- a/src/tests/audio_core/hle/hle.cpp +++ b/src/tests/audio_core/hle/hle.cpp @@ -7,6 +7,7 @@ #include "audio_core/hle/hle.h" #include "audio_core/lle/lle.h" #include "common/common_paths.h" +#include "common/file_util.h" #include "core/core_timing.h" #include "core/memory.h" diff --git a/src/tests/audio_core/lle/lle.cpp b/src/tests/audio_core/lle/lle.cpp index a9526b74a..c21d458ab 100644 --- a/src/tests/audio_core/lle/lle.cpp +++ b/src/tests/audio_core/lle/lle.cpp @@ -6,6 +6,7 @@ #include "audio_core/hle/decoder.h" #include "audio_core/lle/lle.h" #include "common/common_paths.h" +#include "common/file_util.h" #include "core/core_timing.h" #include "core/memory.h" diff --git a/src/video_core/custom_textures/custom_tex_manager.cpp b/src/video_core/custom_textures/custom_tex_manager.cpp index 8bb2adb42..3cbd7dae6 100644 --- a/src/video_core/custom_textures/custom_tex_manager.cpp +++ b/src/video_core/custom_textures/custom_tex_manager.cpp @@ -11,6 +11,8 @@ #include "common/texture.h" #include "core/core.h" #include "core/frontend/image_interface.h" +#include "core/hle/kernel/kernel.h" +#include "core/hle/kernel/process.h" #include "video_core/custom_textures/custom_tex_manager.h" #include "video_core/rasterizer_cache/surface_params.h" #include "video_core/rasterizer_cache/utils.h" diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 8099ab016..88b3c34bf 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp @@ -5,7 +5,6 @@ #include #include -#include "common/assert.h" #include "common/common_paths.h" #include "common/common_types.h" #include "common/file_util.h" @@ -14,7 +13,7 @@ #include "common/settings.h" #include "common/zstd_compression.h" #include "core/core.h" -#include "core/hle/kernel/process.h" +#include "core/loader/loader.h" #include "video_core/renderer_opengl/gl_shader_disk_cache.h" namespace OpenGL { diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 577fd3494..128137d52 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -7,6 +7,7 @@ #include "common/bit_set.h" #include "common/logging/log.h" #include "core/core.h" +#include "core/telemetry_session.h" #include "video_core/pica_state.h" #include "video_core/renderer_opengl/gl_shader_decompiler.h" #include "video_core/renderer_opengl/gl_shader_gen.h" diff --git a/src/video_core/renderer_opengl/pica_to_gl.h b/src/video_core/renderer_opengl/pica_to_gl.h index e4c14f186..ef7578c49 100644 --- a/src/video_core/renderer_opengl/pica_to_gl.h +++ b/src/video_core/renderer_opengl/pica_to_gl.h @@ -9,6 +9,7 @@ #include "common/assert.h" #include "common/logging/log.h" #include "core/core.h" +#include "core/telemetry_session.h" #include "video_core/regs_framebuffer.h" #include "video_core/regs_lighting.h" #include "video_core/regs_texturing.h" diff --git a/src/video_core/renderer_vulkan/vk_shader_gen.cpp b/src/video_core/renderer_vulkan/vk_shader_gen.cpp index 648aa5d88..555b17b5b 100644 --- a/src/video_core/renderer_vulkan/vk_shader_gen.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_gen.cpp @@ -7,6 +7,7 @@ #include "common/bit_set.h" #include "common/logging/log.h" #include "core/core.h" +#include "core/telemetry_session.h" #include "video_core/pica_state.h" #include "video_core/regs_framebuffer.h" #include "video_core/renderer_opengl/gl_shader_decompiler.h" diff --git a/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp b/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp index 4e4d50d22..0b9647e3f 100644 --- a/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_gen_spv.cpp @@ -3,6 +3,7 @@ // Refer to the license.txt file included. #include "core/core.h" +#include "core/telemetry_session.h" #include "video_core/renderer_vulkan/vk_shader_gen_spv.h" using Pica::FramebufferRegs;