mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-23 15:22:45 +01:00
HLE/FS: Corrected some style concerns.
This commit is contained in:
parent
95380d8950
commit
3aa42627a3
8 changed files with 12 additions and 14 deletions
|
@ -172,7 +172,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) = 0;
|
virtual ResultCode Format(const Path& path, const FileSys::ArchiveFormatInfo& format_info) = 0;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Retrieves the format info about the archive with the specified path
|
* Retrieves the format info about the archive with the specified path
|
||||||
* @param path Path to the archive
|
* @param path Path to the archive
|
||||||
* @return Format information about the archive or error code
|
* @return Format information about the archive or error code
|
||||||
|
|
|
@ -117,7 +117,7 @@ ResultVal<ArchiveFormatInfo> ArchiveFactory_ExtSaveData::GetFormatInfo(const Pat
|
||||||
return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, ErrorSummary::InvalidState, ErrorLevel::Status);
|
return ResultCode(ErrorDescription::FS_NotFormatted, ErrorModule::FS, ErrorSummary::InvalidState, ErrorLevel::Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, u8* icon_data, u32 icon_size) {
|
void ArchiveFactory_ExtSaveData::WriteIcon(const Path& path, const u8* icon_data, u32 icon_size) {
|
||||||
std::string game_path = FileSys::GetExtSaveDataPath(GetMountPoint(), path);
|
std::string game_path = FileSys::GetExtSaveDataPath(GetMountPoint(), path);
|
||||||
FileUtil::IOFile icon_file(game_path + "icon", "wb+");
|
FileUtil::IOFile icon_file(game_path + "icon", "wb+");
|
||||||
icon_file.WriteBytes(icon_data, icon_size);
|
icon_file.WriteBytes(icon_data, icon_size);
|
||||||
|
|
|
@ -36,13 +36,13 @@ public:
|
||||||
|
|
||||||
const std::string& GetMountPoint() const { return mount_point; }
|
const std::string& GetMountPoint() const { return mount_point; }
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Writes the SMDH icon of the ExtSaveData to file
|
* Writes the SMDH icon of the ExtSaveData to file
|
||||||
* @param path Path of this ExtSaveData
|
* @param path Path of this ExtSaveData
|
||||||
* @param icon_data Binary data of the icon
|
* @param icon_data Binary data of the icon
|
||||||
* @param icon_size Size of the icon data
|
* @param icon_size Size of the icon data
|
||||||
*/
|
*/
|
||||||
void WriteIcon(const Path& path, u8* icon_data, u32 icon_size);
|
void WriteIcon(const Path& path, const u8* icon_data, u32 icon_size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -26,14 +26,14 @@ static std::string GetSaveDataContainerPath(const std::string& sdmc_directory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) {
|
static std::string GetSaveDataPath(const std::string& mount_location, u64 program_id) {
|
||||||
u32 high = program_id >> 32;
|
u32 high = (u32)(program_id >> 32);
|
||||||
u32 low = program_id & 0xFFFFFFFF;
|
u32 low = (u32)(program_id & 0xFFFFFFFF);
|
||||||
return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high, low);
|
return Common::StringFromFormat("%s%08x/%08x/data/00000001/", mount_location.c_str(), high, low);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) {
|
static std::string GetSaveDataMetadataPath(const std::string& mount_location, u64 program_id) {
|
||||||
u32 high = program_id >> 32;
|
u32 high = (u32)(program_id >> 32);
|
||||||
u32 low = program_id & 0xFFFFFFFF;
|
u32 low = (u32)(program_id & 0xFFFFFFFF);
|
||||||
return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(), high, low);
|
return Common::StringFromFormat("%s%08x/%08x/data/00000001.metadata", mount_location.c_str(), high, low);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -310,6 +310,7 @@ ResultCode UpdateConfigNANDSavegame() {
|
||||||
|
|
||||||
ResultCode FormatConfig() {
|
ResultCode FormatConfig() {
|
||||||
ResultCode res = DeleteConfigNANDSaveFile();
|
ResultCode res = DeleteConfigNANDSaveFile();
|
||||||
|
// The delete command fails if the file doesn't exist, so we have to check that too
|
||||||
if (!res.IsSuccess() && res.description != ErrorDescription::FS_NotFound)
|
if (!res.IsSuccess() && res.description != ErrorDescription::FS_NotFound)
|
||||||
return res;
|
return res;
|
||||||
// Delete the old data
|
// Delete the old data
|
||||||
|
|
|
@ -308,11 +308,8 @@ ResultVal<Kernel::SharedPtr<File>> OpenFileFromArchive(ArchiveHandle archive_han
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
|
|
||||||
auto backend = archive->OpenFile(path, mode);
|
auto backend = archive->OpenFile(path, mode);
|
||||||
if (backend.Failed()) {
|
if (backend.Failed())
|
||||||
return backend.Code();
|
return backend.Code();
|
||||||
return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS,
|
|
||||||
ErrorSummary::NotFound, ErrorLevel::Status);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto file = Kernel::SharedPtr<File>(new File(backend.MoveFrom(), path));
|
auto file = Kernel::SharedPtr<File>(new File(backend.MoveFrom(), path));
|
||||||
return MakeResult<Kernel::SharedPtr<File>>(std::move(file));
|
return MakeResult<Kernel::SharedPtr<File>>(std::move(file));
|
||||||
|
|
|
@ -183,7 +183,7 @@ ResultVal<u64> GetFreeBytesInArchive(ArchiveHandle archive_handle);
|
||||||
*/
|
*/
|
||||||
ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo& format_info, const FileSys::Path& path = FileSys::Path());
|
ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo& format_info, const FileSys::Path& path = FileSys::Path());
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Retrieves the format info about the archive of the specified type and path.
|
* Retrieves the format info about the archive of the specified type and path.
|
||||||
* The format info is supplied by the client code when creating archives.
|
* The format info is supplied by the client code when creating archives.
|
||||||
* @param id_code The id of the archive
|
* @param id_code The id of the archive
|
||||||
|
|
|
@ -250,7 +250,7 @@ static void CreateFile(Service::Interface* self) {
|
||||||
|
|
||||||
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
|
FileSys::Path file_path(filename_type, filename_size, filename_ptr);
|
||||||
|
|
||||||
LOG_DEBUG(Service_FS, "type=%d size=%lld data=%s", filename_type, filename_size, file_path.DebugStr().c_str());
|
LOG_DEBUG(Service_FS, "type=%d size=%llu data=%s", filename_type, filename_size, file_path.DebugStr().c_str());
|
||||||
|
|
||||||
cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
|
cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue