From a5eba2f98466cd2788aab96f1ad93bcb32c5656c Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Wed, 6 May 2015 21:40:39 -0300 Subject: Kernel: Remove g_program_id This has been obsoleted by the field in Process. --- src/core/file_sys/archive_savedata.cpp | 5 +++-- src/core/hle/kernel/kernel.cpp | 2 -- src/core/hle/kernel/kernel.h | 6 ------ src/core/loader/loader.cpp | 1 - src/core/loader/ncch.cpp | 4 ---- src/core/loader/ncch.h | 6 ------ 6 files changed, 3 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp index 12624fa3..8dff5196 100644 --- a/src/core/file_sys/archive_savedata.cpp +++ b/src/core/file_sys/archive_savedata.cpp @@ -11,6 +11,7 @@ #include "core/file_sys/archive_savedata.h" #include "core/file_sys/disk_archive.h" +#include "core/hle/kernel/process.h" #include "core/hle/service/fs/archive.h" #include "core/settings.h" @@ -36,7 +37,7 @@ ArchiveFactory_SaveData::ArchiveFactory_SaveData(const std::string& sdmc_directo } ResultVal> ArchiveFactory_SaveData::Open(const Path& path) { - std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id); + std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->program_id); if (!FileUtil::Exists(concrete_mount_point)) { // When a SaveData archive is created for the first time, it is not yet formatted // and the save file/directory structure expected by the game has not yet been initialized. @@ -51,7 +52,7 @@ ResultVal> ArchiveFactory_SaveData::Open(const P } ResultCode ArchiveFactory_SaveData::Format(const Path& path) { - std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id); + std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->program_id); FileUtil::DeleteDirRecursively(concrete_mount_point); FileUtil::CreateFullPath(concrete_mount_point); return RESULT_SUCCESS; diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 9c8d6fa3..5157ab2a 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -19,7 +19,6 @@ namespace Kernel { unsigned int Object::next_object_id; SharedPtr g_main_thread; HandleTable g_handle_table; -u64 g_program_id; void WaitObject::AddWaitingThread(SharedPtr thread) { auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); @@ -141,7 +140,6 @@ void Init() { Kernel::TimersInit(); Object::next_object_id = 0; - g_program_id = 0; g_main_thread = nullptr; } diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index d0c69677..7c106d37 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -273,12 +273,6 @@ private: extern HandleTable g_handle_table; -/// The ID code of the currently running game -/// TODO(Subv): This variable should not be here, -/// we need a way to store information about the currently loaded application -/// for later query during runtime, maybe using the LDR service? -extern u64 g_program_id; - /// Initialize the kernel void Init(); diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 97525fbe..2718e88c 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp @@ -131,7 +131,6 @@ ResultStatus LoadFile(const std::string& filename) { // Load application and RomFS if (ResultStatus::Success == app_loader.Load()) { - Kernel::g_program_id = app_loader.GetProgramId(); Service::FS::RegisterArchiveType(Common::make_unique(app_loader), Service::FS::ArchiveIdCode::RomFS); return ResultStatus::Success; } diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp index 53100013..0e2db2fb 100644 --- a/src/core/loader/ncch.cpp +++ b/src/core/loader/ncch.cpp @@ -293,8 +293,4 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector& buffer) const { return ResultStatus::ErrorNotUsed; } -u64 AppLoader_NCCH::GetProgramId() const { - return *reinterpret_cast(&ncch_header.program_id[0]); -} - } // namespace Loader diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h index dec46e86..1be941f1 100644 --- a/src/core/loader/ncch.h +++ b/src/core/loader/ncch.h @@ -213,12 +213,6 @@ public: */ ResultStatus ReadRomFS(std::vector& buffer) const override; - /* - * Gets the program id from the NCCH header - * @return u64 Program id - */ - u64 GetProgramId() const; - private: /** -- cgit v1.2.3