1
0
Fork 0
forked from suyu/suyu

Kernel: Remove g_program_id

This has been obsoleted by the field in Process.
This commit is contained in:
Yuri Kunde Schlesner 2015-05-06 21:40:39 -03:00
parent 6d60acf0f1
commit a5eba2f984
6 changed files with 3 additions and 21 deletions

View file

@ -11,6 +11,7 @@
#include "core/file_sys/archive_savedata.h" #include "core/file_sys/archive_savedata.h"
#include "core/file_sys/disk_archive.h" #include "core/file_sys/disk_archive.h"
#include "core/hle/kernel/process.h"
#include "core/hle/service/fs/archive.h" #include "core/hle/service/fs/archive.h"
#include "core/settings.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) { 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)) { if (!FileUtil::Exists(concrete_mount_point)) {
// When a SaveData archive is created for the first time, it is not yet formatted // 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. // 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) { 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::DeleteDirRecursively(concrete_mount_point);
FileUtil::CreateFullPath(concrete_mount_point); FileUtil::CreateFullPath(concrete_mount_point);
return RESULT_SUCCESS; return RESULT_SUCCESS;

View file

@ -19,7 +19,6 @@ namespace Kernel {
unsigned int Object::next_object_id; unsigned int Object::next_object_id;
SharedPtr<Thread> g_main_thread; SharedPtr<Thread> g_main_thread;
HandleTable g_handle_table; HandleTable g_handle_table;
u64 g_program_id;
void WaitObject::AddWaitingThread(SharedPtr<Thread> thread) { void WaitObject::AddWaitingThread(SharedPtr<Thread> thread) {
auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread); auto itr = std::find(waiting_threads.begin(), waiting_threads.end(), thread);
@ -141,7 +140,6 @@ void Init() {
Kernel::TimersInit(); Kernel::TimersInit();
Object::next_object_id = 0; Object::next_object_id = 0;
g_program_id = 0;
g_main_thread = nullptr; g_main_thread = nullptr;
} }

View file

@ -273,12 +273,6 @@ private:
extern HandleTable g_handle_table; 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 /// Initialize the kernel
void Init(); void Init();

View file

@ -131,7 +131,6 @@ ResultStatus LoadFile(const std::string& filename) {
// Load application and RomFS // Load application and RomFS
if (ResultStatus::Success == app_loader.Load()) { 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); Service::FS::RegisterArchiveType(Common::make_unique<FileSys::ArchiveFactory_RomFS>(app_loader), Service::FS::ArchiveIdCode::RomFS);
return ResultStatus::Success; return ResultStatus::Success;
} }

View file

@ -293,8 +293,4 @@ ResultStatus AppLoader_NCCH::ReadRomFS(std::vector<u8>& buffer) const {
return ResultStatus::ErrorNotUsed; return ResultStatus::ErrorNotUsed;
} }
u64 AppLoader_NCCH::GetProgramId() const {
return *reinterpret_cast<u64 const*>(&ncch_header.program_id[0]);
}
} // namespace Loader } // namespace Loader

View file

@ -213,12 +213,6 @@ public:
*/ */
ResultStatus ReadRomFS(std::vector<u8>& buffer) const override; ResultStatus ReadRomFS(std::vector<u8>& buffer) const override;
/*
* Gets the program id from the NCCH header
* @return u64 Program id
*/
u64 GetProgramId() const;
private: private:
/** /**