More review fixes

This commit is contained in:
Zach Hilman
2018-07-16 16:22:40 -04:00
parent 5967d0c08b
commit a2e7b1b356
3 changed files with 8 additions and 7 deletions

View File

@@ -12,10 +12,9 @@
namespace FileSys {
std::string SaveStructDebugInfo(SaveDataDescriptor save_struct) {
std::string SaveDataDescriptor::DebugInfo() {
return fmt::format("[type={:02X}, title_id={:016X}, user_id={:016X}{:016X}, save_id={:016X}]",
static_cast<u8>(save_struct.type), save_struct.title_id,
save_struct.user_id[1], save_struct.user_id[0], save_struct.save_id);
static_cast<u8>(type), title_id, user_id[1], user_id[0], save_id);
}
SaveDataFactory::SaveDataFactory(std::string nand_directory)
@@ -65,7 +64,7 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveDataFactory::Open(SaveDataSpac
FileUtil::CreateFullPath(save_directory);
}
// TODO(DarkLordZach): For some reason, CreateFullPath dosen't create the last bit. Should be
// TODO(DarkLordZach): For some reason, CreateFullPath doesn't create the last bit. Should be
// fixed with VFS.
if (!FileUtil::IsDirectory(save_directory)) {
FileUtil::CreateDir(save_directory);
@@ -83,6 +82,8 @@ ResultVal<std::unique_ptr<FileSystemBackend>> SaveDataFactory::Open(SaveDataSpac
std::string SaveDataFactory::GetFullPath(SaveDataSpaceId space, SaveDataType type, u64 title_id,
u128 user_id, u64 save_id) const {
// According to switchbrew, if a save is of type SaveData and the title id field is 0, it should
// be interpreted as the title id of the current process.
if (type == SaveDataType::SaveData && title_id == 0)
title_id = Core::CurrentProcess()->program_id;

View File

@@ -37,11 +37,11 @@ struct SaveDataDescriptor {
u64_le zero_1;
u64_le zero_2;
u64_le zero_3;
std::string DebugInfo();
};
static_assert(sizeof(SaveDataDescriptor) == 0x40, "SaveDataDescriptor has incorrect size.");
std::string SaveStructDebugInfo(SaveDataDescriptor save_struct);
/// File system interface to the SaveData archive
class SaveDataFactory {
public:

View File

@@ -522,7 +522,7 @@ void FSP_SRV::CreateSaveData(Kernel::HLERequestContext& ctx) {
u128 uid = rp.PopRaw<u128>();
LOG_WARNING(Service_FS, "(STUBBED) called save_struct = {}, uid = {:016X}{:016X}",
FileSys::SaveStructDebugInfo(save_struct), uid[1], uid[0]);
save_struct.DebugInfo(), uid[1], uid[0]);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(RESULT_SUCCESS);