From d140c8ecf7514e925340cbd3340991c8df0d0c15 Mon Sep 17 00:00:00 2001 From: Subv Date: Mon, 19 Feb 2018 00:32:00 -0500 Subject: Filesystem: Added a SaveData Factory and associated Disk_FileSystem. --- src/core/file_sys/savedata_factory.cpp | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/core/file_sys/savedata_factory.cpp (limited to 'src/core/file_sys/savedata_factory.cpp') diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp new file mode 100644 index 000000000..0df754e7c --- /dev/null +++ b/src/core/file_sys/savedata_factory.cpp @@ -0,0 +1,41 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include +#include +#include "common/common_types.h" +#include "common/logging/log.h" +#include "common/string_util.h" +#include "core/file_sys/disk_filesystem.h" +#include "core/file_sys/savedata_factory.h" + +namespace FileSys { + +SaveData_Factory::SaveData_Factory(std::string nand_directory) + : nand_directory(std::move(nand_directory)) {} + +ResultVal> SaveData_Factory::Open(const Path& path) { + // TODO(Subv): Somehow obtain these values. + u64 title_id = 0; + u32 user = 0; + std::string save_directory = Common::StringFromFormat("%ssave/%016" PRIX64 "/%08X", + nand_directory.c_str(), title_id, user); + auto archive = std::make_unique(save_directory); + return MakeResult>(std::move(archive)); +} + +ResultCode SaveData_Factory::Format(const Path& path, + const FileSys::ArchiveFormatInfo& format_info) { + LOG_ERROR(Service_FS, "Unimplemented Format archive %s", GetName().c_str()); + // TODO(bunnei): Find the right error code for this + return ResultCode(-1); +} + +ResultVal SaveData_Factory::GetFormatInfo(const Path& path) const { + LOG_ERROR(Service_FS, "Unimplemented GetFormatInfo archive %s", GetName().c_str()); + // TODO(bunnei): Find the right error code for this + return ResultCode(-1); +} + +} // namespace FileSys -- cgit v1.2.3 From 3209cff5307ab16044ccc22e6b922545aae8215d Mon Sep 17 00:00:00 2001 From: Subv Date: Tue, 27 Feb 2018 10:23:35 -0500 Subject: SaveData: Use the current titleid when opening the savedata archive. --- src/core/file_sys/savedata_factory.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/core/file_sys/savedata_factory.cpp') diff --git a/src/core/file_sys/savedata_factory.cpp b/src/core/file_sys/savedata_factory.cpp index 0df754e7c..4d83e100f 100644 --- a/src/core/file_sys/savedata_factory.cpp +++ b/src/core/file_sys/savedata_factory.cpp @@ -9,6 +9,7 @@ #include "common/string_util.h" #include "core/file_sys/disk_filesystem.h" #include "core/file_sys/savedata_factory.h" +#include "core/hle/kernel/process.h" namespace FileSys { @@ -16,8 +17,8 @@ SaveData_Factory::SaveData_Factory(std::string nand_directory) : nand_directory(std::move(nand_directory)) {} ResultVal> SaveData_Factory::Open(const Path& path) { - // TODO(Subv): Somehow obtain these values. - u64 title_id = 0; + u64 title_id = Kernel::g_current_process->program_id; + // TODO(Subv): Somehow obtain this value. u32 user = 0; std::string save_directory = Common::StringFromFormat("%ssave/%016" PRIX64 "/%08X", nand_directory.c_str(), title_id, user); -- cgit v1.2.3