Merge pull request #376 from Subv/arc_reorder

Archives: Change the folder layout of some archives.
This commit is contained in:
bunnei 2015-01-06 20:13:56 -05:00
commit 088863c921
14 changed files with 93 additions and 66 deletions

View file

@ -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<FileSys::Archive_SystemSaveData>(
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;

View file

@ -36,6 +36,10 @@ namespace std {
};
}
/// TODO(Subv): Confirm length of these strings
const std::string SYSTEM_ID = "00000000000000000000000000000000";
const std::string SDCARD_ID = "00000000000000000000000000000000";
namespace Service {
namespace FS {
@ -432,11 +436,11 @@ ResultCode FormatSaveData() {
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.
// 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);
std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
auto sdmc_archive = Common::make_unique<FileSys::Archive_SDMC>(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<FileSys::Archive_SaveData>(savedata_directory);
auto savedata_archive = Common::make_unique<FileSys::Archive_SaveData>(sdmc_directory);
CreateArchive(std::move(savedata_archive), ArchiveIdCode::SaveData);
std::string extsavedata_directory = FileUtil::GetUserPath(D_EXTSAVEDATA);
auto extsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(extsavedata_directory);
auto extsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(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_EXTSAVEDATA);
auto sharedextsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(sharedextsavedata_directory);
auto sharedextsavedata_archive = Common::make_unique<FileSys::Archive_ExtSaveData>(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<FileSys::Archive_SaveDataCheck>(savedatacheck_directory);
auto savedatacheck_archive = Common::make_unique<FileSys::Archive_SaveDataCheck>(nand_directory);
CreateArchive(std::move(savedatacheck_archive), ArchiveIdCode::SaveDataCheck);
}

View file

@ -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 std::string SYSTEM_ID;
/// The scrambled SD card CID, also known as ID1
extern const std::string SDCARD_ID;
namespace Service {
namespace FS {

View file

@ -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_EXTSAVEDATA);
ptm_shared_extsavedata = Common::make_unique<FileSys::Archive_ExtSaveData>(extsavedata_directory);
std::string nand_directory = FileUtil::GetUserPath(D_NAND_IDX);
ptm_shared_extsavedata = Common::make_unique<FileSys::Archive_ExtSaveData>(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);