diff --git a/include/fs/archive_ext_save_data.hpp b/include/fs/archive_ext_save_data.hpp index 98c668e3..183bdf1d 100644 --- a/include/fs/archive_ext_save_data.hpp +++ b/include/fs/archive_ext_save_data.hpp @@ -23,8 +23,6 @@ public: void format(const FSPath& path, const FormatInfo& info) override; Rust::Result getFormatInfo(const FSPath& path) override; void clear(const FSPath& path) const; - void saveIcon(const std::vector& data) const; - Rust::Result, HorizonResult> loadIcon() const; std::filesystem::path getFormatInfoPath(const FSPath& path) const; std::filesystem::path getUserDataPath() const; diff --git a/include/services/fs.hpp b/include/services/fs.hpp index 1e29d875..9a15ed5e 100644 --- a/include/services/fs.hpp +++ b/include/services/fs.hpp @@ -42,7 +42,6 @@ class FSService { Rust::Result openDirectoryHandle(ArchiveBase* archive, const FSPath& path); std::optional openFileHandle(ArchiveBase* archive, const FSPath& path, const FSPath& archivePath, const FilePerms& perms); FSPath readPath(u32 type, u32 pointer, u32 size); - void writePointer(const u8* data, u32 pointer, u32 size); const EmulatorConfig& config; diff --git a/src/core/fs/archive_ext_save_data.cpp b/src/core/fs/archive_ext_save_data.cpp index 6fe4d97c..7293341a 100644 --- a/src/core/fs/archive_ext_save_data.cpp +++ b/src/core/fs/archive_ext_save_data.cpp @@ -229,32 +229,6 @@ void ExtSaveDataArchive::clear(const FSPath& path) const { fs::remove(formatInfoPath); } -void ExtSaveDataArchive::saveIcon(const std::vector& data) const { - if (data.empty()) { - return; - } - - const fs::path iconPath = IOFile::getAppData() / backingFolder / "icon"; - IOFile file(iconPath, "wb"); - file.setSize(data.size()); - file.writeBytes(data.data(), data.size()); - file.flush(); - file.close(); -} - -Rust::Result, HorizonResult> ExtSaveDataArchive::loadIcon() const { - const fs::path iconPath = IOFile::getAppData() / backingFolder / "icon"; - IOFile file(iconPath, "rb"); - const s32 size = static_cast(file.size().value_or(-1)); - if (size <= 0) { - return Err(Result::FS::NotFoundInvalid); - } - - std::vector icon(size); - file.readBytes(icon.data(), size); - return Ok(icon); -} - std::filesystem::path ExtSaveDataArchive::getFormatInfoPath(const FSPath& path) const { return IOFile::getAppData() / "FormatInfo" / (getExtSaveDataPathFromBinary(path) + ".format"); } diff --git a/src/core/services/fs.cpp b/src/core/services/fs.cpp index e9db5c0a..c647c9cb 100644 --- a/src/core/services/fs.cpp +++ b/src/core/services/fs.cpp @@ -164,12 +164,6 @@ FSPath FSService::readPath(u32 type, u32 pointer, u32 size) { return FSPath(type, data); } -void FSService::writePointer(const u8* data, u32 pointer, u32 size) { - for (u32 i = 0; i < size; i++) { - mem.write8(pointer + i, data[i]); - } -} - void FSService::handleSyncRequest(u32 messagePointer) { const u32 command = mem.read32(messagePointer); switch (command) { @@ -204,7 +198,6 @@ void FSService::handleSyncRequest(u32 messagePointer) { case FSCommands::SetPriority: setPriority(messagePointer); break; case FSCommands::SetThisSaveDataSecureValue: setThisSaveDataSecureValue(messagePointer); break; case FSCommands::AbnegateAccessRight: abnegateAccessRight(messagePointer); break; - case FSCommands::ReadExtSaveDataIcon: readExtSaveDataIcon(messagePointer); break; case FSCommands::TheGameboyVCFunction: theGameboyVCFunction(messagePointer); break; default: Helpers::panic("FS service requested. Command: %08X\n", command); } @@ -577,52 +570,14 @@ void FSService::createExtSaveData(u32 messagePointer) { if (selected != nullptr) { selected->format(path, info); - - if (smdhSize > 0 && smdhPointer != 0) { - const FSPath smdh = readPath(PathType::Binary, smdhPointer, smdhSize); - selected->saveIcon(smdh.binary); - } + const FSPath smdh = readPath(PathType::Binary, smdhPointer, smdhSize); + // selected->saveIcon(smdh.binary); } mem.write32(messagePointer, IPC::responseHeader(0x0851, 1, 0)); mem.write32(messagePointer + 4, Result::Success); } -void FSService::readExtSaveDataIcon(u32 messagePointer) { - log("FS::ReadExtSaveDataIcon\n"); - const u8 mediaType = mem.read8(messagePointer + 4); - const u64 saveID = mem.read64(messagePointer + 8); // todo: <-- is this used? - const u32 smdhSize = mem.read32(messagePointer + 20); - const u32 smdhPointer = mem.read32(messagePointer + 28); - - ExtSaveDataArchive* selected = nullptr; - switch(mediaType) { - case MediaType::NAND: - selected = &sharedExtSaveData_nand; - break; - case MediaType::SD: - selected = &extSaveData_sdmc; - break; - default: - Helpers::warn("FS::ReadExtSaveDataIcon - Unhandled ExtSaveData MediaType %d", static_cast(mediaType)); - break; - } - - mem.write32(messagePointer, IPC::responseHeader(0x0853, 1, 0)); - - Rust::Result, HorizonResult> data = selected == nullptr ? Err(Result::FS::NotFoundInvalid) : selected->loadIcon(); - if (data.isErr() || smdhSize == 0 || smdhPointer == 0) { - mem.write32(messagePointer + 4, data.unwrapErr());; - mem.write32(messagePointer + 8, 0); - } else { - const std::vector buffer = data.unwrap>(); - const u32 copySize = std::min(smdhSize, static_cast(buffer.size())); - writePointer(buffer.data(), smdhPointer, copySize); - mem.write32(messagePointer + 4, Result::Success); - mem.write32(messagePointer + 8, copySize); - } -} - void FSService::formatThisUserSaveData(u32 messagePointer) { log("FS::FormatThisUserSaveData\n");