From 3bc9f5509b9f36e934d1a16eeda31be9bb22ac10 Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 31 Dec 2014 21:43:31 -0500 Subject: Archives: Change the folder layout of some archives. This is to better represent the hardware layout, they are still aren't quite accurate, but this better and will help a bit when implementing the other archives like NAND-RO and NAND-RW --- src/core/hle/service/fs/archive.cpp | 2 +- src/core/hle/service/ptm_u.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index f761c6ab9..56d53402f 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -455,7 +455,7 @@ void ArchiveInit() { else LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_directory.c_str()); - std::string sharedextsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA); + std::string sharedextsavedata_directory = FileUtil::GetUserPath(D_SHAREDEXTSAVEDATA); auto sharedextsavedata_archive = Common::make_unique(sharedextsavedata_directory); if (sharedextsavedata_archive->Initialize()) CreateArchive(std::move(sharedextsavedata_archive), ArchiveIdCode::SharedExtSaveData); diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp index 9cc700c46..c900c90f8 100644 --- a/src/core/hle/service/ptm_u.cpp +++ b/src/core/hle/service/ptm_u.cpp @@ -142,7 +142,7 @@ Interface::Interface() { Register(FunctionTable, ARRAY_SIZE(FunctionTable)); // Create the SharedExtSaveData archive 0xF000000B and the gamecoin.dat file // TODO(Subv): In the future we should use the FS service to query this archive - std::string extsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA); + std::string extsavedata_directory = FileUtil::GetUserPath(D_SHAREDEXTSAVEDATA); ptm_shared_extsavedata = Common::make_unique(extsavedata_directory); if (!ptm_shared_extsavedata->Initialize()) { LOG_CRITICAL(Service_PTM, "Could not initialize ExtSaveData archive for the PTM:U service"); -- cgit v1.2.3 From 71a063f45cba961ee07730f4ab79f2bcc3ff9b5b Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 3 Jan 2015 20:46:05 -0500 Subject: Archives: Changed the way paths are built for the archives. Each archive now takes a mount point of either NAND or SDMC, and builds its own directory structure there, trying to simulate an HLE-friendly hardware layout --- src/core/hle/service/cfg/cfg.cpp | 4 ++-- src/core/hle/service/fs/archive.cpp | 20 ++++++++++---------- src/core/hle/service/fs/archive.h | 5 +++++ src/core/hle/service/ptm_u.cpp | 6 +++--- 4 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp index 161aa8531..8812c49ef 100644 --- a/src/core/hle/service/cfg/cfg.cpp +++ b/src/core/hle/service/cfg/cfg.cpp @@ -161,9 +161,9 @@ ResultCode FormatConfig() { void CFGInit() { // TODO(Subv): In the future we should use the FS service to query this archive, // currently it is not possible because you can only have one open archive of the same type at any time - std::string syssavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX); + std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX); cfg_system_save_data = Common::make_unique( - syssavedata_directory, CFG_SAVE_ID); + nand_directory, CFG_SAVE_ID); if (!cfg_system_save_data->Initialize()) { LOG_CRITICAL(Service_CFG, "Could not initialize SystemSaveData archive for the CFG:U service"); return; diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 56d53402f..f332d6f1f 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -36,6 +36,9 @@ namespace std { }; } +const u32 SYSTEM_ID = 0; +const u32 SDCARD_ID = 0; + namespace Service { namespace FS { @@ -437,6 +440,7 @@ void ArchiveInit() { // archive type is SDMC, so it is the only one getting exposed. std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); + std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX); auto sdmc_archive = Common::make_unique(sdmc_directory); if (sdmc_archive->Initialize()) CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC); @@ -444,28 +448,24 @@ void ArchiveInit() { LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); // Create the SaveData archive - std::string savedata_directory = FileUtil::GetUserPath(D_SAVEDATA_IDX); - auto savedata_archive = Common::make_unique(savedata_directory); + auto savedata_archive = Common::make_unique(sdmc_directory); CreateArchive(std::move(savedata_archive), ArchiveIdCode::SaveData); - std::string extsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA); - auto extsavedata_archive = Common::make_unique(extsavedata_directory); + auto extsavedata_archive = Common::make_unique(sdmc_directory, false); if (extsavedata_archive->Initialize()) CreateArchive(std::move(extsavedata_archive), ArchiveIdCode::ExtSaveData); else - LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_directory.c_str()); + LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_archive->GetMountPoint().c_str()); - std::string sharedextsavedata_directory = FileUtil::GetUserPath(D_SHAREDEXTSAVEDATA); - auto sharedextsavedata_archive = Common::make_unique(sharedextsavedata_directory); + auto sharedextsavedata_archive = Common::make_unique(nand_directory, true); if (sharedextsavedata_archive->Initialize()) CreateArchive(std::move(sharedextsavedata_archive), ArchiveIdCode::SharedExtSaveData); else LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s", - sharedextsavedata_directory.c_str()); + sharedextsavedata_archive->GetMountPoint().c_str()); // Create the SaveDataCheck archive, basically a small variation of the RomFS archive - std::string savedatacheck_directory = FileUtil::GetUserPath(D_SAVEDATACHECK_IDX); - auto savedatacheck_archive = Common::make_unique(savedatacheck_directory); + auto savedatacheck_archive = Common::make_unique(nand_directory); CreateArchive(std::move(savedatacheck_archive), ArchiveIdCode::SaveDataCheck); } diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index 9e9efa019..f91a3d5f4 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -10,6 +10,11 @@ #include "core/hle/kernel/kernel.h" #include "core/hle/result.h" +/// The unique system identifier hash, also known as ID0 +extern const u32 SYSTEM_ID; +/// The scrambled SD card CID, also known as ID1 +extern const u32 SDCARD_ID; + namespace Service { namespace FS { diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp index c900c90f8..fd79cd8ab 100644 --- a/src/core/hle/service/ptm_u.cpp +++ b/src/core/hle/service/ptm_u.cpp @@ -142,10 +142,10 @@ Interface::Interface() { Register(FunctionTable, ARRAY_SIZE(FunctionTable)); // Create the SharedExtSaveData archive 0xF000000B and the gamecoin.dat file // TODO(Subv): In the future we should use the FS service to query this archive - std::string extsavedata_directory = FileUtil::GetUserPath(D_SHAREDEXTSAVEDATA); - ptm_shared_extsavedata = Common::make_unique(extsavedata_directory); + std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX); + ptm_shared_extsavedata = Common::make_unique(nand_directory, true); if (!ptm_shared_extsavedata->Initialize()) { - LOG_CRITICAL(Service_PTM, "Could not initialize ExtSaveData archive for the PTM:U service"); + LOG_CRITICAL(Service_PTM, "Could not initialize SharedExtSaveData archive for the PTM:U service"); return; } FileSys::Path archive_path(ptm_shared_extdata_id); -- cgit v1.2.3 From 90dffe3fc16dd60166c53bafa2b3157737f39225 Mon Sep 17 00:00:00 2001 From: Subv Date: Sun, 4 Jan 2015 09:10:27 -0500 Subject: Archives: Make SYSTEM_ID and SDCARD_ID strings --- src/core/hle/service/fs/archive.cpp | 4 ++-- src/core/hle/service/fs/archive.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index f332d6f1f..e627f1d64 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -36,8 +36,8 @@ namespace std { }; } -const u32 SYSTEM_ID = 0; -const u32 SDCARD_ID = 0; +const std::string SYSTEM_ID = "00000000000000000000000000000000"; +const std::string SDCARD_ID = "00000000000000000000000000000000"; namespace Service { namespace FS { diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h index f91a3d5f4..b3f2134f2 100644 --- a/src/core/hle/service/fs/archive.h +++ b/src/core/hle/service/fs/archive.h @@ -11,9 +11,9 @@ #include "core/hle/result.h" /// The unique system identifier hash, also known as ID0 -extern const u32 SYSTEM_ID; +extern const std::string SYSTEM_ID; /// The scrambled SD card CID, also known as ID1 -extern const u32 SDCARD_ID; +extern const std::string SDCARD_ID; namespace Service { namespace FS { -- cgit v1.2.3 From 5244ac0e9c784c402946616f913a8b4fe63af88c Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 6 Jan 2015 15:02:30 -0500 Subject: Archives: Addressed some comments --- src/core/hle/service/fs/archive.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index e627f1d64..0834b342a 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -36,6 +36,7 @@ namespace std { }; } +/// TODO(Subv): Confirm length of these strings const std::string SYSTEM_ID = "00000000000000000000000000000000"; const std::string SDCARD_ID = "00000000000000000000000000000000"; @@ -436,8 +437,7 @@ void ArchiveInit() { next_handle = 1; // TODO(Link Mauve): Add the other archive types (see here for the known types: - // http://3dbrew.org/wiki/FS:OpenArchive#Archive_idcodes). Currently the only half-finished - // archive type is SDMC, so it is the only one getting exposed. + // http://3dbrew.org/wiki/FS:OpenArchive#Archive_idcodes). std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX); -- cgit v1.2.3 From 32dbb76e00684d1d9e6550ede6fd811943cd7610 Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 6 Jan 2015 15:34:37 -0500 Subject: Archives: Changed the unimplemented archives comment. It now refers to me as the PoC --- src/core/hle/service/fs/archive.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/service') diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp index 0834b342a..958dd9344 100644 --- a/src/core/hle/service/fs/archive.cpp +++ b/src/core/hle/service/fs/archive.cpp @@ -436,7 +436,7 @@ ResultCode FormatSaveData() { void ArchiveInit() { next_handle = 1; - // TODO(Link Mauve): Add the other archive types (see here for the known types: + // TODO(Subv): Add the other archive types (see here for the known types: // http://3dbrew.org/wiki/FS:OpenArchive#Archive_idcodes). std::string sdmc_directory = FileUtil::GetUserPath(D_SDMC_IDX); -- cgit v1.2.3