summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2015-05-06 21:40:39 -0300
committerGravatar Yuri Kunde Schlesner2015-05-08 22:11:03 -0300
commita5eba2f98466cd2788aab96f1ad93bcb32c5656c (patch)
tree231d164d039d2ae4cd69ae7cf44da2f16fc4be71 /src/core
parentKernel: Introduce skeleton Process class to hold process data (diff)
downloadyuzu-a5eba2f98466cd2788aab96f1ad93bcb32c5656c.tar.gz
yuzu-a5eba2f98466cd2788aab96f1ad93bcb32c5656c.tar.xz
yuzu-a5eba2f98466cd2788aab96f1ad93bcb32c5656c.zip
Kernel: Remove g_program_id
This has been obsoleted by the field in Process.
Diffstat (limited to 'src/core')
-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 12624fa31..8dff51966 100644
--- a/src/core/file_sys/archive_savedata.cpp
+++ b/src/core/file_sys/archive_savedata.cpp
@@ -11,6 +11,7 @@
11 11
12#include "core/file_sys/archive_savedata.h" 12#include "core/file_sys/archive_savedata.h"
13#include "core/file_sys/disk_archive.h" 13#include "core/file_sys/disk_archive.h"
14#include "core/hle/kernel/process.h"
14#include "core/hle/service/fs/archive.h" 15#include "core/hle/service/fs/archive.h"
15#include "core/settings.h" 16#include "core/settings.h"
16 17
@@ -36,7 +37,7 @@ ArchiveFactory_SaveData::ArchiveFactory_SaveData(const std::string& sdmc_directo
36} 37}
37 38
38ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const Path& path) { 39ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_SaveData::Open(const Path& path) {
39 std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id); 40 std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->program_id);
40 if (!FileUtil::Exists(concrete_mount_point)) { 41 if (!FileUtil::Exists(concrete_mount_point)) {
41 // When a SaveData archive is created for the first time, it is not yet formatted 42 // When a SaveData archive is created for the first time, it is not yet formatted
42 // and the save file/directory structure expected by the game has not yet been initialized. 43 // 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
51} 52}
52 53
53ResultCode ArchiveFactory_SaveData::Format(const Path& path) { 54ResultCode ArchiveFactory_SaveData::Format(const Path& path) {
54 std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_program_id); 55 std::string concrete_mount_point = GetSaveDataPath(mount_point, Kernel::g_current_process->program_id);
55 FileUtil::DeleteDirRecursively(concrete_mount_point); 56 FileUtil::DeleteDirRecursively(concrete_mount_point);
56 FileUtil::CreateFullPath(concrete_mount_point); 57 FileUtil::CreateFullPath(concrete_mount_point);
57 return RESULT_SUCCESS; 58 return RESULT_SUCCESS;
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 9c8d6fa36..5157ab2af 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -19,7 +19,6 @@ namespace Kernel {
19unsigned int Object::next_object_id; 19unsigned int Object::next_object_id;
20SharedPtr<Thread> g_main_thread; 20SharedPtr<Thread> g_main_thread;
21HandleTable g_handle_table; 21HandleTable g_handle_table;
22u64 g_program_id;
23 22
24void WaitObject::AddWaitingThread(SharedPtr<Thread> thread) { 23void WaitObject::AddWaitingThread(SharedPtr<Thread> thread) {
25 auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); 24 auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread);
@@ -141,7 +140,6 @@ void Init() {
141 Kernel::TimersInit(); 140 Kernel::TimersInit();
142 141
143 Object::next_object_id = 0; 142 Object::next_object_id = 0;
144 g_program_id = 0;
145 g_main_thread = nullptr; 143 g_main_thread = nullptr;
146} 144}
147 145
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index d0c69677a..7c106d37c 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -273,12 +273,6 @@ private:
273 273
274extern HandleTable g_handle_table; 274extern HandleTable g_handle_table;
275 275
276/// The ID code of the currently running game
277/// TODO(Subv): This variable should not be here,
278/// we need a way to store information about the currently loaded application
279/// for later query during runtime, maybe using the LDR service?
280extern u64 g_program_id;
281
282/// Initialize the kernel 276/// Initialize the kernel
283void Init(); 277void Init();
284 278
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index 97525fbeb..2718e88c1 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -131,7 +131,6 @@ ResultStatus LoadFile(const std::string& filename) {
131 131
132 // Load application and RomFS 132 // Load application and RomFS
133 if (ResultStatus::Success == app_loader.Load()) { 133 if (ResultStatus::Success == app_loader.Load()) {
134 Kernel::g_program_id = app_loader.GetProgramId();
135 Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS); 134 Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS);
136 return ResultStatus::Success; 135 return ResultStatus::Success;
137 } 136 }
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 531000137..0e2db2fbb 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 {
293 return ResultStatus::ErrorNotUsed; 293 return ResultStatus::ErrorNotUsed;
294} 294}
295 295
296u64 AppLoader_NCCH::GetProgramId() const {
297 return *reinterpret_cast<u64 const*>(&ncch_header.program_id[0]);
298}
299
300} // namespace Loader 296} // namespace Loader
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index dec46e86c..1be941f19 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -213,12 +213,6 @@ public:
213 */ 213 */
214 ResultStatus ReadRomFS(std::vector<u8>& buffer) const override; 214 ResultStatus ReadRomFS(std::vector<u8>& buffer) const override;
215 215
216 /*
217 * Gets the program id from the NCCH header
218 * @return u64 Program id
219 */
220 u64 GetProgramId() const;
221
222private: 216private:
223 217
224 /** 218 /**