mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-24 08:24:18 +00:00
Fix PTM ext data creation after Artic Base changes. (#111)
This commit is contained in:
parent
24c6ec5e6a
commit
71eca05af1
3 changed files with 17 additions and 8 deletions
|
@ -289,8 +289,13 @@ ResultVal<std::unique_ptr<ArchiveBackend>> ArchiveFactory_ExtSaveData::Open(cons
|
|||
Result ArchiveFactory_ExtSaveData::FormatAsExtData(const Path& path,
|
||||
const FileSys::ArchiveFormatInfo& format_info,
|
||||
u8 unknown, u64 program_id, u64 total_size,
|
||||
std::span<const u8> icon) {
|
||||
std::optional<std::span<const u8>> icon) {
|
||||
if (IsUsingArtic()) {
|
||||
if (!icon.has_value()) {
|
||||
LOG_ERROR(Service_FS, "No icon provided while using Artic Base");
|
||||
return ResultUnknown;
|
||||
}
|
||||
|
||||
ExtSaveDataArchivePath path_data;
|
||||
std::memcpy(&path_data, path.AsBinary().data(), sizeof(path_data));
|
||||
|
||||
|
@ -307,7 +312,7 @@ Result ArchiveFactory_ExtSaveData::FormatAsExtData(const Path& path,
|
|||
req.AddParameterU32(format_info.number_directories);
|
||||
req.AddParameterU32(format_info.number_files);
|
||||
req.AddParameterU64(total_size);
|
||||
req.AddParameterBuffer(icon.data(), icon.size());
|
||||
req.AddParameterBuffer(icon->data(), icon->size());
|
||||
|
||||
return ArticArchive::RespResult(artic_client->Send(req));
|
||||
} else {
|
||||
|
@ -330,10 +335,11 @@ Result ArchiveFactory_ExtSaveData::FormatAsExtData(const Path& path,
|
|||
|
||||
file.WriteBytes(&format_info, sizeof(format_info));
|
||||
|
||||
FileUtil::IOFile icon_file(FileSys::GetExtSaveDataPath(GetMountPoint(), path) + "icon",
|
||||
"wb");
|
||||
icon_file.WriteBytes(icon.data(), icon.size());
|
||||
|
||||
if (icon.has_value()) {
|
||||
FileUtil::IOFile icon_file(FileSys::GetExtSaveDataPath(GetMountPoint(), path) + "icon",
|
||||
"wb");
|
||||
icon_file.WriteBytes(icon->data(), icon->size());
|
||||
}
|
||||
return ResultSuccess;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
@ -51,7 +52,8 @@ public:
|
|||
};
|
||||
|
||||
Result FormatAsExtData(const Path& path, const FileSys::ArchiveFormatInfo& format_info,
|
||||
u8 unknown, u64 program_id, u64 total_size, std::span<const u8> icon);
|
||||
u8 unknown, u64 program_id, u64 total_size,
|
||||
std::optional<std::span<const u8>> icon);
|
||||
|
||||
Result DeleteExtData(Service::FS::MediaType media_type, u8 unknown, u32 high, u32 low);
|
||||
|
||||
|
|
|
@ -158,7 +158,8 @@ static void WriteGameCoinData(GameCoin gamecoin_data) {
|
|||
// If the archive didn't exist, create the files inside
|
||||
if (archive_result.Code() == FileSys::ResultNotFormatted) {
|
||||
// Format the archive to create the directories
|
||||
extdata_archive_factory.Format(archive_path, FileSys::ArchiveFormatInfo(), 0, 0, 0);
|
||||
extdata_archive_factory.FormatAsExtData(archive_path, FileSys::ArchiveFormatInfo(), 0, 0, 0,
|
||||
std::nullopt);
|
||||
// Open it again to get a valid archive now that the folder exists
|
||||
archive = extdata_archive_factory.Open(archive_path, 0).Unwrap();
|
||||
// Create the game coin file
|
||||
|
|
Loading…
Reference in a new issue