summaryrefslogtreecommitdiffstats
path: root/src/core/core.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/core.cpp')
-rw-r--r--src/core/core.cpp28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 3c75f42ae..07448fd29 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -19,20 +19,16 @@
#include "core/cpu_manager.h"
#include "core/device_memory.h"
#include "core/file_sys/bis_factory.h"
-#include "core/file_sys/card_image.h"
#include "core/file_sys/mode.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h"
#include "core/file_sys/romfs_factory.h"
#include "core/file_sys/savedata_factory.h"
-#include "core/file_sys/sdmc_factory.h"
#include "core/file_sys/vfs_concat.h"
#include "core/file_sys/vfs_real.h"
#include "core/hardware_interrupt_manager.h"
-#include "core/hle/kernel/k_client_port.h"
#include "core/hle/kernel/k_process.h"
#include "core/hle/kernel/k_scheduler.h"
-#include "core/hle/kernel/k_thread.h"
#include "core/hle/kernel/kernel.h"
#include "core/hle/kernel/physical_core.h"
#include "core/hle/service/am/applets/applets.h"
@@ -83,12 +79,6 @@ FileSys::StorageId GetStorageIdForFrontendSlot(
}
}
-void KProcessDeleter(Kernel::KProcess* process) {
- process->Destroy();
-}
-
-using KProcessPtr = std::unique_ptr<Kernel::KProcess, decltype(&KProcessDeleter)>;
-
} // Anonymous namespace
FileSys::VirtualFile GetGameFileFromPath(const FileSys::VirtualFilesystem& vfs,
@@ -261,11 +251,10 @@ struct System::Impl {
}
telemetry_session->AddInitialInfo(*app_loader, fs_controller, *content_provider);
- main_process = KProcessPtr{Kernel::KProcess::Create(system.Kernel()), KProcessDeleter};
- ASSERT(Kernel::KProcess::Initialize(main_process.get(), system, "main",
+ auto main_process = Kernel::KProcess::Create(system.Kernel());
+ ASSERT(Kernel::KProcess::Initialize(main_process, system, "main",
Kernel::KProcess::ProcessType::Userland)
.IsSuccess());
- main_process->Open();
const auto [load_result, load_parameters] = app_loader->Load(*main_process, system);
if (load_result != Loader::ResultStatus::Success) {
LOG_CRITICAL(Core, "Failed to load ROM (Error {})!", load_result);
@@ -275,7 +264,7 @@ struct System::Impl {
static_cast<u32>(SystemResultStatus::ErrorLoader) + static_cast<u32>(load_result));
}
AddGlueRegistrationForProcess(*app_loader, *main_process);
- kernel.MakeCurrentProcess(main_process.get());
+ kernel.MakeCurrentProcess(main_process);
kernel.InitializeCores();
// Initialize cheat engine
@@ -335,13 +324,11 @@ struct System::Impl {
time_manager.Shutdown();
core_timing.Shutdown();
app_loader.reset();
- perf_stats.reset();
gpu_core.reset();
+ perf_stats.reset();
kernel.Shutdown();
memory.Reset();
applet_manager.ClearAll();
- // TODO: The main process should be freed based on KAutoObject ref counting.
- main_process.reset();
LOG_DEBUG(Core, "Shutdown OK");
}
@@ -362,7 +349,7 @@ struct System::Impl {
}
Service::Glue::ApplicationLaunchProperty launch{};
- launch.title_id = process.GetTitleID();
+ launch.title_id = process.GetProgramID();
FileSys::PatchManager pm{launch.title_id, fs_controller, *content_provider};
launch.version = pm.GetGameVersion().value_or(0);
@@ -403,7 +390,6 @@ struct System::Impl {
std::unique_ptr<Tegra::GPU> gpu_core;
std::unique_ptr<Hardware::InterruptManager> interrupt_manager;
std::unique_ptr<Core::DeviceMemory> device_memory;
- KProcessPtr main_process{nullptr, KProcessDeleter};
Core::Memory::Memory memory;
CpuManager cpu_manager;
std::atomic_bool is_powered_on{};
@@ -653,6 +639,10 @@ const Core::SpeedLimiter& System::SpeedLimiter() const {
return impl->speed_limiter;
}
+u64 System::GetCurrentProcessProgramID() const {
+ return impl->kernel.CurrentProcess()->GetProgramID();
+}
+
Loader::ResultStatus System::GetGameName(std::string& out) const {
return impl->GetGameName(out);
}