aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-06 21:40:39 -0300
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-08 22:11:03 -0300
commita5eba2f98466cd2788aab96f1ad93bcb32c5656c (patch)
tree231d164d039d2ae4cd69ae7cf44da2f16fc4be71
parent6d60acf0f1afcae873988da5218f2f1c7bc9d151 (diff)
Kernel: Remove g_program_id
This has been obsoleted by the field in Process.
-rw-r--r--src/core/file_sys/archive_savedata.cpp5
-rw-r--r--src/core/hle/kernel/kernel.cpp2
-rw-r--r--src/core/hle/kernel/kernel.h6
-rw-r--r--src/core/loader/loader.cpp1
-rw-r--r--src/core/loader/ncch.cpp4
-rw-r--r--src/core/loader/ncch.h6
6 files changed, 3 insertions, 21 deletions
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<std::unique_ptr<ArchiveBackend>> 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<std::unique_ptr<ArchiveBackend>> 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<Thread> g_main_thread;
HandleTable g_handle_table;
-u64 g_program_id;
void WaitObject::AddWaitingThread(SharedPtr<Thread> 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<FileSys::ArchiveFactory_RomFS>(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<u8>& buffer) const {
return ResultStatus::ErrorNotUsed;
}
-u64 AppLoader_NCCH::GetProgramId() const {
- return *reinterpret_cast<u64 const*>(&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<u8>& buffer) const override;
- /*
- * Gets the program id from the NCCH header
- * @return u64 Program id
- */
- u64 GetProgramId() const;
-
private:
/**