From ceda2d280e8a3030c1e23083c5cea9158387fe4c Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 13 Feb 2023 11:21:43 -0500 Subject: [PATCH] general: rename CurrentProcess to ApplicationProcess --- src/audio_core/renderer/system.cpp | 2 +- src/audio_core/sink/sink_stream.cpp | 4 +- src/core/arm/arm_interface.cpp | 6 +-- src/core/core.cpp | 42 ++++++++--------- src/core/core.h | 18 ++++---- src/core/debugger/gdbstub.cpp | 28 +++++------ src/core/file_sys/savedata_factory.cpp | 2 +- src/core/hle/ipc_helpers.h | 2 +- src/core/hle/kernel/k_client_port.cpp | 2 +- src/core/hle/kernel/k_handle_table.h | 3 +- src/core/hle/kernel/k_session.cpp | 2 +- src/core/hle/kernel/kernel.cpp | 46 +++++++++---------- src/core/hle/kernel/kernel.h | 24 +++++----- src/core/hle/service/acc/acc.cpp | 4 +- src/core/hle/service/am/am.cpp | 22 +++++---- .../hle/service/am/applets/applet_error.cpp | 2 +- .../am/applets/applet_general_backend.cpp | 2 +- .../service/am/applets/applet_web_browser.cpp | 2 +- src/core/hle/service/aoc/aoc_u.cpp | 6 +-- src/core/hle/service/audio/audren_u.cpp | 2 +- src/core/hle/service/bcat/bcat_module.cpp | 10 ++-- src/core/hle/service/fatal/fatal.cpp | 2 +- .../hle/service/filesystem/filesystem.cpp | 4 +- src/core/hle/service/filesystem/fsp_srv.cpp | 5 +- src/core/hle/service/hid/hid.cpp | 8 ++-- src/core/hle/service/hid/hidbus.cpp | 4 +- src/core/hle/service/hid/irs.cpp | 8 ++-- src/core/hle/service/jit/jit.cpp | 4 +- src/core/hle/service/ldr/ldr.cpp | 13 +++--- src/core/hle/service/nfp/nfp_device.cpp | 2 +- .../hle/service/nvdrv/devices/nvhost_ctrl.cpp | 4 +- src/core/hle/service/nvdrv/devices/nvmap.cpp | 4 +- src/core/hle/service/pctl/pctl_module.cpp | 2 +- src/core/hle/service/prepo/prepo.cpp | 4 +- src/core/loader/nso.cpp | 2 +- src/core/memory.cpp | 10 ++-- src/core/memory/cheat_engine.cpp | 6 +-- src/core/reporter.cpp | 10 ++-- src/yuzu/bootmanager.cpp | 2 +- src/yuzu/main.cpp | 6 +-- src/yuzu_cmd/yuzu.cpp | 2 +- 41 files changed, 169 insertions(+), 164 deletions(-) diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index 4fac30c7c..31cbee282 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -127,7 +127,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params, render_device = params.rendering_device; execution_mode = params.execution_mode; - core.Memory().ZeroBlock(*core.Kernel().CurrentProcess(), transfer_memory->GetSourceAddress(), + core.Memory().ZeroBlock(*core.ApplicationProcess(), transfer_memory->GetSourceAddress(), transfer_memory_size); // Note: We're not actually using the transfer memory because it's a pain to code for. diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 06c2a876e..76889b375 100644 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -270,7 +270,7 @@ void SinkStream::Stall() { if (stalled_lock) { return; } - stalled_lock = system.StallProcesses(); + stalled_lock = system.StallApplication(); } void SinkStream::Unstall() { @@ -278,7 +278,7 @@ void SinkStream::Unstall() { if (!stalled_lock) { return; } - system.UnstallProcesses(); + system.UnstallApplication(); stalled_lock.unlock(); } diff --git a/src/core/arm/arm_interface.cpp b/src/core/arm/arm_interface.cpp index 8aa7b9641..4a331d4c1 100644 --- a/src/core/arm/arm_interface.cpp +++ b/src/core/arm/arm_interface.cpp @@ -43,9 +43,9 @@ void ARM_Interface::SymbolicateBacktrace(Core::System& system, std::vector symbols; for (const auto& module : modules) { - symbols.insert_or_assign(module.second, - Symbols::GetSymbols(module.first, system.Memory(), - system.CurrentProcess()->Is64BitProcess())); + symbols.insert_or_assign( + module.second, Symbols::GetSymbols(module.first, system.Memory(), + system.ApplicationProcess()->Is64BitProcess())); } for (auto& entry : out) { diff --git a/src/core/core.cpp b/src/core/core.cpp index 47292cd78..fb9b25d12 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -186,7 +186,7 @@ struct System::Impl { void Run() { std::unique_lock lk(suspend_guard); - kernel.Suspend(false); + kernel.SuspendApplication(false); core_timing.SyncPause(false); is_paused.store(false, std::memory_order_relaxed); } @@ -195,7 +195,7 @@ struct System::Impl { std::unique_lock lk(suspend_guard); core_timing.SyncPause(true); - kernel.Suspend(true); + kernel.SuspendApplication(true); is_paused.store(true, std::memory_order_relaxed); } @@ -203,17 +203,17 @@ struct System::Impl { return is_paused.load(std::memory_order_relaxed); } - std::unique_lock StallProcesses() { + std::unique_lock StallApplication() { std::unique_lock lk(suspend_guard); - kernel.Suspend(true); + kernel.SuspendApplication(true); core_timing.SyncPause(true); return lk; } - void UnstallProcesses() { + void UnstallApplication() { if (!IsPaused()) { core_timing.SyncPause(false); - kernel.Suspend(false); + kernel.SuspendApplication(false); } } @@ -221,7 +221,7 @@ struct System::Impl { debugger = std::make_unique(system, port); } - SystemResultStatus SetupForMainProcess(System& system, Frontend::EmuWindow& emu_window) { + SystemResultStatus SetupForApplicationProcess(System& system, Frontend::EmuWindow& emu_window) { LOG_DEBUG(Core, "initialized OK"); // Setting changes may require a full system reinitialization (e.g., disabling multicore). @@ -273,7 +273,7 @@ struct System::Impl { return SystemResultStatus::ErrorGetLoader; } - SystemResultStatus init_result{SetupForMainProcess(system, emu_window)}; + SystemResultStatus init_result{SetupForApplicationProcess(system, emu_window)}; if (init_result != SystemResultStatus::Success) { LOG_CRITICAL(Core, "Failed to initialize system (Error {})!", static_cast(init_result)); @@ -302,7 +302,7 @@ struct System::Impl { static_cast(SystemResultStatus::ErrorLoader) + static_cast(load_result)); } AddGlueRegistrationForProcess(*app_loader, *main_process); - kernel.MakeCurrentProcess(main_process); + kernel.MakeApplicationProcess(main_process); kernel.InitializeCores(); // Initialize cheat engine @@ -585,12 +585,12 @@ void System::DetachDebugger() { } } -std::unique_lock System::StallProcesses() { - return impl->StallProcesses(); +std::unique_lock System::StallApplication() { + return impl->StallApplication(); } -void System::UnstallProcesses() { - impl->UnstallProcesses(); +void System::UnstallApplication() { + impl->UnstallApplication(); } void System::InitializeDebugger() { @@ -648,8 +648,8 @@ const Kernel::GlobalSchedulerContext& System::GlobalSchedulerContext() const { return impl->kernel.GlobalSchedulerContext(); } -Kernel::KProcess* System::CurrentProcess() { - return impl->kernel.CurrentProcess(); +Kernel::KProcess* System::ApplicationProcess() { + return impl->kernel.ApplicationProcess(); } Core::DeviceMemory& System::DeviceMemory() { @@ -660,8 +660,8 @@ const Core::DeviceMemory& System::DeviceMemory() const { return *impl->device_memory; } -const Kernel::KProcess* System::CurrentProcess() const { - return impl->kernel.CurrentProcess(); +const Kernel::KProcess* System::ApplicationProcess() const { + return impl->kernel.ApplicationProcess(); } ARM_Interface& System::ArmInterface(std::size_t core_index) { @@ -760,8 +760,8 @@ const Core::SpeedLimiter& System::SpeedLimiter() const { return impl->speed_limiter; } -u64 System::GetCurrentProcessProgramID() const { - return impl->kernel.CurrentProcess()->GetProgramID(); +u64 System::GetApplicationProcessProgramID() const { + return impl->kernel.ApplicationProcess()->GetProgramID(); } Loader::ResultStatus System::GetGameName(std::string& out) const { @@ -880,11 +880,11 @@ bool System::GetExitLock() const { return impl->exit_lock; } -void System::SetCurrentProcessBuildID(const CurrentBuildProcessID& id) { +void System::SetApplicationProcessBuildID(const CurrentBuildProcessID& id) { impl->build_id = id; } -const System::CurrentBuildProcessID& System::GetCurrentProcessBuildID() const { +const System::CurrentBuildProcessID& System::GetApplicationProcessBuildID() const { return impl->build_id; } diff --git a/src/core/core.h b/src/core/core.h index fb5cda2f5..0042ac170 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -184,8 +184,8 @@ public: /// Forcibly detach the debugger if it is running. void DetachDebugger(); - std::unique_lock StallProcesses(); - void UnstallProcesses(); + std::unique_lock StallApplication(); + void UnstallApplication(); /** * Initialize the debugger. @@ -295,11 +295,11 @@ public: /// Gets the manager for the guest device memory [[nodiscard]] const Core::DeviceMemory& DeviceMemory() const; - /// Provides a pointer to the current process - [[nodiscard]] Kernel::KProcess* CurrentProcess(); + /// Provides a pointer to the application process + [[nodiscard]] Kernel::KProcess* ApplicationProcess(); - /// Provides a constant pointer to the current process. - [[nodiscard]] const Kernel::KProcess* CurrentProcess() const; + /// Provides a constant pointer to the application process. + [[nodiscard]] const Kernel::KProcess* ApplicationProcess() const; /// Provides a reference to the core timing instance. [[nodiscard]] Timing::CoreTiming& CoreTiming(); @@ -331,7 +331,7 @@ public: /// Provides a constant reference to the speed limiter [[nodiscard]] const Core::SpeedLimiter& SpeedLimiter() const; - [[nodiscard]] u64 GetCurrentProcessProgramID() const; + [[nodiscard]] u64 GetApplicationProcessProgramID() const; /// Gets the name of the current game [[nodiscard]] Loader::ResultStatus GetGameName(std::string& out) const; @@ -396,8 +396,8 @@ public: void SetExitLock(bool locked); [[nodiscard]] bool GetExitLock() const; - void SetCurrentProcessBuildID(const CurrentBuildProcessID& id); - [[nodiscard]] const CurrentBuildProcessID& GetCurrentProcessBuildID() const; + void SetApplicationProcessBuildID(const CurrentBuildProcessID& id); + [[nodiscard]] const CurrentBuildProcessID& GetApplicationProcessBuildID() const; /// Register a host thread as an emulated CPU Core. void RegisterCoreThread(std::size_t id); diff --git a/src/core/debugger/gdbstub.cpp b/src/core/debugger/gdbstub.cpp index 9c02b7b31..945ec528e 100644 --- a/src/core/debugger/gdbstub.cpp +++ b/src/core/debugger/gdbstub.cpp @@ -96,7 +96,7 @@ static std::string EscapeXML(std::string_view data) { GDBStub::GDBStub(DebuggerBackend& backend_, Core::System& system_) : DebuggerFrontend(backend_), system{system_} { - if (system.CurrentProcess()->Is64BitProcess()) { + if (system.ApplicationProcess()->Is64BitProcess()) { arch = std::make_unique(); } else { arch = std::make_unique(); @@ -340,15 +340,15 @@ void GDBStub::HandleBreakpointInsert(std::string_view command) { success = true; break; case BreakpointType::WriteWatch: - success = system.CurrentProcess()->InsertWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Write); + success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Write); break; case BreakpointType::ReadWatch: - success = system.CurrentProcess()->InsertWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Read); + success = system.ApplicationProcess()->InsertWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Read); break; case BreakpointType::AccessWatch: - success = system.CurrentProcess()->InsertWatchpoint( + success = system.ApplicationProcess()->InsertWatchpoint( system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); break; case BreakpointType::Hardware: @@ -391,15 +391,15 @@ void GDBStub::HandleBreakpointRemove(std::string_view command) { break; } case BreakpointType::WriteWatch: - success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Write); + success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Write); break; case BreakpointType::ReadWatch: - success = system.CurrentProcess()->RemoveWatchpoint(system, addr, size, - Kernel::DebugWatchpointType::Read); + success = system.ApplicationProcess()->RemoveWatchpoint(system, addr, size, + Kernel::DebugWatchpointType::Read); break; case BreakpointType::AccessWatch: - success = system.CurrentProcess()->RemoveWatchpoint( + success = system.ApplicationProcess()->RemoveWatchpoint( system, addr, size, Kernel::DebugWatchpointType::ReadOrWrite); break; case BreakpointType::Hardware: @@ -482,7 +482,7 @@ static std::optional GetNameFromThreadType64(Core::Memory::Memory& static std::optional GetThreadName(Core::System& system, const Kernel::KThread* thread) { - if (system.CurrentProcess()->Is64BitProcess()) { + if (system.ApplicationProcess()->Is64BitProcess()) { return GetNameFromThreadType64(system.Memory(), thread); } else { return GetNameFromThreadType32(system.Memory(), thread); @@ -555,7 +555,7 @@ void GDBStub::HandleQuery(std::string_view command) { SendReply(fmt::format("TextSeg={:x}", main->first)); } else { SendReply(fmt::format("TextSeg={:x}", - system.CurrentProcess()->PageTable().GetCodeRegionStart())); + system.ApplicationProcess()->PageTable().GetCodeRegionStart())); } } else if (command.starts_with("Xfer:libraries:read::")) { Loader::AppLoader::Modules modules; @@ -729,7 +729,7 @@ void GDBStub::HandleRcmd(const std::vector& command) { std::string_view command_str{reinterpret_cast(&command[0]), command.size()}; std::string reply; - auto* process = system.CurrentProcess(); + auto* process = system.ApplicationProcess(); auto& page_table = process->PageTable(); const char* commands = "Commands:\n" diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index 1567da231..769065b6f 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -172,7 +172,7 @@ std::string SaveDataFactory::GetFullPath(Core::System& system, VirtualDir dir, // be interpreted as the title id of the current process. if (type == SaveDataType::SaveData || type == SaveDataType::DeviceSaveData) { if (title_id == 0) { - title_id = system.GetCurrentProcessProgramID(); + title_id = system.GetApplicationProcessProgramID(); } } diff --git a/src/core/hle/ipc_helpers.h b/src/core/hle/ipc_helpers.h index a86bec252..38d6cfaff 100644 --- a/src/core/hle/ipc_helpers.h +++ b/src/core/hle/ipc_helpers.h @@ -148,7 +148,7 @@ public: if (context->GetManager()->IsDomain()) { context->AddDomainObject(std::move(iface)); } else { - kernel.CurrentProcess()->GetResourceLimit()->Reserve( + kernel.ApplicationProcess()->GetResourceLimit()->Reserve( Kernel::LimitableResource::SessionCountMax, 1); auto* session = Kernel::KSession::Create(kernel); diff --git a/src/core/hle/kernel/k_client_port.cpp b/src/core/hle/kernel/k_client_port.cpp index 9a540987b..c72a91a76 100644 --- a/src/core/hle/kernel/k_client_port.cpp +++ b/src/core/hle/kernel/k_client_port.cpp @@ -61,7 +61,7 @@ bool KClientPort::IsSignaled() const { Result KClientPort::CreateSession(KClientSession** out) { // Reserve a new session from the resource limit. //! FIXME: we are reserving this from the wrong resource limit! - KScopedResourceReservation session_reservation(kernel.CurrentProcess()->GetResourceLimit(), + KScopedResourceReservation session_reservation(kernel.ApplicationProcess()->GetResourceLimit(), LimitableResource::SessionCountMax); R_UNLESS(session_reservation.Succeeded(), ResultLimitReached); diff --git a/src/core/hle/kernel/k_handle_table.h b/src/core/hle/kernel/k_handle_table.h index 1bf68e6b0..d7660630c 100644 --- a/src/core/hle/kernel/k_handle_table.h +++ b/src/core/hle/kernel/k_handle_table.h @@ -90,7 +90,8 @@ public: // Handle pseudo-handles. if constexpr (std::derived_from) { if (handle == Svc::PseudoHandle::CurrentProcess) { - auto* const cur_process = GetCurrentProcessPointer(m_kernel); + //! FIXME: this is the wrong process! + auto* const cur_process = m_kernel.ApplicationProcess(); ASSERT(cur_process != nullptr); return cur_process; } diff --git a/src/core/hle/kernel/k_session.cpp b/src/core/hle/kernel/k_session.cpp index 819f39f12..7e677c028 100644 --- a/src/core/hle/kernel/k_session.cpp +++ b/src/core/hle/kernel/k_session.cpp @@ -34,7 +34,7 @@ void KSession::Initialize(KClientPort* port_, const std::string& name_) { // Set our owner process. //! FIXME: this is the wrong process! - process = kernel.CurrentProcess(); + process = kernel.ApplicationProcess(); process->Open(); // Set our port. diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 5b72eaaa1..b1922659d 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -102,13 +102,13 @@ struct KernelCore::Impl { void InitializeCores() { for (u32 core_id = 0; core_id < Core::Hardware::NUM_CPU_CORES; core_id++) { - cores[core_id]->Initialize((*current_process).Is64BitProcess()); - system.Memory().SetCurrentPageTable(*current_process, core_id); + cores[core_id]->Initialize((*application_process).Is64BitProcess()); + system.Memory().SetCurrentPageTable(*application_process, core_id); } } - void CloseCurrentProcess() { - KProcess* old_process = current_process.exchange(nullptr); + void CloseApplicationProcess() { + KProcess* old_process = application_process.exchange(nullptr); if (old_process == nullptr) { return; } @@ -182,7 +182,7 @@ struct KernelCore::Impl { } } - CloseCurrentProcess(); + CloseApplicationProcess(); // Track kernel objects that were not freed on shutdown { @@ -363,8 +363,8 @@ struct KernelCore::Impl { } } - void MakeCurrentProcess(KProcess* process) { - current_process = process; + void MakeApplicationProcess(KProcess* process) { + application_process = process; } static inline thread_local u32 host_thread_id = UINT32_MAX; @@ -821,7 +821,7 @@ struct KernelCore::Impl { // Lists all processes that exist in the current session. std::vector process_list; - std::atomic current_process{}; + std::atomic application_process{}; std::unique_ptr global_scheduler_context; std::unique_ptr hardware_timer; @@ -941,20 +941,20 @@ void KernelCore::AppendNewProcess(KProcess* process) { impl->process_list.push_back(process); } -void KernelCore::MakeCurrentProcess(KProcess* process) { - impl->MakeCurrentProcess(process); +void KernelCore::MakeApplicationProcess(KProcess* process) { + impl->MakeApplicationProcess(process); } -KProcess* KernelCore::CurrentProcess() { - return impl->current_process; +KProcess* KernelCore::ApplicationProcess() { + return impl->application_process; } -const KProcess* KernelCore::CurrentProcess() const { - return impl->current_process; +const KProcess* KernelCore::ApplicationProcess() const { + return impl->application_process; } -void KernelCore::CloseCurrentProcess() { - impl->CloseCurrentProcess(); +void KernelCore::CloseApplicationProcess() { + impl->CloseApplicationProcess(); } const std::vector& KernelCore::GetProcessList() const { @@ -1202,12 +1202,12 @@ const Kernel::KSharedMemory& KernelCore::GetHidBusSharedMem() const { return *impl->hidbus_shared_mem; } -void KernelCore::Suspend(bool suspended) { +void KernelCore::SuspendApplication(bool suspended) { const bool should_suspend{exception_exited || suspended}; const auto activity = should_suspend ? ProcessActivity::Paused : ProcessActivity::Runnable; - //! This refers to the application process, not the current process. - KScopedAutoObject process = CurrentProcess(); + // Get the application process. + KScopedAutoObject process = ApplicationProcess(); if (process.IsNull()) { return; } @@ -1218,8 +1218,8 @@ void KernelCore::Suspend(bool suspended) { // Wait for process execution to stop. bool must_wait{should_suspend}; - // KernelCore::Suspend must be called from locked context, or we - // could race another call to SetActivity, interfering with waiting. + // KernelCore::SuspendApplication must be called from locked context, + // or we could race another call to SetActivity, interfering with waiting. while (must_wait) { KScopedSchedulerLock sl{*this}; @@ -1253,9 +1253,9 @@ bool KernelCore::IsShuttingDown() const { return impl->IsShuttingDown(); } -void KernelCore::ExceptionalExit() { +void KernelCore::ExceptionalExitApplication() { exception_exited = true; - Suspend(true); + SuspendApplication(true); } void KernelCore::EnterSVCProfile() { diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index af0ae0e98..a236e6b42 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -131,17 +131,17 @@ public: /// Adds the given shared pointer to an internal list of active processes. void AppendNewProcess(KProcess* process); - /// Makes the given process the new current process. - void MakeCurrentProcess(KProcess* process); + /// Makes the given process the new application process. + void MakeApplicationProcess(KProcess* process); - /// Retrieves a pointer to the current process. - KProcess* CurrentProcess(); + /// Retrieves a pointer to the application process. + KProcess* ApplicationProcess(); - /// Retrieves a const pointer to the current process. - const KProcess* CurrentProcess() const; + /// Retrieves a const pointer to the application process. + const KProcess* ApplicationProcess() const; - /// Closes the current process. - void CloseCurrentProcess(); + /// Closes the application process. + void CloseApplicationProcess(); /// Retrieves the list of processes. const std::vector& GetProcessList() const; @@ -288,11 +288,11 @@ public: /// Gets the shared memory object for HIDBus services. const Kernel::KSharedMemory& GetHidBusSharedMem() const; - /// Suspend/unsuspend all processes. - void Suspend(bool suspend); + /// Suspend/unsuspend application process. + void SuspendApplication(bool suspend); - /// Exceptional exit all processes. - void ExceptionalExit(); + /// Exceptional exit application process. + void ExceptionalExitApplication(); /// Notify emulated CPU cores to shut down. void ShutdownCores(); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6d1084fd1..1495d64de 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -762,7 +762,7 @@ Result Module::Interface::InitializeApplicationInfoBase() { // processes emulated. As we don't actually have pid support we should assume we're just using // our own process const auto launch_property = - system.GetARPManager().GetLaunchProperty(system.GetCurrentProcessProgramID()); + system.GetARPManager().GetLaunchProperty(system.GetApplicationProcessProgramID()); if (launch_property.Failed()) { LOG_ERROR(Service_ACC, "Failed to get launch property"); @@ -806,7 +806,7 @@ void Module::Interface::IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx bool is_locked = false; if (res != Loader::ResultStatus::Success) { - const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(), + const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(), system.GetFileSystemController(), system.GetContentProvider()}; const auto nacp_unique = pm.GetControlMetadata().first; diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index ebcf6e164..615dd65f3 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -79,7 +79,7 @@ IWindowController::IWindowController(Core::System& system_) IWindowController::~IWindowController() = default; void IWindowController::GetAppletResourceUserId(Kernel::HLERequestContext& ctx) { - const u64 process_id = system.CurrentProcess()->GetProcessID(); + const u64 process_id = system.ApplicationProcess()->GetProcessID(); LOG_DEBUG(Service_AM, "called. Process ID=0x{:016X}", process_id); @@ -1252,7 +1252,7 @@ void ILibraryAppletCreator::CreateTransferMemoryStorage(Kernel::HLERequestContex } auto transfer_mem = - system.CurrentProcess()->GetHandleTable().GetObject(handle); + system.ApplicationProcess()->GetHandleTable().GetObject(handle); if (transfer_mem.IsNull()) { LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); @@ -1286,7 +1286,7 @@ void ILibraryAppletCreator::CreateHandleStorage(Kernel::HLERequestContext& ctx) } auto transfer_mem = - system.CurrentProcess()->GetHandleTable().GetObject(handle); + system.ApplicationProcess()->GetHandleTable().GetObject(handle); if (transfer_mem.IsNull()) { LOG_ERROR(Service_AM, "transfer_mem is a nullptr for handle={:08X}", handle); @@ -1465,11 +1465,12 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) { const auto backend = BCAT::CreateBackendFromSettings(system, [this](u64 tid) { return system.GetFileSystemController().GetBCATDirectory(tid); }); - const auto build_id_full = system.GetCurrentProcessBuildID(); + const auto build_id_full = system.GetApplicationProcessBuildID(); u64 build_id{}; std::memcpy(&build_id, build_id_full.data(), sizeof(u64)); - auto data = backend->GetLaunchParameter({system.GetCurrentProcessProgramID(), build_id}); + auto data = + backend->GetLaunchParameter({system.GetApplicationProcessProgramID(), build_id}); if (data.has_value()) { IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); @@ -1521,7 +1522,7 @@ void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called, uid={:016X}{:016X}", user_id[1], user_id[0]); FileSys::SaveDataAttribute attribute{}; - attribute.title_id = system.GetCurrentProcessProgramID(); + attribute.title_id = system.GetApplicationProcessProgramID(); attribute.user_id = user_id; attribute.type = FileSys::SaveDataType::SaveData; const auto res = system.GetFileSystemController().CreateSaveData( @@ -1551,7 +1552,7 @@ void IApplicationFunctions::GetDisplayVersion(Kernel::HLERequestContext& ctx) { std::array version_string{}; const auto res = [this] { - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; @@ -1588,7 +1589,7 @@ void IApplicationFunctions::GetDesiredLanguage(Kernel::HLERequestContext& ctx) { u32 supported_languages = 0; const auto res = [this] { - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; @@ -1696,7 +1697,8 @@ void IApplicationFunctions::ExtendSaveData(Kernel::HLERequestContext& ctx) { static_cast(type), user_id[1], user_id[0], new_normal_size, new_journal_size); system.GetFileSystemController().WriteSaveDataSize( - type, system.GetCurrentProcessProgramID(), user_id, {new_normal_size, new_journal_size}); + type, system.GetApplicationProcessProgramID(), user_id, + {new_normal_size, new_journal_size}); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); @@ -1720,7 +1722,7 @@ void IApplicationFunctions::GetSaveDataSize(Kernel::HLERequestContext& ctx) { user_id[0]); const auto size = system.GetFileSystemController().ReadSaveDataSize( - type, system.GetCurrentProcessProgramID(), user_id); + type, system.GetApplicationProcessProgramID(), user_id); IPC::ResponseBuilder rb{ctx, 6}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/am/applets/applet_error.cpp b/src/core/hle/service/am/applets/applet_error.cpp index bae0d99a6..b013896b4 100644 --- a/src/core/hle/service/am/applets/applet_error.cpp +++ b/src/core/hle/service/am/applets/applet_error.cpp @@ -166,7 +166,7 @@ void Error::Execute() { } const auto callback = [this] { DisplayCompleted(); }; - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const auto& reporter{system.GetReporter()}; switch (mode) { diff --git a/src/core/hle/service/am/applets/applet_general_backend.cpp b/src/core/hle/service/am/applets/applet_general_backend.cpp index e50acdaf6..1eefa85e3 100644 --- a/src/core/hle/service/am/applets/applet_general_backend.cpp +++ b/src/core/hle/service/am/applets/applet_general_backend.cpp @@ -186,7 +186,7 @@ void PhotoViewer::Execute() { const auto callback = [this] { ViewFinished(); }; switch (mode) { case PhotoViewerAppletMode::CurrentApp: - frontend.ShowPhotosForApplication(system.GetCurrentProcessProgramID(), callback); + frontend.ShowPhotosForApplication(system.GetApplicationProcessProgramID(), callback); break; case PhotoViewerAppletMode::AllApps: frontend.ShowAllPhotos(callback); diff --git a/src/core/hle/service/am/applets/applet_web_browser.cpp b/src/core/hle/service/am/applets/applet_web_browser.cpp index 14aa6f69e..f061bae80 100644 --- a/src/core/hle/service/am/applets/applet_web_browser.cpp +++ b/src/core/hle/service/am/applets/applet_web_browser.cpp @@ -393,7 +393,7 @@ void WebBrowser::InitializeOffline() { switch (document_kind) { case DocumentKind::OfflineHtmlPage: default: - title_id = system.GetCurrentProcessProgramID(); + title_id = system.GetApplicationProcessProgramID(); nca_type = FileSys::ContentRecordType::HtmlDocument; additional_paths = "html-document"; break; diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 368ccd52f..7264f23f9 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -155,7 +155,7 @@ void AOC_U::CountAddOnContent(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - const auto current = system.GetCurrentProcessProgramID(); + const auto current = system.GetApplicationProcessProgramID(); const auto& disabled = Settings::values.disabled_addons[current]; if (std::find(disabled.begin(), disabled.end(), "DLC") != disabled.end()) { @@ -182,7 +182,7 @@ void AOC_U::ListAddOnContent(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_AOC, "called with offset={}, count={}, process_id={}", offset, count, process_id); - const auto current = system.GetCurrentProcessProgramID(); + const auto current = system.GetApplicationProcessProgramID(); std::vector out; const auto& disabled = Settings::values.disabled_addons[current]; @@ -228,7 +228,7 @@ void AOC_U::GetAddOnContentBaseId(Kernel::HLERequestContext& ctx) { IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index 0ee28752c..7d730421d 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -455,7 +455,7 @@ void AudRenU::OpenAudioRenderer(Kernel::HLERequestContext& ctx) { return; } - const auto& handle_table{system.CurrentProcess()->GetHandleTable()}; + const auto& handle_table{system.ApplicationProcess()->GetHandleTable()}; auto process{handle_table.GetObject(process_handle)}; auto transfer_memory{ process->GetHandleTable().GetObject(transfer_memory_handle)}; diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp index cbe690a5d..6e6fed227 100644 --- a/src/core/hle/service/bcat/bcat_module.cpp +++ b/src/core/hle/service/bcat/bcat_module.cpp @@ -176,8 +176,8 @@ private: void RequestSyncDeliveryCache(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_BCAT, "called"); - backend.Synchronize({system.GetCurrentProcessProgramID(), - GetCurrentBuildID(system.GetCurrentProcessBuildID())}, + backend.Synchronize({system.GetApplicationProcessProgramID(), + GetCurrentBuildID(system.GetApplicationProcessBuildID())}, GetProgressBackend(SyncType::Normal)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -193,8 +193,8 @@ private: LOG_DEBUG(Service_BCAT, "called, name={}", name); - backend.SynchronizeDirectory({system.GetCurrentProcessProgramID(), - GetCurrentBuildID(system.GetCurrentProcessBuildID())}, + backend.SynchronizeDirectory({system.GetApplicationProcessProgramID(), + GetCurrentBuildID(system.GetApplicationProcessBuildID())}, name, GetProgressBackend(SyncType::Directory)); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; @@ -554,7 +554,7 @@ private: void Module::Interface::CreateDeliveryCacheStorageService(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_BCAT, "called"); - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); rb.PushIpcInterface(system, fsc.GetBCATDirectory(title_id)); diff --git a/src/core/hle/service/fatal/fatal.cpp b/src/core/hle/service/fatal/fatal.cpp index 27675615b..2e5919330 100644 --- a/src/core/hle/service/fatal/fatal.cpp +++ b/src/core/hle/service/fatal/fatal.cpp @@ -63,7 +63,7 @@ enum class FatalType : u32 { }; static void GenerateErrorReport(Core::System& system, Result error_code, const FatalInfo& info) { - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); std::string crash_report = fmt::format( "Yuzu {}-{} crash report\n" "Title ID: {:016x}\n" diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp index 11c604a0f..177447bc1 100644 --- a/src/core/hle/service/filesystem/filesystem.cpp +++ b/src/core/hle/service/filesystem/filesystem.cpp @@ -317,7 +317,7 @@ ResultVal FileSystemController::OpenRomFSCurrentProcess() return ResultUnknown; } - return romfs_factory->OpenCurrentProcess(system.GetCurrentProcessProgramID()); + return romfs_factory->OpenCurrentProcess(system.GetApplicationProcessProgramID()); } ResultVal FileSystemController::OpenPatchedRomFS( @@ -502,7 +502,7 @@ FileSys::SaveDataSize FileSystemController::ReadSaveDataSize(FileSys::SaveDataTy const auto res = system.GetAppLoader().ReadControlData(nacp); if (res != Loader::ResultStatus::Success) { - const FileSys::PatchManager pm{system.GetCurrentProcessProgramID(), + const FileSys::PatchManager pm{system.GetApplicationProcessProgramID(), system.GetFileSystemController(), system.GetContentProvider()}; const auto metadata = pm.GetControlMetadata(); diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp index 447d624e1..e76346ca9 100644 --- a/src/core/hle/service/filesystem/fsp_srv.cpp +++ b/src/core/hle/service/filesystem/fsp_srv.cpp @@ -1036,8 +1036,9 @@ void FSP_SRV::OpenDataStorageWithProgramIndex(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_FS, "called, program_index={}", program_index); - auto patched_romfs = fsc.OpenPatchedRomFSWithProgramIndex( - system.GetCurrentProcessProgramID(), program_index, FileSys::ContentRecordType::Program); + auto patched_romfs = + fsc.OpenPatchedRomFSWithProgramIndex(system.GetApplicationProcessProgramID(), program_index, + FileSys::ContentRecordType::Program); if (patched_romfs.Failed()) { // TODO: Find the right error code to use here diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 5a1aa0903..b0d06ee55 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -1830,7 +1830,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { ASSERT_MSG(t_mem_1_size == 0x1000, "t_mem_1_size is not 0x1000 bytes"); ASSERT_MSG(t_mem_2_size == 0x7F000, "t_mem_2_size is not 0x7F000 bytes"); - auto t_mem_1 = system.CurrentProcess()->GetHandleTable().GetObject( + auto t_mem_1 = system.ApplicationProcess()->GetHandleTable().GetObject( t_mem_1_handle); if (t_mem_1.IsNull()) { @@ -1840,7 +1840,7 @@ void Hid::InitializeSevenSixAxisSensor(Kernel::HLERequestContext& ctx) { return; } - auto t_mem_2 = system.CurrentProcess()->GetHandleTable().GetObject( + auto t_mem_2 = system.ApplicationProcess()->GetHandleTable().GetObject( t_mem_2_handle); if (t_mem_2.IsNull()) { @@ -2127,8 +2127,8 @@ void Hid::WritePalmaWaveEntry(Kernel::HLERequestContext& ctx) { ASSERT_MSG(t_mem_size == 0x3000, "t_mem_size is not 0x3000 bytes"); - auto t_mem = - system.CurrentProcess()->GetHandleTable().GetObject(t_mem_handle); + auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject( + t_mem_handle); if (t_mem.IsNull()) { LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); diff --git a/src/core/hle/service/hid/hidbus.cpp b/src/core/hle/service/hid/hidbus.cpp index 17252a84a..bd94e8f3d 100644 --- a/src/core/hle/service/hid/hidbus.cpp +++ b/src/core/hle/service/hid/hidbus.cpp @@ -449,8 +449,8 @@ void HidBus::EnableJoyPollingReceiveMode(Kernel::HLERequestContext& ctx) { ASSERT_MSG(t_mem_size == 0x1000, "t_mem_size is not 0x1000 bytes"); - auto t_mem = - system.CurrentProcess()->GetHandleTable().GetObject(t_mem_handle); + auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject( + t_mem_handle); if (t_mem.IsNull()) { LOG_ERROR(Service_HID, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); diff --git a/src/core/hle/service/hid/irs.cpp b/src/core/hle/service/hid/irs.cpp index 52f402c56..3bd418e92 100644 --- a/src/core/hle/service/hid/irs.cpp +++ b/src/core/hle/service/hid/irs.cpp @@ -196,8 +196,8 @@ void IRS::RunImageTransferProcessor(Kernel::HLERequestContext& ctx) { const auto parameters{rp.PopRaw()}; const auto t_mem_handle{ctx.GetCopyHandle(0)}; - auto t_mem = - system.CurrentProcess()->GetHandleTable().GetObject(t_mem_handle); + auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject( + t_mem_handle); if (t_mem.IsNull()) { LOG_ERROR(Service_IRS, "t_mem is a nullptr for handle=0x{:08X}", t_mem_handle); @@ -445,8 +445,8 @@ void IRS::RunImageTransferExProcessor(Kernel::HLERequestContext& ctx) { const auto parameters{rp.PopRaw()}; const auto t_mem_handle{ctx.GetCopyHandle(0)}; - auto t_mem = - system.CurrentProcess()->GetHandleTable().GetObject(t_mem_handle); + auto t_mem = system.ApplicationProcess()->GetHandleTable().GetObject( + t_mem_handle); u8* transfer_memory = system.Memory().GetPointer(t_mem->GetSourceAddress()); diff --git a/src/core/hle/service/jit/jit.cpp b/src/core/hle/service/jit/jit.cpp index 1295a44c7..47a1277ea 100644 --- a/src/core/hle/service/jit/jit.cpp +++ b/src/core/hle/service/jit/jit.cpp @@ -353,9 +353,9 @@ public: return; } - // Fetch using the handle table for the current process here, + // Fetch using the handle table for the application process here, // since we are not multiprocess yet. - const auto& handle_table{system.CurrentProcess()->GetHandleTable()}; + const auto& handle_table{system.ApplicationProcess()->GetHandleTable()}; auto process{handle_table.GetObject(process_handle)}; if (process.IsNull()) { diff --git a/src/core/hle/service/ldr/ldr.cpp b/src/core/hle/service/ldr/ldr.cpp index 652441bc2..2d4d6fe3e 100644 --- a/src/core/hle/service/ldr/ldr.cpp +++ b/src/core/hle/service/ldr/ldr.cpp @@ -246,7 +246,7 @@ public: return; } - if (system.GetCurrentProcessProgramID() != header.application_id) { + if (system.GetApplicationProcessProgramID() != header.application_id) { LOG_ERROR(Service_LDR, "Attempting to load NRR with title ID other than current process. (actual " "{:016X})!", @@ -542,15 +542,16 @@ public: } // Map memory for the NRO - const auto map_result{MapNro(system.CurrentProcess(), nro_address, nro_size, bss_address, - bss_size, nro_size + bss_size)}; + const auto map_result{MapNro(system.ApplicationProcess(), nro_address, nro_size, + bss_address, bss_size, nro_size + bss_size)}; if (map_result.Failed()) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(map_result.Code()); } // Load the NRO into the mapped memory - if (const auto result{LoadNro(system.CurrentProcess(), header, nro_address, *map_result)}; + if (const auto result{ + LoadNro(system.ApplicationProcess(), header, nro_address, *map_result)}; result.IsError()) { IPC::ResponseBuilder rb{ctx, 2}; rb.Push(map_result.Code()); @@ -570,7 +571,7 @@ public: Result UnmapNro(const NROInfo& info) { // Each region must be unmapped separately to validate memory state - auto& page_table{system.CurrentProcess()->PageTable()}; + auto& page_table{system.ApplicationProcess()->PageTable()}; if (info.bss_size != 0) { CASCADE_CODE(page_table.UnmapCodeMemory( @@ -641,7 +642,7 @@ public: LOG_WARNING(Service_LDR, "(STUBBED) called"); initialized = true; - current_map_addr = system.CurrentProcess()->PageTable().GetAliasCodeRegionStart(); + current_map_addr = system.ApplicationProcess()->PageTable().GetAliasCodeRegionStart(); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/nfp/nfp_device.cpp b/src/core/hle/service/nfp/nfp_device.cpp index e67a76f55..7a6bbbba7 100644 --- a/src/core/hle/service/nfp/nfp_device.cpp +++ b/src/core/hle/service/nfp/nfp_device.cpp @@ -618,7 +618,7 @@ Result NfpDevice::RecreateApplicationArea(u32 access_id, std::span dat sizeof(ApplicationArea) - data.size()); // TODO: Investigate why the title id needs to be moddified - tag_data.title_id = system.GetCurrentProcessProgramID(); + tag_data.title_id = system.GetApplicationProcessProgramID(); tag_data.title_id = tag_data.title_id | 0x30000000ULL; tag_data.settings.settings.appdata_initialized.Assign(1); tag_data.application_area_id = access_id; diff --git a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp index 0cdde82a7..e12025560 100644 --- a/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp +++ b/src/core/hle/service/nvdrv/devices/nvhost_ctrl.cpp @@ -150,9 +150,9 @@ NvResult nvhost_ctrl::IocCtrlEventWait(std::span input, std::vector 2) { { - auto lk = system.StallProcesses(); + auto lk = system.StallApplication(); host1x_syncpoint_manager.WaitHost(fence_id, target_value); - system.UnstallProcesses(); + system.UnstallApplication(); } params.value.raw = target_value; return true; diff --git a/src/core/hle/service/nvdrv/devices/nvmap.cpp b/src/core/hle/service/nvdrv/devices/nvmap.cpp index 29c1e0f01..277afe0b4 100644 --- a/src/core/hle/service/nvdrv/devices/nvmap.cpp +++ b/src/core/hle/service/nvdrv/devices/nvmap.cpp @@ -127,7 +127,7 @@ NvResult nvmap::IocAlloc(std::span input, std::vector& output) { return result; } bool is_out_io{}; - ASSERT(system.CurrentProcess() + ASSERT(system.ApplicationProcess() ->PageTable() .LockForMapDeviceAddressSpace(&is_out_io, handle_description->address, handle_description->size, @@ -254,7 +254,7 @@ NvResult nvmap::IocFree(std::span input, std::vector& output) { if (auto freeInfo{file.FreeHandle(params.handle, false)}) { if (freeInfo->can_unlock) { - ASSERT(system.CurrentProcess() + ASSERT(system.ApplicationProcess() ->PageTable() .UnlockForDeviceAddressSpace(freeInfo->address, freeInfo->size) .IsSuccess()); diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp index 2a123b42d..083609b34 100644 --- a/src/core/hle/service/pctl/pctl_module.cpp +++ b/src/core/hle/service/pctl/pctl_module.cpp @@ -187,7 +187,7 @@ private: // TODO(ogniK): Recovery flag initialization for pctl:r - const auto tid = system.GetCurrentProcessProgramID(); + const auto tid = system.GetApplicationProcessProgramID(); if (tid != 0) { const FileSys::PatchManager pm{tid, system.GetFileSystemController(), system.GetContentProvider()}; diff --git a/src/core/hle/service/prepo/prepo.cpp b/src/core/hle/service/prepo/prepo.cpp index 01040b32a..90c5f8756 100644 --- a/src/core/hle/service/prepo/prepo.cpp +++ b/src/core/hle/service/prepo/prepo.cpp @@ -71,7 +71,7 @@ private: Type, process_id, data1.size(), data2.size()); const auto& reporter{system.GetReporter()}; - reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2}, + reporter.SavePlayReport(Type, system.GetApplicationProcessProgramID(), {data1, data2}, process_id); IPC::ResponseBuilder rb{ctx, 2}; @@ -99,7 +99,7 @@ private: Type, user_id[1], user_id[0], process_id, data1.size(), data2.size()); const auto& reporter{system.GetReporter()}; - reporter.SavePlayReport(Type, system.GetCurrentProcessProgramID(), {data1, data2}, + reporter.SavePlayReport(Type, system.GetApplicationProcessProgramID(), {data1, data2}, process_id, user_id); IPC::ResponseBuilder rb{ctx, 2}; diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 4c3b3c655..a5c384fb5 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -145,7 +145,7 @@ std::optional AppLoader_NSO::LoadModule(Kernel::KProcess& process, Core:: // Apply cheats if they exist and the program has a valid title ID if (pm) { - system.SetCurrentProcessBuildID(nso_header.build_id); + system.SetApplicationProcessBuildID(nso_header.build_id); const auto cheats = pm->CreateCheatList(nso_header.build_id); if (!cheats.empty()) { system.RegisterCheatList(cheats, nso_header.build_id, load_base, image_size); diff --git a/src/core/memory.cpp b/src/core/memory.cpp index af9660b55..4397fcfb1 100644 --- a/src/core/memory.cpp +++ b/src/core/memory.cpp @@ -247,11 +247,11 @@ struct Memory::Impl { } void ReadBlock(const VAddr src_addr, void* dest_buffer, const std::size_t size) { - ReadBlockImpl(*system.CurrentProcess(), src_addr, dest_buffer, size); + ReadBlockImpl(*system.ApplicationProcess(), src_addr, dest_buffer, size); } void ReadBlockUnsafe(const VAddr src_addr, void* dest_buffer, const std::size_t size) { - ReadBlockImpl(*system.CurrentProcess(), src_addr, dest_buffer, size); + ReadBlockImpl(*system.ApplicationProcess(), src_addr, dest_buffer, size); } template @@ -279,11 +279,11 @@ struct Memory::Impl { } void WriteBlock(const VAddr dest_addr, const void* src_buffer, const std::size_t size) { - WriteBlockImpl(*system.CurrentProcess(), dest_addr, src_buffer, size); + WriteBlockImpl(*system.ApplicationProcess(), dest_addr, src_buffer, size); } void WriteBlockUnsafe(const VAddr dest_addr, const void* src_buffer, const std::size_t size) { - WriteBlockImpl(*system.CurrentProcess(), dest_addr, src_buffer, size); + WriteBlockImpl(*system.ApplicationProcess(), dest_addr, src_buffer, size); } void ZeroBlock(const Kernel::KProcess& process, const VAddr dest_addr, const std::size_t size) { @@ -711,7 +711,7 @@ void Memory::UnmapRegion(Common::PageTable& page_table, VAddr base, u64 size) { } bool Memory::IsValidVirtualAddress(const VAddr vaddr) const { - const Kernel::KProcess& process = *system.CurrentProcess(); + const Kernel::KProcess& process = *system.ApplicationProcess(); const auto& page_table = process.PageTable().PageTableImpl(); const size_t page = vaddr >> YUZU_PAGEBITS; if (page >= page_table.pointers.size()) { diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index ffdbacc18..44ee39648 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp @@ -191,10 +191,10 @@ void CheatEngine::Initialize() { }); core_timing.ScheduleLoopingEvent(CHEAT_ENGINE_NS, CHEAT_ENGINE_NS, event); - metadata.process_id = system.CurrentProcess()->GetProcessID(); - metadata.title_id = system.GetCurrentProcessProgramID(); + metadata.process_id = system.ApplicationProcess()->GetProcessID(); + metadata.title_id = system.GetApplicationProcessProgramID(); - const auto& page_table = system.CurrentProcess()->PageTable(); + const auto& page_table = system.ApplicationProcess()->PageTable(); metadata.heap_extents = { .base = page_table.GetHeapRegionStart(), .size = page_table.GetHeapRegionSize(), diff --git a/src/core/reporter.cpp b/src/core/reporter.cpp index 59dfb8767..708ae17aa 100644 --- a/src/core/reporter.cpp +++ b/src/core/reporter.cpp @@ -110,7 +110,7 @@ json GetProcessorStateData(const std::string& architecture, u64 entry_point, u64 } json GetProcessorStateDataAuto(Core::System& system) { - const auto* process{system.CurrentProcess()}; + const auto* process{system.ApplicationProcess()}; auto& arm{system.CurrentArmInterface()}; Core::ARM_Interface::ThreadContext64 context{}; @@ -234,7 +234,7 @@ void Reporter::SaveSvcBreakReport(u32 type, bool signal_debugger, u64 info1, u64 } const auto timestamp = GetTimestamp(); - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); auto out = GetFullDataAuto(timestamp, title_id, system); auto break_out = json{ @@ -261,7 +261,7 @@ void Reporter::SaveUnimplementedFunctionReport(Kernel::HLERequestContext& ctx, u } const auto timestamp = GetTimestamp(); - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); auto out = GetFullDataAuto(timestamp, title_id, system); auto function_out = GetHLERequestContextData(ctx, system.Memory()); @@ -283,7 +283,7 @@ void Reporter::SaveUnimplementedAppletReport( } const auto timestamp = GetTimestamp(); - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); auto out = GetFullDataAuto(timestamp, title_id, system); out["applet_common_args"] = { @@ -376,7 +376,7 @@ void Reporter::SaveUserReport() const { } const auto timestamp = GetTimestamp(); - const auto title_id = system.GetCurrentProcessProgramID(); + const auto title_id = system.GetApplicationProcessProgramID(); SaveToFile(GetFullDataAuto(timestamp, title_id, system), GetPath("user_report", title_id, timestamp)); diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index d65991734..352300e88 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp @@ -67,7 +67,7 @@ void EmuThread::run() { emit LoadProgress(VideoCore::LoadCallbackStage::Prepare, 0, 0); if (Settings::values.use_disk_shader_cache.GetValue()) { m_system.Renderer().ReadRasterizer()->LoadDiskResources( - m_system.GetCurrentProcessProgramID(), stop_token, + m_system.GetApplicationProcessProgramID(), stop_token, [this](VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total) { emit LoadProgress(stage, value, total); }); diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c278d8dab..94ae441e5 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1779,7 +1779,7 @@ void GMainWindow::BootGame(const QString& filename, u64 program_id, std::size_t std::filesystem::path{Common::U16StringFromBuffer(filename.utf16(), filename.size())} .filename()); } - const bool is_64bit = system->Kernel().CurrentProcess()->Is64BitProcess(); + const bool is_64bit = system->Kernel().ApplicationProcess()->Is64BitProcess(); const auto instruction_set_suffix = is_64bit ? tr("(64-bit)") : tr("(32-bit)"); title_name = tr("%1 %2", "%1 is the title name. %2 indicates if the title is 64-bit or 32-bit") .arg(QString::fromStdString(title_name), instruction_set_suffix) @@ -3532,7 +3532,7 @@ void GMainWindow::OnToggleGraphicsAPI() { } void GMainWindow::OnConfigurePerGame() { - const u64 title_id = system->GetCurrentProcessProgramID(); + const u64 title_id = system->GetApplicationProcessProgramID(); OpenPerGameConfiguration(title_id, current_game_path.toStdString()); } @@ -3691,7 +3691,7 @@ void GMainWindow::OnCaptureScreenshot() { return; } - const u64 title_id = system->GetCurrentProcessProgramID(); + const u64 title_id = system->GetApplicationProcessProgramID(); const auto screenshot_path = QString::fromStdString(Common::FS::GetYuzuPathString(Common::FS::YuzuPath::ScreenshotsDir)); const auto date = diff --git a/src/yuzu_cmd/yuzu.cpp b/src/yuzu_cmd/yuzu.cpp index d1f7b1d49..77edd58ca 100644 --- a/src/yuzu_cmd/yuzu.cpp +++ b/src/yuzu_cmd/yuzu.cpp @@ -405,7 +405,7 @@ int main(int argc, char** argv) { if (Settings::values.use_disk_shader_cache.GetValue()) { system.Renderer().ReadRasterizer()->LoadDiskResources( - system.GetCurrentProcessProgramID(), std::stop_token{}, + system.GetApplicationProcessProgramID(), std::stop_token{}, [](VideoCore::LoadCallbackStage, size_t value, size_t total) {}); }