mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Sources: Run clang-format on everything.
This commit is contained in:
		
							parent
							
								
									fe948af095
								
							
						
					
					
						commit
						dc8479928c
					
				
					 386 changed files with 19560 additions and 18080 deletions
				
			
		| 
						 | 
				
			
			@ -3,9 +3,9 @@
 | 
			
		|||
// Refer to the license.txt file included.
 | 
			
		||||
 | 
			
		||||
#include <cstddef>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <system_error>
 | 
			
		||||
#include <type_traits>
 | 
			
		||||
#include <memory>
 | 
			
		||||
#include <unordered_map>
 | 
			
		||||
#include <utility>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -25,25 +25,25 @@
 | 
			
		|||
#include "core/file_sys/directory_backend.h"
 | 
			
		||||
#include "core/file_sys/file_backend.h"
 | 
			
		||||
#include "core/hle/hle.h"
 | 
			
		||||
#include "core/hle/service/service.h"
 | 
			
		||||
#include "core/hle/result.h"
 | 
			
		||||
#include "core/hle/service/fs/archive.h"
 | 
			
		||||
#include "core/hle/service/fs/fs_user.h"
 | 
			
		||||
#include "core/hle/result.h"
 | 
			
		||||
#include "core/hle/service/service.h"
 | 
			
		||||
#include "core/memory.h"
 | 
			
		||||
 | 
			
		||||
// Specializes std::hash for ArchiveIdCode, so that we can use it in std::unordered_map.
 | 
			
		||||
// Workaroung for libstdc++ bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970
 | 
			
		||||
namespace std {
 | 
			
		||||
    template <>
 | 
			
		||||
    struct hash<Service::FS::ArchiveIdCode> {
 | 
			
		||||
        typedef Service::FS::ArchiveIdCode argument_type;
 | 
			
		||||
        typedef std::size_t result_type;
 | 
			
		||||
template <>
 | 
			
		||||
struct hash<Service::FS::ArchiveIdCode> {
 | 
			
		||||
    typedef Service::FS::ArchiveIdCode argument_type;
 | 
			
		||||
    typedef std::size_t result_type;
 | 
			
		||||
 | 
			
		||||
        result_type operator()(const argument_type& id_code) const {
 | 
			
		||||
            typedef std::underlying_type<argument_type>::type Type;
 | 
			
		||||
            return std::hash<Type>()(static_cast<Type>(id_code));
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    result_type operator()(const argument_type& id_code) const {
 | 
			
		||||
        typedef std::underlying_type<argument_type>::type Type;
 | 
			
		||||
        return std::hash<Type>()(static_cast<Type>(id_code));
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// TODO(Subv): Confirm length of these strings
 | 
			
		||||
| 
						 | 
				
			
			@ -56,197 +56,193 @@ namespace FS {
 | 
			
		|||
// TODO: Verify code
 | 
			
		||||
/// Returned when a function is passed an invalid handle.
 | 
			
		||||
const ResultCode ERR_INVALID_HANDLE(ErrorDescription::InvalidHandle, ErrorModule::FS,
 | 
			
		||||
        ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
 | 
			
		||||
                                    ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
 | 
			
		||||
 | 
			
		||||
/// Returned when a function is passed an invalid archive handle.
 | 
			
		||||
const ResultCode ERR_INVALID_ARCHIVE_HANDLE(ErrorDescription::FS_ArchiveNotMounted, ErrorModule::FS,
 | 
			
		||||
    ErrorSummary::NotFound, ErrorLevel::Status); // 0xC8804465
 | 
			
		||||
                                            ErrorSummary::NotFound,
 | 
			
		||||
                                            ErrorLevel::Status); // 0xC8804465
 | 
			
		||||
 | 
			
		||||
// Command to access archive file
 | 
			
		||||
enum class FileCommand : u32 {
 | 
			
		||||
    Dummy1          = 0x000100C6,
 | 
			
		||||
    Control         = 0x040100C4,
 | 
			
		||||
    OpenSubFile     = 0x08010100,
 | 
			
		||||
    Read            = 0x080200C2,
 | 
			
		||||
    Write           = 0x08030102,
 | 
			
		||||
    GetSize         = 0x08040000,
 | 
			
		||||
    SetSize         = 0x08050080,
 | 
			
		||||
    GetAttributes   = 0x08060000,
 | 
			
		||||
    SetAttributes   = 0x08070040,
 | 
			
		||||
    Close           = 0x08080000,
 | 
			
		||||
    Flush           = 0x08090000,
 | 
			
		||||
    SetPriority     = 0x080A0040,
 | 
			
		||||
    GetPriority     = 0x080B0000,
 | 
			
		||||
    OpenLinkFile    = 0x080C0000,
 | 
			
		||||
    Dummy1 = 0x000100C6,
 | 
			
		||||
    Control = 0x040100C4,
 | 
			
		||||
    OpenSubFile = 0x08010100,
 | 
			
		||||
    Read = 0x080200C2,
 | 
			
		||||
    Write = 0x08030102,
 | 
			
		||||
    GetSize = 0x08040000,
 | 
			
		||||
    SetSize = 0x08050080,
 | 
			
		||||
    GetAttributes = 0x08060000,
 | 
			
		||||
    SetAttributes = 0x08070040,
 | 
			
		||||
    Close = 0x08080000,
 | 
			
		||||
    Flush = 0x08090000,
 | 
			
		||||
    SetPriority = 0x080A0040,
 | 
			
		||||
    GetPriority = 0x080B0000,
 | 
			
		||||
    OpenLinkFile = 0x080C0000,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Command to access directory
 | 
			
		||||
enum class DirectoryCommand : u32 {
 | 
			
		||||
    Dummy1          = 0x000100C6,
 | 
			
		||||
    Control         = 0x040100C4,
 | 
			
		||||
    Read            = 0x08010042,
 | 
			
		||||
    Close           = 0x08020000,
 | 
			
		||||
    Dummy1 = 0x000100C6,
 | 
			
		||||
    Control = 0x040100C4,
 | 
			
		||||
    Read = 0x08010042,
 | 
			
		||||
    Close = 0x08020000,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
File::File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path & path)
 | 
			
		||||
    : path(path), priority(0), backend(std::move(backend)) {}
 | 
			
		||||
File::File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path)
 | 
			
		||||
    : path(path), priority(0), backend(std::move(backend)) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
File::~File() {}
 | 
			
		||||
File::~File() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultVal<bool> File::SyncRequest() {
 | 
			
		||||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
    FileCommand cmd = static_cast<FileCommand>(cmd_buff[0]);
 | 
			
		||||
    switch (cmd) {
 | 
			
		||||
 | 
			
		||||
        // Read from file...
 | 
			
		||||
        case FileCommand::Read:
 | 
			
		||||
        {
 | 
			
		||||
            u64 offset = cmd_buff[1] | ((u64)cmd_buff[2]) << 32;
 | 
			
		||||
            u32 length = cmd_buff[3];
 | 
			
		||||
            u32 address = cmd_buff[5];
 | 
			
		||||
            LOG_TRACE(Service_FS, "Read %s %s: offset=0x%llx length=%d address=0x%x",
 | 
			
		||||
                      GetTypeName().c_str(), GetName().c_str(), offset, length, address);
 | 
			
		||||
    // Read from file...
 | 
			
		||||
    case FileCommand::Read: {
 | 
			
		||||
        u64 offset = cmd_buff[1] | ((u64)cmd_buff[2]) << 32;
 | 
			
		||||
        u32 length = cmd_buff[3];
 | 
			
		||||
        u32 address = cmd_buff[5];
 | 
			
		||||
        LOG_TRACE(Service_FS, "Read %s %s: offset=0x%llx length=%d address=0x%x",
 | 
			
		||||
                  GetTypeName().c_str(), GetName().c_str(), offset, length, address);
 | 
			
		||||
 | 
			
		||||
            if (offset + length > backend->GetSize()) {
 | 
			
		||||
                LOG_ERROR(Service_FS, "Reading from out of bounds offset=0x%llX length=0x%08X file_size=0x%llX",
 | 
			
		||||
                          offset, length, backend->GetSize());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            std::vector<u8> data(length);
 | 
			
		||||
            ResultVal<size_t> read = backend->Read(offset, data.size(), data.data());
 | 
			
		||||
            if (read.Failed()) {
 | 
			
		||||
                cmd_buff[1] = read.Code().raw;
 | 
			
		||||
                return read.Code();
 | 
			
		||||
            }
 | 
			
		||||
            Memory::WriteBlock(address, data.data(), *read);
 | 
			
		||||
            cmd_buff[2] = static_cast<u32>(*read);
 | 
			
		||||
            break;
 | 
			
		||||
        if (offset + length > backend->GetSize()) {
 | 
			
		||||
            LOG_ERROR(Service_FS,
 | 
			
		||||
                      "Reading from out of bounds offset=0x%llX length=0x%08X file_size=0x%llX",
 | 
			
		||||
                      offset, length, backend->GetSize());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Write to file...
 | 
			
		||||
        case FileCommand::Write:
 | 
			
		||||
        {
 | 
			
		||||
            u64 offset = cmd_buff[1] | ((u64)cmd_buff[2]) << 32;
 | 
			
		||||
            u32 length = cmd_buff[3];
 | 
			
		||||
            u32 flush = cmd_buff[4];
 | 
			
		||||
            u32 address = cmd_buff[6];
 | 
			
		||||
            LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
 | 
			
		||||
                      GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
 | 
			
		||||
 | 
			
		||||
            std::vector<u8> data(length);
 | 
			
		||||
            Memory::ReadBlock(address, data.data(), data.size());
 | 
			
		||||
            ResultVal<size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
 | 
			
		||||
            if (written.Failed()) {
 | 
			
		||||
                cmd_buff[1] = written.Code().raw;
 | 
			
		||||
                return written.Code();
 | 
			
		||||
            }
 | 
			
		||||
            cmd_buff[2] = static_cast<u32>(*written);
 | 
			
		||||
            break;
 | 
			
		||||
        std::vector<u8> data(length);
 | 
			
		||||
        ResultVal<size_t> read = backend->Read(offset, data.size(), data.data());
 | 
			
		||||
        if (read.Failed()) {
 | 
			
		||||
            cmd_buff[1] = read.Code().raw;
 | 
			
		||||
            return read.Code();
 | 
			
		||||
        }
 | 
			
		||||
        Memory::WriteBlock(address, data.data(), *read);
 | 
			
		||||
        cmd_buff[2] = static_cast<u32>(*read);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::GetSize:
 | 
			
		||||
        {
 | 
			
		||||
            LOG_TRACE(Service_FS, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str());
 | 
			
		||||
            u64 size = backend->GetSize();
 | 
			
		||||
            cmd_buff[2] = (u32)size;
 | 
			
		||||
            cmd_buff[3] = size >> 32;
 | 
			
		||||
            break;
 | 
			
		||||
    // Write to file...
 | 
			
		||||
    case FileCommand::Write: {
 | 
			
		||||
        u64 offset = cmd_buff[1] | ((u64)cmd_buff[2]) << 32;
 | 
			
		||||
        u32 length = cmd_buff[3];
 | 
			
		||||
        u32 flush = cmd_buff[4];
 | 
			
		||||
        u32 address = cmd_buff[6];
 | 
			
		||||
        LOG_TRACE(Service_FS, "Write %s %s: offset=0x%llx length=%d address=0x%x, flush=0x%x",
 | 
			
		||||
                  GetTypeName().c_str(), GetName().c_str(), offset, length, address, flush);
 | 
			
		||||
 | 
			
		||||
        std::vector<u8> data(length);
 | 
			
		||||
        Memory::ReadBlock(address, data.data(), data.size());
 | 
			
		||||
        ResultVal<size_t> written = backend->Write(offset, data.size(), flush != 0, data.data());
 | 
			
		||||
        if (written.Failed()) {
 | 
			
		||||
            cmd_buff[1] = written.Code().raw;
 | 
			
		||||
            return written.Code();
 | 
			
		||||
        }
 | 
			
		||||
        cmd_buff[2] = static_cast<u32>(*written);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::SetSize:
 | 
			
		||||
        {
 | 
			
		||||
            u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32);
 | 
			
		||||
            LOG_TRACE(Service_FS, "SetSize %s %s size=%llu",
 | 
			
		||||
                GetTypeName().c_str(), GetName().c_str(), size);
 | 
			
		||||
            backend->SetSize(size);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case FileCommand::GetSize: {
 | 
			
		||||
        LOG_TRACE(Service_FS, "GetSize %s %s", GetTypeName().c_str(), GetName().c_str());
 | 
			
		||||
        u64 size = backend->GetSize();
 | 
			
		||||
        cmd_buff[2] = (u32)size;
 | 
			
		||||
        cmd_buff[3] = size >> 32;
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::Close:
 | 
			
		||||
        {
 | 
			
		||||
            LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
 | 
			
		||||
            backend->Close();
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case FileCommand::SetSize: {
 | 
			
		||||
        u64 size = cmd_buff[1] | ((u64)cmd_buff[2] << 32);
 | 
			
		||||
        LOG_TRACE(Service_FS, "SetSize %s %s size=%llu", GetTypeName().c_str(), GetName().c_str(),
 | 
			
		||||
                  size);
 | 
			
		||||
        backend->SetSize(size);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::Flush:
 | 
			
		||||
        {
 | 
			
		||||
            LOG_TRACE(Service_FS, "Flush");
 | 
			
		||||
            backend->Flush();
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case FileCommand::Close: {
 | 
			
		||||
        LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
 | 
			
		||||
        backend->Close();
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::OpenLinkFile:
 | 
			
		||||
        {
 | 
			
		||||
            LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str());
 | 
			
		||||
            cmd_buff[3] = Kernel::g_handle_table.Create(this).ValueOr(INVALID_HANDLE);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case FileCommand::Flush: {
 | 
			
		||||
        LOG_TRACE(Service_FS, "Flush");
 | 
			
		||||
        backend->Flush();
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::SetPriority:
 | 
			
		||||
        {
 | 
			
		||||
            priority = cmd_buff[1];
 | 
			
		||||
            LOG_TRACE(Service_FS, "SetPriority %u", priority);
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case FileCommand::OpenLinkFile: {
 | 
			
		||||
        LOG_WARNING(Service_FS, "(STUBBED) File command OpenLinkFile %s", GetName().c_str());
 | 
			
		||||
        cmd_buff[3] = Kernel::g_handle_table.Create(this).ValueOr(INVALID_HANDLE);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case FileCommand::GetPriority:
 | 
			
		||||
        {
 | 
			
		||||
            cmd_buff[2] = priority;
 | 
			
		||||
            LOG_TRACE(Service_FS, "GetPriority");
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case FileCommand::SetPriority: {
 | 
			
		||||
        priority = cmd_buff[1];
 | 
			
		||||
        LOG_TRACE(Service_FS, "SetPriority %u", priority);
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        // Unknown command...
 | 
			
		||||
        default:
 | 
			
		||||
            LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
 | 
			
		||||
            ResultCode error = UnimplementedFunction(ErrorModule::FS);
 | 
			
		||||
            cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
 | 
			
		||||
            return error;
 | 
			
		||||
    case FileCommand::GetPriority: {
 | 
			
		||||
        cmd_buff[2] = priority;
 | 
			
		||||
        LOG_TRACE(Service_FS, "GetPriority");
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Unknown command...
 | 
			
		||||
    default:
 | 
			
		||||
        LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
 | 
			
		||||
        ResultCode error = UnimplementedFunction(ErrorModule::FS);
 | 
			
		||||
        cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
 | 
			
		||||
        return error;
 | 
			
		||||
    }
 | 
			
		||||
    cmd_buff[1] = RESULT_SUCCESS.raw; // No error
 | 
			
		||||
    return MakeResult<bool>(false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Directory::Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path & path)
 | 
			
		||||
    : path(path), backend(std::move(backend)) {}
 | 
			
		||||
Directory::Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend,
 | 
			
		||||
                     const FileSys::Path& path)
 | 
			
		||||
    : path(path), backend(std::move(backend)) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Directory::~Directory() {}
 | 
			
		||||
Directory::~Directory() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultVal<bool> Directory::SyncRequest() {
 | 
			
		||||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
    DirectoryCommand cmd = static_cast<DirectoryCommand>(cmd_buff[0]);
 | 
			
		||||
    switch (cmd) {
 | 
			
		||||
 | 
			
		||||
        // Read from directory...
 | 
			
		||||
        case DirectoryCommand::Read:
 | 
			
		||||
        {
 | 
			
		||||
            u32 count = cmd_buff[1];
 | 
			
		||||
            u32 address = cmd_buff[3];
 | 
			
		||||
            std::vector<FileSys::Entry> entries(count);
 | 
			
		||||
            LOG_TRACE(Service_FS, "Read %s %s: count=%d",
 | 
			
		||||
                GetTypeName().c_str(), GetName().c_str(), count);
 | 
			
		||||
    // Read from directory...
 | 
			
		||||
    case DirectoryCommand::Read: {
 | 
			
		||||
        u32 count = cmd_buff[1];
 | 
			
		||||
        u32 address = cmd_buff[3];
 | 
			
		||||
        std::vector<FileSys::Entry> entries(count);
 | 
			
		||||
        LOG_TRACE(Service_FS, "Read %s %s: count=%d", GetTypeName().c_str(), GetName().c_str(),
 | 
			
		||||
                  count);
 | 
			
		||||
 | 
			
		||||
            // Number of entries actually read
 | 
			
		||||
            u32 read = backend->Read(entries.size(), entries.data());
 | 
			
		||||
            cmd_buff[2] = read;
 | 
			
		||||
            Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry));
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
        // Number of entries actually read
 | 
			
		||||
        u32 read = backend->Read(entries.size(), entries.data());
 | 
			
		||||
        cmd_buff[2] = read;
 | 
			
		||||
        Memory::WriteBlock(address, entries.data(), read * sizeof(FileSys::Entry));
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        case DirectoryCommand::Close:
 | 
			
		||||
        {
 | 
			
		||||
            LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
 | 
			
		||||
            backend->Close();
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    case DirectoryCommand::Close: {
 | 
			
		||||
        LOG_TRACE(Service_FS, "Close %s %s", GetTypeName().c_str(), GetName().c_str());
 | 
			
		||||
        backend->Close();
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
        // Unknown command...
 | 
			
		||||
        default:
 | 
			
		||||
            LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
 | 
			
		||||
            ResultCode error = UnimplementedFunction(ErrorModule::FS);
 | 
			
		||||
            cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
 | 
			
		||||
            return MakeResult<bool>(false);
 | 
			
		||||
    // Unknown command...
 | 
			
		||||
    default:
 | 
			
		||||
        LOG_ERROR(Service_FS, "Unknown command=0x%08X!", cmd);
 | 
			
		||||
        ResultCode error = UnimplementedFunction(ErrorModule::FS);
 | 
			
		||||
        cmd_buff[1] = error.raw; // TODO(Link Mauve): use the correct error code for that.
 | 
			
		||||
        return MakeResult<bool>(false);
 | 
			
		||||
    }
 | 
			
		||||
    cmd_buff[1] = RESULT_SUCCESS.raw; // No error
 | 
			
		||||
    return MakeResult<bool>(false);
 | 
			
		||||
| 
						 | 
				
			
			@ -280,8 +276,8 @@ ResultVal<ArchiveHandle> OpenArchive(ArchiveIdCode id_code, FileSys::Path& archi
 | 
			
		|||
    auto itr = id_code_map.find(id_code);
 | 
			
		||||
    if (itr == id_code_map.end()) {
 | 
			
		||||
        // TODO: Verify error against hardware
 | 
			
		||||
        return ResultCode(ErrorDescription::NotFound, ErrorModule::FS,
 | 
			
		||||
                          ErrorSummary::NotFound, ErrorLevel::Permanent);
 | 
			
		||||
        return ResultCode(ErrorDescription::NotFound, ErrorModule::FS, ErrorSummary::NotFound,
 | 
			
		||||
                          ErrorLevel::Permanent);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CASCADE_RESULT(std::unique_ptr<ArchiveBackend> res, itr->second->Open(archive_path));
 | 
			
		||||
| 
						 | 
				
			
			@ -303,19 +299,22 @@ ResultCode CloseArchive(ArchiveHandle handle) {
 | 
			
		|||
 | 
			
		||||
// TODO(yuriks): This might be what the fs:REG service is for. See the Register/Unregister calls in
 | 
			
		||||
// http://3dbrew.org/wiki/Filesystem_services#ProgramRegistry_service_.22fs:REG.22
 | 
			
		||||
ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory, ArchiveIdCode id_code) {
 | 
			
		||||
ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory,
 | 
			
		||||
                               ArchiveIdCode id_code) {
 | 
			
		||||
    auto result = id_code_map.emplace(id_code, std::move(factory));
 | 
			
		||||
 | 
			
		||||
    bool inserted = result.second;
 | 
			
		||||
    ASSERT_MSG(inserted, "Tried to register more than one archive with same id code");
 | 
			
		||||
 | 
			
		||||
    auto& archive = result.first->second;
 | 
			
		||||
    LOG_DEBUG(Service_FS, "Registered archive %s with id code 0x%08X", archive->GetName().c_str(), id_code);
 | 
			
		||||
    LOG_DEBUG(Service_FS, "Registered archive %s with id code 0x%08X", archive->GetName().c_str(),
 | 
			
		||||
              id_code);
 | 
			
		||||
    return RESULT_SUCCESS;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultVal<Kernel::SharedPtr<File>> OpenFileFromArchive(ArchiveHandle archive_handle,
 | 
			
		||||
        const FileSys::Path& path, const FileSys::Mode mode) {
 | 
			
		||||
                                                       const FileSys::Path& path,
 | 
			
		||||
                                                       const FileSys::Mode mode) {
 | 
			
		||||
    ArchiveBackend* archive = GetArchive(archive_handle);
 | 
			
		||||
    if (archive == nullptr)
 | 
			
		||||
        return ERR_INVALID_ARCHIVE_HANDLE;
 | 
			
		||||
| 
						 | 
				
			
			@ -336,8 +335,10 @@ ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Pa
 | 
			
		|||
    return archive->DeleteFile(path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, const FileSys::Path& src_path,
 | 
			
		||||
                                     ArchiveHandle dest_archive_handle, const FileSys::Path& dest_path) {
 | 
			
		||||
ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
 | 
			
		||||
                                     const FileSys::Path& src_path,
 | 
			
		||||
                                     ArchiveHandle dest_archive_handle,
 | 
			
		||||
                                     const FileSys::Path& dest_path) {
 | 
			
		||||
    ArchiveBackend* src_archive = GetArchive(src_archive_handle);
 | 
			
		||||
    ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
 | 
			
		||||
    if (src_archive == nullptr || dest_archive == nullptr)
 | 
			
		||||
| 
						 | 
				
			
			@ -368,7 +369,8 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
 | 
			
		|||
                      ErrorSummary::Canceled, ErrorLevel::Status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u64 file_size) {
 | 
			
		||||
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
 | 
			
		||||
                               u64 file_size) {
 | 
			
		||||
    ArchiveBackend* archive = GetArchive(archive_handle);
 | 
			
		||||
    if (archive == nullptr)
 | 
			
		||||
        return ERR_INVALID_ARCHIVE_HANDLE;
 | 
			
		||||
| 
						 | 
				
			
			@ -387,8 +389,10 @@ ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
 | 
			
		|||
                      ErrorSummary::Canceled, ErrorLevel::Status);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, const FileSys::Path& src_path,
 | 
			
		||||
                                          ArchiveHandle dest_archive_handle, const FileSys::Path& dest_path) {
 | 
			
		||||
ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
 | 
			
		||||
                                          const FileSys::Path& src_path,
 | 
			
		||||
                                          ArchiveHandle dest_archive_handle,
 | 
			
		||||
                                          const FileSys::Path& dest_path) {
 | 
			
		||||
    ArchiveBackend* src_archive = GetArchive(src_archive_handle);
 | 
			
		||||
    ArchiveBackend* dest_archive = GetArchive(dest_archive_handle);
 | 
			
		||||
    if (src_archive == nullptr || dest_archive == nullptr)
 | 
			
		||||
| 
						 | 
				
			
			@ -409,15 +413,15 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, cons
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle archive_handle,
 | 
			
		||||
        const FileSys::Path& path) {
 | 
			
		||||
                                                                 const FileSys::Path& path) {
 | 
			
		||||
    ArchiveBackend* archive = GetArchive(archive_handle);
 | 
			
		||||
    if (archive == nullptr)
 | 
			
		||||
        return ERR_INVALID_ARCHIVE_HANDLE;
 | 
			
		||||
 | 
			
		||||
    std::unique_ptr<FileSys::DirectoryBackend> backend = archive->OpenDirectory(path);
 | 
			
		||||
    if (backend == nullptr) {
 | 
			
		||||
        return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS,
 | 
			
		||||
                          ErrorSummary::NotFound, ErrorLevel::Permanent);
 | 
			
		||||
        return ResultCode(ErrorDescription::FS_NotFound, ErrorModule::FS, ErrorSummary::NotFound,
 | 
			
		||||
                          ErrorLevel::Permanent);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    auto directory = Kernel::SharedPtr<Directory>(new Directory(std::move(backend), path));
 | 
			
		||||
| 
						 | 
				
			
			@ -431,7 +435,8 @@ ResultVal<u64> GetFreeBytesInArchive(ArchiveHandle archive_handle) {
 | 
			
		|||
    return MakeResult<u64>(archive->GetFreeBytes());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo& format_info, const FileSys::Path& path) {
 | 
			
		||||
ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo& format_info,
 | 
			
		||||
                         const FileSys::Path& path) {
 | 
			
		||||
    auto archive_itr = id_code_map.find(id_code);
 | 
			
		||||
    if (archive_itr == id_code_map.end()) {
 | 
			
		||||
        return UnimplementedFunction(ErrorModule::FS); // TODO(Subv): Find the right error
 | 
			
		||||
| 
						 | 
				
			
			@ -440,7 +445,8 @@ ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo
 | 
			
		|||
    return archive_itr->second->Format(path, format_info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultVal<FileSys::ArchiveFormatInfo> GetArchiveFormatInfo(ArchiveIdCode id_code, FileSys::Path& archive_path) {
 | 
			
		||||
ResultVal<FileSys::ArchiveFormatInfo> GetArchiveFormatInfo(ArchiveIdCode id_code,
 | 
			
		||||
                                                           FileSys::Path& archive_path) {
 | 
			
		||||
    auto archive = id_code_map.find(id_code);
 | 
			
		||||
    if (archive == id_code_map.end()) {
 | 
			
		||||
        return UnimplementedFunction(ErrorModule::FS); // TODO(Subv): Find the right error
 | 
			
		||||
| 
						 | 
				
			
			@ -449,11 +455,14 @@ ResultVal<FileSys::ArchiveFormatInfo> GetArchiveFormatInfo(ArchiveIdCode id_code
 | 
			
		|||
    return archive->second->GetFormatInfo(archive_path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon_buffer, u32 icon_size, const FileSys::ArchiveFormatInfo& format_info) {
 | 
			
		||||
ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon_buffer,
 | 
			
		||||
                             u32 icon_size, const FileSys::ArchiveFormatInfo& format_info) {
 | 
			
		||||
    // Construct the binary path to the archive first
 | 
			
		||||
    FileSys::Path path = FileSys::ConstructExtDataBinaryPath(static_cast<u32>(media_type), high, low);
 | 
			
		||||
    FileSys::Path path =
 | 
			
		||||
        FileSys::ConstructExtDataBinaryPath(static_cast<u32>(media_type), high, low);
 | 
			
		||||
 | 
			
		||||
    auto archive = id_code_map.find(media_type == MediaType::NAND ? ArchiveIdCode::SharedExtSaveData : ArchiveIdCode::ExtSaveData);
 | 
			
		||||
    auto archive = id_code_map.find(media_type == MediaType::NAND ? ArchiveIdCode::SharedExtSaveData
 | 
			
		||||
                                                                  : ArchiveIdCode::ExtSaveData);
 | 
			
		||||
 | 
			
		||||
    if (archive == id_code_map.end()) {
 | 
			
		||||
        return UnimplementedFunction(ErrorModule::FS); // TODO(Subv): Find the right error
 | 
			
		||||
| 
						 | 
				
			
			@ -476,7 +485,8 @@ ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon
 | 
			
		|||
 | 
			
		||||
ResultCode DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
 | 
			
		||||
    // Construct the binary path to the archive first
 | 
			
		||||
    FileSys::Path path = FileSys::ConstructExtDataBinaryPath(static_cast<u32>(media_type), high, low);
 | 
			
		||||
    FileSys::Path path =
 | 
			
		||||
        FileSys::ConstructExtDataBinaryPath(static_cast<u32>(media_type), high, low);
 | 
			
		||||
 | 
			
		||||
    std::string media_type_directory;
 | 
			
		||||
    if (media_type == MediaType::NAND) {
 | 
			
		||||
| 
						 | 
				
			
			@ -489,7 +499,8 @@ ResultCode DeleteExtSaveData(MediaType media_type, u32 high, u32 low) {
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    // Delete all directories (/user, /boss) and the icon file.
 | 
			
		||||
    std::string base_path = FileSys::GetExtDataContainerPath(media_type_directory, media_type == MediaType::NAND);
 | 
			
		||||
    std::string base_path =
 | 
			
		||||
        FileSys::GetExtDataContainerPath(media_type_directory, media_type == MediaType::NAND);
 | 
			
		||||
    std::string extsavedata_path = FileSys::GetExtSaveDataPath(base_path, path);
 | 
			
		||||
    if (FileUtil::Exists(extsavedata_path) && !FileUtil::DeleteDirRecursively(extsavedata_path))
 | 
			
		||||
        return ResultCode(-1); // TODO(Subv): Find the right error code
 | 
			
		||||
| 
						 | 
				
			
			@ -530,30 +541,36 @@ void RegisterArchiveTypes() {
 | 
			
		|||
    if (sdmc_factory->Initialize())
 | 
			
		||||
        RegisterArchiveType(std::move(sdmc_factory), ArchiveIdCode::SDMC);
 | 
			
		||||
    else
 | 
			
		||||
        LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
 | 
			
		||||
        LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s",
 | 
			
		||||
                  sdmc_directory.c_str());
 | 
			
		||||
 | 
			
		||||
    // Create the SaveData archive
 | 
			
		||||
    auto savedata_factory = std::make_unique<FileSys::ArchiveFactory_SaveData>(sdmc_directory);
 | 
			
		||||
    RegisterArchiveType(std::move(savedata_factory), ArchiveIdCode::SaveData);
 | 
			
		||||
 | 
			
		||||
    auto extsavedata_factory = std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(sdmc_directory, false);
 | 
			
		||||
    auto extsavedata_factory =
 | 
			
		||||
        std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(sdmc_directory, false);
 | 
			
		||||
    if (extsavedata_factory->Initialize())
 | 
			
		||||
        RegisterArchiveType(std::move(extsavedata_factory), ArchiveIdCode::ExtSaveData);
 | 
			
		||||
    else
 | 
			
		||||
        LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s", extsavedata_factory->GetMountPoint().c_str());
 | 
			
		||||
        LOG_ERROR(Service_FS, "Can't instantiate ExtSaveData archive with path %s",
 | 
			
		||||
                  extsavedata_factory->GetMountPoint().c_str());
 | 
			
		||||
 | 
			
		||||
    auto sharedextsavedata_factory = std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true);
 | 
			
		||||
    auto sharedextsavedata_factory =
 | 
			
		||||
        std::make_unique<FileSys::ArchiveFactory_ExtSaveData>(nand_directory, true);
 | 
			
		||||
    if (sharedextsavedata_factory->Initialize())
 | 
			
		||||
        RegisterArchiveType(std::move(sharedextsavedata_factory), ArchiveIdCode::SharedExtSaveData);
 | 
			
		||||
    else
 | 
			
		||||
        LOG_ERROR(Service_FS, "Can't instantiate SharedExtSaveData archive with path %s",
 | 
			
		||||
            sharedextsavedata_factory->GetMountPoint().c_str());
 | 
			
		||||
                  sharedextsavedata_factory->GetMountPoint().c_str());
 | 
			
		||||
 | 
			
		||||
    // Create the SaveDataCheck archive, basically a small variation of the RomFS archive
 | 
			
		||||
    auto savedatacheck_factory = std::make_unique<FileSys::ArchiveFactory_SaveDataCheck>(nand_directory);
 | 
			
		||||
    auto savedatacheck_factory =
 | 
			
		||||
        std::make_unique<FileSys::ArchiveFactory_SaveDataCheck>(nand_directory);
 | 
			
		||||
    RegisterArchiveType(std::move(savedatacheck_factory), ArchiveIdCode::SaveDataCheck);
 | 
			
		||||
 | 
			
		||||
    auto systemsavedata_factory = std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory);
 | 
			
		||||
    auto systemsavedata_factory =
 | 
			
		||||
        std::make_unique<FileSys::ArchiveFactory_SystemSaveData>(nand_directory);
 | 
			
		||||
    RegisterArchiveType(std::move(systemsavedata_factory), ArchiveIdCode::SystemSaveData);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,21 +28,18 @@ namespace FS {
 | 
			
		|||
 | 
			
		||||
/// Supported archive types
 | 
			
		||||
enum class ArchiveIdCode : u32 {
 | 
			
		||||
    RomFS               = 0x00000003,
 | 
			
		||||
    SaveData            = 0x00000004,
 | 
			
		||||
    ExtSaveData         = 0x00000006,
 | 
			
		||||
    SharedExtSaveData   = 0x00000007,
 | 
			
		||||
    SystemSaveData      = 0x00000008,
 | 
			
		||||
    SDMC                = 0x00000009,
 | 
			
		||||
    SDMCWriteOnly       = 0x0000000A,
 | 
			
		||||
    SaveDataCheck       = 0x2345678A,
 | 
			
		||||
    RomFS = 0x00000003,
 | 
			
		||||
    SaveData = 0x00000004,
 | 
			
		||||
    ExtSaveData = 0x00000006,
 | 
			
		||||
    SharedExtSaveData = 0x00000007,
 | 
			
		||||
    SystemSaveData = 0x00000008,
 | 
			
		||||
    SDMC = 0x00000009,
 | 
			
		||||
    SDMCWriteOnly = 0x0000000A,
 | 
			
		||||
    SaveDataCheck = 0x2345678A,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/// Media types for the archives
 | 
			
		||||
enum class MediaType : u32 {
 | 
			
		||||
    NAND     = 0,
 | 
			
		||||
    SDMC     = 1
 | 
			
		||||
};
 | 
			
		||||
enum class MediaType : u32 { NAND = 0, SDMC = 1 };
 | 
			
		||||
 | 
			
		||||
typedef u64 ArchiveHandle;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -51,11 +48,13 @@ public:
 | 
			
		|||
    File(std::unique_ptr<FileSys::FileBackend>&& backend, const FileSys::Path& path);
 | 
			
		||||
    ~File();
 | 
			
		||||
 | 
			
		||||
    std::string GetName() const override { return "Path: " + path.DebugStr(); }
 | 
			
		||||
    std::string GetName() const override {
 | 
			
		||||
        return "Path: " + path.DebugStr();
 | 
			
		||||
    }
 | 
			
		||||
    ResultVal<bool> SyncRequest() override;
 | 
			
		||||
 | 
			
		||||
    FileSys::Path path; ///< Path of the file
 | 
			
		||||
    u32 priority; ///< Priority of the file. TODO(Subv): Find out what this means
 | 
			
		||||
    u32 priority;       ///< Priority of the file. TODO(Subv): Find out what this means
 | 
			
		||||
    std::unique_ptr<FileSys::FileBackend> backend; ///< File backend interface
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -64,10 +63,12 @@ public:
 | 
			
		|||
    Directory(std::unique_ptr<FileSys::DirectoryBackend>&& backend, const FileSys::Path& path);
 | 
			
		||||
    ~Directory();
 | 
			
		||||
 | 
			
		||||
    std::string GetName() const override { return "Directory: " + path.DebugStr(); }
 | 
			
		||||
    std::string GetName() const override {
 | 
			
		||||
        return "Directory: " + path.DebugStr();
 | 
			
		||||
    }
 | 
			
		||||
    ResultVal<bool> SyncRequest() override;
 | 
			
		||||
 | 
			
		||||
    FileSys::Path path; ///< Path of the directory
 | 
			
		||||
    FileSys::Path path;                                 ///< Path of the directory
 | 
			
		||||
    std::unique_ptr<FileSys::DirectoryBackend> backend; ///< File backend interface
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -90,7 +91,8 @@ ResultCode CloseArchive(ArchiveHandle handle);
 | 
			
		|||
 * @param factory File system backend interface to the archive
 | 
			
		||||
 * @param id_code Id code used to access this type of archive
 | 
			
		||||
 */
 | 
			
		||||
ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory, ArchiveIdCode id_code);
 | 
			
		||||
ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factory,
 | 
			
		||||
                               ArchiveIdCode id_code);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Open a File from an Archive
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +102,8 @@ ResultCode RegisterArchiveType(std::unique_ptr<FileSys::ArchiveFactory>&& factor
 | 
			
		|||
 * @return The opened File object as a Session
 | 
			
		||||
 */
 | 
			
		||||
ResultVal<Kernel::SharedPtr<File>> OpenFileFromArchive(ArchiveHandle archive_handle,
 | 
			
		||||
        const FileSys::Path& path, const FileSys::Mode mode);
 | 
			
		||||
                                                       const FileSys::Path& path,
 | 
			
		||||
                                                       const FileSys::Mode mode);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a File from an Archive
 | 
			
		||||
| 
						 | 
				
			
			@ -118,8 +121,10 @@ ResultCode DeleteFileFromArchive(ArchiveHandle archive_handle, const FileSys::Pa
 | 
			
		|||
 * @param dest_path Path to the File inside of the destination Archive
 | 
			
		||||
 * @return Whether rename succeeded
 | 
			
		||||
 */
 | 
			
		||||
ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle, const FileSys::Path& src_path,
 | 
			
		||||
                                     ArchiveHandle dest_archive_handle, const FileSys::Path& dest_path);
 | 
			
		||||
ResultCode RenameFileBetweenArchives(ArchiveHandle src_archive_handle,
 | 
			
		||||
                                     const FileSys::Path& src_path,
 | 
			
		||||
                                     ArchiveHandle dest_archive_handle,
 | 
			
		||||
                                     const FileSys::Path& dest_path);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a Directory from an Archive
 | 
			
		||||
| 
						 | 
				
			
			@ -136,7 +141,8 @@ ResultCode DeleteDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
 | 
			
		|||
 * @param file_size The size of the new file, filled with zeroes
 | 
			
		||||
 * @return File creation result code
 | 
			
		||||
 */
 | 
			
		||||
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path, u64 file_size);
 | 
			
		||||
ResultCode CreateFileInArchive(ArchiveHandle archive_handle, const FileSys::Path& path,
 | 
			
		||||
                               u64 file_size);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Create a Directory from an Archive
 | 
			
		||||
| 
						 | 
				
			
			@ -154,8 +160,10 @@ ResultCode CreateDirectoryFromArchive(ArchiveHandle archive_handle, const FileSy
 | 
			
		|||
 * @param dest_path Path to the Directory inside of the destination Archive
 | 
			
		||||
 * @return Whether rename succeeded
 | 
			
		||||
 */
 | 
			
		||||
ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, const FileSys::Path& src_path,
 | 
			
		||||
                                          ArchiveHandle dest_archive_handle, const FileSys::Path& dest_path);
 | 
			
		||||
ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle,
 | 
			
		||||
                                          const FileSys::Path& src_path,
 | 
			
		||||
                                          ArchiveHandle dest_archive_handle,
 | 
			
		||||
                                          const FileSys::Path& dest_path);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Open a Directory from an Archive
 | 
			
		||||
| 
						 | 
				
			
			@ -164,7 +172,7 @@ ResultCode RenameDirectoryBetweenArchives(ArchiveHandle src_archive_handle, cons
 | 
			
		|||
 * @return The opened Directory object as a Session
 | 
			
		||||
 */
 | 
			
		||||
ResultVal<Kernel::SharedPtr<Directory>> OpenDirectoryFromArchive(ArchiveHandle archive_handle,
 | 
			
		||||
        const FileSys::Path& path);
 | 
			
		||||
                                                                 const FileSys::Path& path);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get the free space in an Archive
 | 
			
		||||
| 
						 | 
				
			
			@ -181,7 +189,8 @@ ResultVal<u64> GetFreeBytesInArchive(ArchiveHandle archive_handle);
 | 
			
		|||
 * @param path The path to the archive, if relevant.
 | 
			
		||||
 * @return ResultCode 0 on success or the corresponding code on error
 | 
			
		||||
 */
 | 
			
		||||
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.
 | 
			
		||||
| 
						 | 
				
			
			@ -190,7 +199,8 @@ ResultCode FormatArchive(ArchiveIdCode id_code, const FileSys::ArchiveFormatInfo
 | 
			
		|||
 * @param archive_path The path of the archive, if relevant
 | 
			
		||||
 * @return The format info of the archive, or the corresponding error code if failed.
 | 
			
		||||
 */
 | 
			
		||||
ResultVal<FileSys::ArchiveFormatInfo> GetArchiveFormatInfo(ArchiveIdCode id_code, FileSys::Path& archive_path);
 | 
			
		||||
ResultVal<FileSys::ArchiveFormatInfo> GetArchiveFormatInfo(ArchiveIdCode id_code,
 | 
			
		||||
                                                           FileSys::Path& archive_path);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Creates a blank SharedExtSaveData archive for the specified extdata ID
 | 
			
		||||
| 
						 | 
				
			
			@ -202,7 +212,8 @@ ResultVal<FileSys::ArchiveFormatInfo> GetArchiveFormatInfo(ArchiveIdCode id_code
 | 
			
		|||
 * @param format_info Format information about the new archive
 | 
			
		||||
 * @return ResultCode 0 on success or the corresponding code on error
 | 
			
		||||
 */
 | 
			
		||||
ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon_buffer, u32 icon_size, const FileSys::ArchiveFormatInfo& format_info);
 | 
			
		||||
ResultCode CreateExtSaveData(MediaType media_type, u32 high, u32 low, VAddr icon_buffer,
 | 
			
		||||
                             u32 icon_size, const FileSys::ArchiveFormatInfo& format_info);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Deletes the SharedExtSaveData archive for the specified extdata ID
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,14 +57,16 @@ static void OpenFile(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
 | 
			
		||||
    auto filename_type    = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 filename_size     = cmd_buff[5];
 | 
			
		||||
    FileSys::Mode mode; mode.hex = cmd_buff[6];
 | 
			
		||||
    u32 attributes        = cmd_buff[7]; // TODO(Link Mauve): do something with those attributes.
 | 
			
		||||
    u32 filename_ptr      = cmd_buff[9];
 | 
			
		||||
    auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 filename_size = cmd_buff[5];
 | 
			
		||||
    FileSys::Mode mode;
 | 
			
		||||
    mode.hex = cmd_buff[6];
 | 
			
		||||
    u32 attributes = cmd_buff[7]; // TODO(Link Mauve): do something with those attributes.
 | 
			
		||||
    u32 filename_ptr = cmd_buff[9];
 | 
			
		||||
    FileSys::Path file_path(filename_type, filename_size, filename_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex, attributes);
 | 
			
		||||
    LOG_DEBUG(Service_FS, "path=%s, mode=%d attrs=%u", file_path.DebugStr().c_str(), mode.hex,
 | 
			
		||||
              attributes);
 | 
			
		||||
 | 
			
		||||
    ResultVal<SharedPtr<File>> file_res = OpenFileFromArchive(archive_handle, file_path, mode);
 | 
			
		||||
    cmd_buff[1] = file_res.Code().raw;
 | 
			
		||||
| 
						 | 
				
			
			@ -98,24 +100,27 @@ static void OpenFile(Service::Interface* self) {
 | 
			
		|||
static void OpenFileDirectly(Service::Interface* self) {
 | 
			
		||||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    auto archive_id       = static_cast<FS::ArchiveIdCode>(cmd_buff[2]);
 | 
			
		||||
    auto archive_id = static_cast<FS::ArchiveIdCode>(cmd_buff[2]);
 | 
			
		||||
    auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[3]);
 | 
			
		||||
    u32 archivename_size  = cmd_buff[4];
 | 
			
		||||
    auto filename_type    = static_cast<FileSys::LowPathType>(cmd_buff[5]);
 | 
			
		||||
    u32 filename_size     = cmd_buff[6];
 | 
			
		||||
    FileSys::Mode mode; mode.hex = cmd_buff[7];
 | 
			
		||||
    u32 attributes        = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes.
 | 
			
		||||
    u32 archivename_ptr   = cmd_buff[10];
 | 
			
		||||
    u32 filename_ptr      = cmd_buff[12];
 | 
			
		||||
    u32 archivename_size = cmd_buff[4];
 | 
			
		||||
    auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[5]);
 | 
			
		||||
    u32 filename_size = cmd_buff[6];
 | 
			
		||||
    FileSys::Mode mode;
 | 
			
		||||
    mode.hex = cmd_buff[7];
 | 
			
		||||
    u32 attributes = cmd_buff[8]; // TODO(Link Mauve): do something with those attributes.
 | 
			
		||||
    u32 archivename_ptr = cmd_buff[10];
 | 
			
		||||
    u32 filename_ptr = cmd_buff[12];
 | 
			
		||||
    FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
 | 
			
		||||
    FileSys::Path file_path(filename_type, filename_size, filename_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s file_path=%s, mode=%u attributes=%d",
 | 
			
		||||
              archive_id, archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex, attributes);
 | 
			
		||||
              archive_id, archive_path.DebugStr().c_str(), file_path.DebugStr().c_str(), mode.hex,
 | 
			
		||||
              attributes);
 | 
			
		||||
 | 
			
		||||
    ResultVal<ArchiveHandle> archive_handle = OpenArchive(archive_id, archive_path);
 | 
			
		||||
    if (archive_handle.Failed()) {
 | 
			
		||||
        LOG_ERROR(Service_FS, "failed to get a handle for archive archive_id=0x%08X archive_path=%s",
 | 
			
		||||
        LOG_ERROR(Service_FS,
 | 
			
		||||
                  "failed to get a handle for archive archive_id=0x%08X archive_path=%s",
 | 
			
		||||
                  archive_id, archive_path.DebugStr().c_str());
 | 
			
		||||
        cmd_buff[1] = archive_handle.Code().raw;
 | 
			
		||||
        cmd_buff[3] = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -149,14 +154,14 @@ static void DeleteFile(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
 | 
			
		||||
    auto filename_type    = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 filename_size     = cmd_buff[5];
 | 
			
		||||
    u32 filename_ptr      = cmd_buff[7];
 | 
			
		||||
    auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 filename_size = cmd_buff[5];
 | 
			
		||||
    u32 filename_ptr = cmd_buff[7];
 | 
			
		||||
 | 
			
		||||
    FileSys::Path file_path(filename_type, filename_size, filename_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
 | 
			
		||||
              filename_type, filename_size, file_path.DebugStr().c_str());
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", filename_type, filename_size,
 | 
			
		||||
              file_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = DeleteFileFromArchive(archive_handle, file_path).raw;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -181,22 +186,26 @@ static void RenameFile(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    ArchiveHandle src_archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
 | 
			
		||||
    auto src_filename_type     = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 src_filename_size      = cmd_buff[5];
 | 
			
		||||
    ArchiveHandle dest_archive_handle = MakeArchiveHandle(cmd_buff[6], cmd_buff[7]);;
 | 
			
		||||
    auto dest_filename_type    = static_cast<FileSys::LowPathType>(cmd_buff[8]);
 | 
			
		||||
    u32 dest_filename_size     = cmd_buff[9];
 | 
			
		||||
    u32 src_filename_ptr       = cmd_buff[11];
 | 
			
		||||
    u32 dest_filename_ptr      = cmd_buff[13];
 | 
			
		||||
    auto src_filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 src_filename_size = cmd_buff[5];
 | 
			
		||||
    ArchiveHandle dest_archive_handle = MakeArchiveHandle(cmd_buff[6], cmd_buff[7]);
 | 
			
		||||
    ;
 | 
			
		||||
    auto dest_filename_type = static_cast<FileSys::LowPathType>(cmd_buff[8]);
 | 
			
		||||
    u32 dest_filename_size = cmd_buff[9];
 | 
			
		||||
    u32 src_filename_ptr = cmd_buff[11];
 | 
			
		||||
    u32 dest_filename_ptr = cmd_buff[13];
 | 
			
		||||
 | 
			
		||||
    FileSys::Path src_file_path(src_filename_type, src_filename_size, src_filename_ptr);
 | 
			
		||||
    FileSys::Path dest_file_path(dest_filename_type, dest_filename_size, dest_filename_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
 | 
			
		||||
    LOG_DEBUG(Service_FS,
 | 
			
		||||
              "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
 | 
			
		||||
              src_filename_type, src_filename_size, src_file_path.DebugStr().c_str(),
 | 
			
		||||
              dest_filename_type, dest_filename_size, dest_file_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle, dest_file_path).raw;
 | 
			
		||||
    cmd_buff[1] = RenameFileBetweenArchives(src_archive_handle, src_file_path, dest_archive_handle,
 | 
			
		||||
                                            dest_file_path)
 | 
			
		||||
                      .raw;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			@ -214,14 +223,14 @@ static void DeleteDirectory(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
 | 
			
		||||
    auto dirname_type     = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 dirname_size      = cmd_buff[5];
 | 
			
		||||
    u32 dirname_ptr       = cmd_buff[7];
 | 
			
		||||
    auto dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 dirname_size = cmd_buff[5];
 | 
			
		||||
    u32 dirname_ptr = cmd_buff[7];
 | 
			
		||||
 | 
			
		||||
    FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s",
 | 
			
		||||
              dirname_type, dirname_size, dir_path.DebugStr().c_str());
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
 | 
			
		||||
              dir_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = DeleteDirectoryFromArchive(archive_handle, dir_path).raw;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -243,14 +252,15 @@ static void CreateFile(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    ArchiveHandle archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
 | 
			
		||||
    auto filename_type    = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 filename_size     = cmd_buff[5];
 | 
			
		||||
    u64 file_size         = ((u64)cmd_buff[8] << 32) | cmd_buff[7];
 | 
			
		||||
    u32 filename_ptr      = cmd_buff[10];
 | 
			
		||||
    auto filename_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 filename_size = cmd_buff[5];
 | 
			
		||||
    u64 file_size = ((u64)cmd_buff[8] << 32) | cmd_buff[7];
 | 
			
		||||
    u32 filename_ptr = cmd_buff[10];
 | 
			
		||||
 | 
			
		||||
    FileSys::Path file_path(filename_type, filename_size, filename_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%llu data=%s", filename_type, file_size, file_path.DebugStr().c_str());
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%llu data=%s", filename_type, file_size,
 | 
			
		||||
              file_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = CreateFileInArchive(archive_handle, file_path, file_size).raw;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -276,7 +286,8 @@ static void CreateDirectory(Service::Interface* self) {
 | 
			
		|||
 | 
			
		||||
    FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
 | 
			
		||||
              dir_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = CreateDirectoryFromArchive(archive_handle, dir_path).raw;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -301,22 +312,25 @@ static void RenameDirectory(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    ArchiveHandle src_archive_handle = MakeArchiveHandle(cmd_buff[2], cmd_buff[3]);
 | 
			
		||||
    auto src_dirname_type      = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 src_dirname_size       = cmd_buff[5];
 | 
			
		||||
    auto src_dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[4]);
 | 
			
		||||
    u32 src_dirname_size = cmd_buff[5];
 | 
			
		||||
    ArchiveHandle dest_archive_handle = MakeArchiveHandle(cmd_buff[6], cmd_buff[7]);
 | 
			
		||||
    auto dest_dirname_type     = static_cast<FileSys::LowPathType>(cmd_buff[8]);
 | 
			
		||||
    u32 dest_dirname_size      = cmd_buff[9];
 | 
			
		||||
    u32 src_dirname_ptr        = cmd_buff[11];
 | 
			
		||||
    u32 dest_dirname_ptr       = cmd_buff[13];
 | 
			
		||||
    auto dest_dirname_type = static_cast<FileSys::LowPathType>(cmd_buff[8]);
 | 
			
		||||
    u32 dest_dirname_size = cmd_buff[9];
 | 
			
		||||
    u32 src_dirname_ptr = cmd_buff[11];
 | 
			
		||||
    u32 dest_dirname_ptr = cmd_buff[13];
 | 
			
		||||
 | 
			
		||||
    FileSys::Path src_dir_path(src_dirname_type, src_dirname_size, src_dirname_ptr);
 | 
			
		||||
    FileSys::Path dest_dir_path(dest_dirname_type, dest_dirname_size, dest_dirname_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
 | 
			
		||||
    LOG_DEBUG(Service_FS,
 | 
			
		||||
              "src_type=%d src_size=%d src_data=%s dest_type=%d dest_size=%d dest_data=%s",
 | 
			
		||||
              src_dirname_type, src_dirname_size, src_dir_path.DebugStr().c_str(),
 | 
			
		||||
              dest_dirname_type, dest_dirname_size, dest_dir_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path, dest_archive_handle, dest_dir_path).raw;
 | 
			
		||||
    cmd_buff[1] = RenameDirectoryBetweenArchives(src_archive_handle, src_dir_path,
 | 
			
		||||
                                                 dest_archive_handle, dest_dir_path)
 | 
			
		||||
                      .raw;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -342,7 +356,8 @@ static void OpenDirectory(Service::Interface* self) {
 | 
			
		|||
 | 
			
		||||
    FileSys::Path dir_path(dirname_type, dirname_size, dirname_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size, dir_path.DebugStr().c_str());
 | 
			
		||||
    LOG_DEBUG(Service_FS, "type=%d size=%d data=%s", dirname_type, dirname_size,
 | 
			
		||||
              dir_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    ResultVal<SharedPtr<Directory>> dir_res = OpenDirectoryFromArchive(archive_handle, dir_path);
 | 
			
		||||
    cmd_buff[1] = dir_res.Code().raw;
 | 
			
		||||
| 
						 | 
				
			
			@ -370,13 +385,14 @@ static void OpenDirectory(Service::Interface* self) {
 | 
			
		|||
static void OpenArchive(Service::Interface* self) {
 | 
			
		||||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
 | 
			
		||||
    auto archive_id       = static_cast<FS::ArchiveIdCode>(cmd_buff[1]);
 | 
			
		||||
    auto archive_id = static_cast<FS::ArchiveIdCode>(cmd_buff[1]);
 | 
			
		||||
    auto archivename_type = static_cast<FileSys::LowPathType>(cmd_buff[2]);
 | 
			
		||||
    u32 archivename_size  = cmd_buff[3];
 | 
			
		||||
    u32 archivename_ptr   = cmd_buff[5];
 | 
			
		||||
    u32 archivename_size = cmd_buff[3];
 | 
			
		||||
    u32 archivename_ptr = cmd_buff[5];
 | 
			
		||||
    FileSys::Path archive_path(archivename_type, archivename_size, archivename_ptr);
 | 
			
		||||
 | 
			
		||||
    LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", archive_id, archive_path.DebugStr().c_str());
 | 
			
		||||
    LOG_DEBUG(Service_FS, "archive_id=0x%08X archive_path=%s", archive_id,
 | 
			
		||||
              archive_path.DebugStr().c_str());
 | 
			
		||||
 | 
			
		||||
    ResultVal<ArchiveHandle> handle = OpenArchive(archive_id, archive_path);
 | 
			
		||||
    cmd_buff[1] = handle.Code().raw;
 | 
			
		||||
| 
						 | 
				
			
			@ -385,7 +401,8 @@ static void OpenArchive(Service::Interface* self) {
 | 
			
		|||
        cmd_buff[3] = (*handle >> 32) & 0xFFFFFFFF;
 | 
			
		||||
    } else {
 | 
			
		||||
        cmd_buff[2] = cmd_buff[3] = 0;
 | 
			
		||||
        LOG_ERROR(Service_FS, "failed to get a handle for archive archive_id=0x%08X archive_path=%s",
 | 
			
		||||
        LOG_ERROR(Service_FS,
 | 
			
		||||
                  "failed to get a handle for archive archive_id=0x%08X archive_path=%s",
 | 
			
		||||
                  archive_id, archive_path.DebugStr().c_str());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -471,7 +488,8 @@ static void FormatSaveData(Service::Interface* self) {
 | 
			
		|||
    if (archive_id != FS::ArchiveIdCode::SaveData) {
 | 
			
		||||
        LOG_ERROR(Service_FS, "tried to format an archive different than SaveData, %u", archive_id);
 | 
			
		||||
        cmd_buff[1] = ResultCode(ErrorDescription::FS_InvalidPath, ErrorModule::FS,
 | 
			
		||||
                                 ErrorSummary::InvalidArgument, ErrorLevel::Usage).raw;
 | 
			
		||||
                                 ErrorSummary::InvalidArgument, ErrorLevel::Usage)
 | 
			
		||||
                          .raw;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -571,18 +589,21 @@ static void CreateExtSaveData(Service::Interface* self) {
 | 
			
		|||
    u32 icon_size = cmd_buff[9];
 | 
			
		||||
    VAddr icon_buffer = cmd_buff[11];
 | 
			
		||||
 | 
			
		||||
    LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X "
 | 
			
		||||
            "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
 | 
			
		||||
            "icon_size=%08X icon_descriptor=%08X icon_buffer=%08X", save_high, save_low,
 | 
			
		||||
            cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6], cmd_buff[7], cmd_buff[8], icon_size,
 | 
			
		||||
            cmd_buff[10], icon_buffer);
 | 
			
		||||
    LOG_WARNING(
 | 
			
		||||
        Service_FS,
 | 
			
		||||
        "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X "
 | 
			
		||||
        "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
 | 
			
		||||
        "icon_size=%08X icon_descriptor=%08X icon_buffer=%08X",
 | 
			
		||||
        save_high, save_low, cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6], cmd_buff[7],
 | 
			
		||||
        cmd_buff[8], icon_size, cmd_buff[10], icon_buffer);
 | 
			
		||||
 | 
			
		||||
    FileSys::ArchiveFormatInfo format_info;
 | 
			
		||||
    format_info.number_directories = cmd_buff[5];
 | 
			
		||||
    format_info.number_files = cmd_buff[6];
 | 
			
		||||
    format_info.duplicate_data = false;
 | 
			
		||||
    format_info.total_size = 0;
 | 
			
		||||
    cmd_buff[1] = CreateExtSaveData(media_type, save_high, save_low, icon_buffer, icon_size, format_info).raw;
 | 
			
		||||
    cmd_buff[1] =
 | 
			
		||||
        CreateExtSaveData(media_type, save_high, save_low, icon_buffer, icon_size, format_info).raw;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -604,7 +625,7 @@ static void DeleteExtSaveData(Service::Interface* self) {
 | 
			
		|||
    u32 unknown = cmd_buff[4]; // TODO(Subv): Figure out what this is
 | 
			
		||||
 | 
			
		||||
    LOG_WARNING(Service_FS, "(STUBBED) save_low=%08X save_high=%08X media_type=%08X unknown=%08X",
 | 
			
		||||
            save_low, save_high, cmd_buff[1] & 0xFF, unknown);
 | 
			
		||||
                save_low, save_high, cmd_buff[1] & 0xFF, unknown);
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = DeleteExtSaveData(media_type, save_high, save_low).raw;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -662,10 +683,13 @@ static void CreateSystemSaveData(Service::Interface* self) {
 | 
			
		|||
    u32 savedata_high = cmd_buff[1];
 | 
			
		||||
    u32 savedata_low = cmd_buff[2];
 | 
			
		||||
 | 
			
		||||
    LOG_WARNING(Service_FS, "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X "
 | 
			
		||||
            "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
 | 
			
		||||
            "cmd_buff[9]=%08X", savedata_high, savedata_low, cmd_buff[3], cmd_buff[4], cmd_buff[5],
 | 
			
		||||
            cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9]);
 | 
			
		||||
    LOG_WARNING(
 | 
			
		||||
        Service_FS,
 | 
			
		||||
        "(STUBBED) savedata_high=%08X savedata_low=%08X cmd_buff[3]=%08X "
 | 
			
		||||
        "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
 | 
			
		||||
        "cmd_buff[9]=%08X",
 | 
			
		||||
        savedata_high, savedata_low, cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6],
 | 
			
		||||
        cmd_buff[7], cmd_buff[8], cmd_buff[9]);
 | 
			
		||||
 | 
			
		||||
    cmd_buff[1] = CreateSystemSaveData(savedata_high, savedata_low).raw;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -692,10 +716,13 @@ static void CreateLegacySystemSaveData(Service::Interface* self) {
 | 
			
		|||
    u32* cmd_buff = Kernel::GetCommandBuffer();
 | 
			
		||||
    u32 savedata_id = cmd_buff[1];
 | 
			
		||||
 | 
			
		||||
    LOG_WARNING(Service_FS, "(STUBBED) savedata_id=%08X cmd_buff[3]=%08X "
 | 
			
		||||
            "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
 | 
			
		||||
            "cmd_buff[9]=%08X", savedata_id, cmd_buff[3], cmd_buff[4], cmd_buff[5],
 | 
			
		||||
            cmd_buff[6], cmd_buff[7], cmd_buff[8], cmd_buff[9]);
 | 
			
		||||
    LOG_WARNING(
 | 
			
		||||
        Service_FS,
 | 
			
		||||
        "(STUBBED) savedata_id=%08X cmd_buff[3]=%08X "
 | 
			
		||||
        "cmd_buff[4]=%08X cmd_buff[5]=%08X cmd_buff[6]=%08X cmd_buff[7]=%08X cmd_buff[8]=%08X "
 | 
			
		||||
        "cmd_buff[9]=%08X",
 | 
			
		||||
        savedata_id, cmd_buff[3], cmd_buff[4], cmd_buff[5], cmd_buff[6], cmd_buff[7], cmd_buff[8],
 | 
			
		||||
        cmd_buff[9]);
 | 
			
		||||
 | 
			
		||||
    cmd_buff[0] = IPC::MakeHeader(0x810, 0x1, 0);
 | 
			
		||||
    // With this command, the SystemSaveData always has save_high = 0 (Always created in the NAND)
 | 
			
		||||
| 
						 | 
				
			
			@ -721,8 +748,8 @@ static void InitializeWithSdkVersion(Service::Interface* self) {
 | 
			
		|||
 | 
			
		||||
    cmd_buff[1] = RESULT_SUCCESS.raw;
 | 
			
		||||
 | 
			
		||||
    LOG_WARNING(Service_FS, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, unk3=0x%08X",
 | 
			
		||||
                unk1, unk2, unk3);
 | 
			
		||||
    LOG_WARNING(Service_FS, "(STUBBED) called unk1=0x%08X, unk2=0x%08X, unk3=0x%08X", unk1, unk2,
 | 
			
		||||
                unk3);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -834,115 +861,114 @@ static void GetFormatInfo(Service::Interface* self) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
const Interface::FunctionInfo FunctionTable[] = {
 | 
			
		||||
    {0x000100C6, nullptr,                  "Dummy1"},
 | 
			
		||||
    {0x040100C4, nullptr,                  "Control"},
 | 
			
		||||
    {0x08010002, Initialize,               "Initialize"},
 | 
			
		||||
    {0x080201C2, OpenFile,                 "OpenFile"},
 | 
			
		||||
    {0x08030204, OpenFileDirectly,         "OpenFileDirectly"},
 | 
			
		||||
    {0x08040142, DeleteFile,               "DeleteFile"},
 | 
			
		||||
    {0x08050244, RenameFile,               "RenameFile"},
 | 
			
		||||
    {0x08060142, DeleteDirectory,          "DeleteDirectory"},
 | 
			
		||||
    {0x08070142, nullptr,                  "DeleteDirectoryRecursively"},
 | 
			
		||||
    {0x08080202, CreateFile,               "CreateFile"},
 | 
			
		||||
    {0x08090182, CreateDirectory,          "CreateDirectory"},
 | 
			
		||||
    {0x080A0244, RenameDirectory,          "RenameDirectory"},
 | 
			
		||||
    {0x080B0102, OpenDirectory,            "OpenDirectory"},
 | 
			
		||||
    {0x080C00C2, OpenArchive,              "OpenArchive"},
 | 
			
		||||
    {0x080D0144, nullptr,                  "ControlArchive"},
 | 
			
		||||
    {0x080E0080, CloseArchive,             "CloseArchive"},
 | 
			
		||||
    {0x080F0180, FormatThisUserSaveData,   "FormatThisUserSaveData"},
 | 
			
		||||
    {0x000100C6, nullptr, "Dummy1"},
 | 
			
		||||
    {0x040100C4, nullptr, "Control"},
 | 
			
		||||
    {0x08010002, Initialize, "Initialize"},
 | 
			
		||||
    {0x080201C2, OpenFile, "OpenFile"},
 | 
			
		||||
    {0x08030204, OpenFileDirectly, "OpenFileDirectly"},
 | 
			
		||||
    {0x08040142, DeleteFile, "DeleteFile"},
 | 
			
		||||
    {0x08050244, RenameFile, "RenameFile"},
 | 
			
		||||
    {0x08060142, DeleteDirectory, "DeleteDirectory"},
 | 
			
		||||
    {0x08070142, nullptr, "DeleteDirectoryRecursively"},
 | 
			
		||||
    {0x08080202, CreateFile, "CreateFile"},
 | 
			
		||||
    {0x08090182, CreateDirectory, "CreateDirectory"},
 | 
			
		||||
    {0x080A0244, RenameDirectory, "RenameDirectory"},
 | 
			
		||||
    {0x080B0102, OpenDirectory, "OpenDirectory"},
 | 
			
		||||
    {0x080C00C2, OpenArchive, "OpenArchive"},
 | 
			
		||||
    {0x080D0144, nullptr, "ControlArchive"},
 | 
			
		||||
    {0x080E0080, CloseArchive, "CloseArchive"},
 | 
			
		||||
    {0x080F0180, FormatThisUserSaveData, "FormatThisUserSaveData"},
 | 
			
		||||
    {0x08100200, CreateLegacySystemSaveData, "CreateLegacySystemSaveData"},
 | 
			
		||||
    {0x08110040, nullptr,                  "DeleteSystemSaveData"},
 | 
			
		||||
    {0x08120080, GetFreeBytes,             "GetFreeBytes"},
 | 
			
		||||
    {0x08130000, nullptr,                  "GetCardType"},
 | 
			
		||||
    {0x08140000, nullptr,                  "GetSdmcArchiveResource"},
 | 
			
		||||
    {0x08150000, nullptr,                  "GetNandArchiveResource"},
 | 
			
		||||
    {0x08160000, nullptr,                  "GetSdmcFatfsError"},
 | 
			
		||||
    {0x08170000, IsSdmcDetected,           "IsSdmcDetected"},
 | 
			
		||||
    {0x08180000, IsSdmcWriteable,          "IsSdmcWritable"},
 | 
			
		||||
    {0x08190042, nullptr,                  "GetSdmcCid"},
 | 
			
		||||
    {0x081A0042, nullptr,                  "GetNandCid"},
 | 
			
		||||
    {0x081B0000, nullptr,                  "GetSdmcSpeedInfo"},
 | 
			
		||||
    {0x081C0000, nullptr,                  "GetNandSpeedInfo"},
 | 
			
		||||
    {0x081D0042, nullptr,                  "GetSdmcLog"},
 | 
			
		||||
    {0x081E0042, nullptr,                  "GetNandLog"},
 | 
			
		||||
    {0x081F0000, nullptr,                  "ClearSdmcLog"},
 | 
			
		||||
    {0x08200000, nullptr,                  "ClearNandLog"},
 | 
			
		||||
    {0x08210000, CardSlotIsInserted,       "CardSlotIsInserted"},
 | 
			
		||||
    {0x08220000, nullptr,                  "CardSlotPowerOn"},
 | 
			
		||||
    {0x08230000, nullptr,                  "CardSlotPowerOff"},
 | 
			
		||||
    {0x08240000, nullptr,                  "CardSlotGetCardIFPowerStatus"},
 | 
			
		||||
    {0x08250040, nullptr,                  "CardNorDirectCommand"},
 | 
			
		||||
    {0x08260080, nullptr,                  "CardNorDirectCommandWithAddress"},
 | 
			
		||||
    {0x08270082, nullptr,                  "CardNorDirectRead"},
 | 
			
		||||
    {0x082800C2, nullptr,                  "CardNorDirectReadWithAddress"},
 | 
			
		||||
    {0x08290082, nullptr,                  "CardNorDirectWrite"},
 | 
			
		||||
    {0x082A00C2, nullptr,                  "CardNorDirectWriteWithAddress"},
 | 
			
		||||
    {0x082B00C2, nullptr,                  "CardNorDirectRead_4xIO"},
 | 
			
		||||
    {0x082C0082, nullptr,                  "CardNorDirectCpuWriteWithoutVerify"},
 | 
			
		||||
    {0x082D0040, nullptr,                  "CardNorDirectSectorEraseWithoutVerify"},
 | 
			
		||||
    {0x082E0040, nullptr,                  "GetProductInfo"},
 | 
			
		||||
    {0x082F0040, nullptr,                  "GetProgramLaunchInfo"},
 | 
			
		||||
    {0x08300182, nullptr,                  "CreateExtSaveData"},
 | 
			
		||||
    {0x08310180, nullptr,                  "CreateSharedExtSaveData"},
 | 
			
		||||
    {0x08320102, nullptr,                  "ReadExtSaveDataIcon"},
 | 
			
		||||
    {0x08330082, nullptr,                  "EnumerateExtSaveData"},
 | 
			
		||||
    {0x08340082, nullptr,                  "EnumerateSharedExtSaveData"},
 | 
			
		||||
    {0x08350080, nullptr,                  "DeleteExtSaveData"},
 | 
			
		||||
    {0x08360080, nullptr,                  "DeleteSharedExtSaveData"},
 | 
			
		||||
    {0x08370040, nullptr,                  "SetCardSpiBaudRate"},
 | 
			
		||||
    {0x08380040, nullptr,                  "SetCardSpiBusMode"},
 | 
			
		||||
    {0x08390000, nullptr,                  "SendInitializeInfoTo9"},
 | 
			
		||||
    {0x083A0100, nullptr,                  "GetSpecialContentIndex"},
 | 
			
		||||
    {0x083B00C2, nullptr,                  "GetLegacyRomHeader"},
 | 
			
		||||
    {0x083C00C2, nullptr,                  "GetLegacyBannerData"},
 | 
			
		||||
    {0x083D0100, nullptr,                  "CheckAuthorityToAccessExtSaveData"},
 | 
			
		||||
    {0x083E00C2, nullptr,                  "QueryTotalQuotaSize"},
 | 
			
		||||
    {0x083F00C0, nullptr,                  "GetExtDataBlockSize"},
 | 
			
		||||
    {0x08400040, nullptr,                  "AbnegateAccessRight"},
 | 
			
		||||
    {0x08410000, nullptr,                  "DeleteSdmcRoot"},
 | 
			
		||||
    {0x08420040, nullptr,                  "DeleteAllExtSaveDataOnNand"},
 | 
			
		||||
    {0x08430000, nullptr,                  "InitializeCtrFileSystem"},
 | 
			
		||||
    {0x08440000, nullptr,                  "CreateSeed"},
 | 
			
		||||
    {0x084500C2, GetFormatInfo,            "GetFormatInfo"},
 | 
			
		||||
    {0x08460102, nullptr,                  "GetLegacyRomHeader2"},
 | 
			
		||||
    {0x08470180, nullptr,                  "FormatCtrCardUserSaveData"},
 | 
			
		||||
    {0x08480042, nullptr,                  "GetSdmcCtrRootPath"},
 | 
			
		||||
    {0x08490040, GetArchiveResource,       "GetArchiveResource"},
 | 
			
		||||
    {0x084A0002, nullptr,                  "ExportIntegrityVerificationSeed"},
 | 
			
		||||
    {0x084B0002, nullptr,                  "ImportIntegrityVerificationSeed"},
 | 
			
		||||
    {0x084C0242, FormatSaveData,           "FormatSaveData"},
 | 
			
		||||
    {0x084D0102, nullptr,                  "GetLegacySubBannerData"},
 | 
			
		||||
    {0x084E0342, nullptr,                  "UpdateSha256Context"},
 | 
			
		||||
    {0x084F0102, nullptr,                  "ReadSpecialFile"},
 | 
			
		||||
    {0x08500040, nullptr,                  "GetSpecialFileSize"},
 | 
			
		||||
    {0x08510242, CreateExtSaveData,        "CreateExtSaveData"},
 | 
			
		||||
    {0x08520100, DeleteExtSaveData,        "DeleteExtSaveData"},
 | 
			
		||||
    {0x08530142, nullptr,                  "ReadExtSaveDataIcon"},
 | 
			
		||||
    {0x085400C0, nullptr,                  "GetExtDataBlockSize"},
 | 
			
		||||
    {0x08550102, nullptr,                  "EnumerateExtSaveData"},
 | 
			
		||||
    {0x08560240, CreateSystemSaveData,     "CreateSystemSaveData"},
 | 
			
		||||
    {0x08570080, DeleteSystemSaveData,     "DeleteSystemSaveData"},
 | 
			
		||||
    {0x08580000, nullptr,                  "StartDeviceMoveAsSource"},
 | 
			
		||||
    {0x08590200, nullptr,                  "StartDeviceMoveAsDestination"},
 | 
			
		||||
    {0x085A00C0, nullptr,                  "SetArchivePriority"},
 | 
			
		||||
    {0x085B0080, nullptr,                  "GetArchivePriority"},
 | 
			
		||||
    {0x085C00C0, nullptr,                  "SetCtrCardLatencyParameter"},
 | 
			
		||||
    {0x085D01C0, nullptr,                  "SetFsCompatibilityInfo"},
 | 
			
		||||
    {0x085E0040, nullptr,                  "ResetCardCompatibilityParameter"},
 | 
			
		||||
    {0x085F0040, nullptr,                  "SwitchCleanupInvalidSaveData"},
 | 
			
		||||
    {0x08600042, nullptr,                  "EnumerateSystemSaveData"},
 | 
			
		||||
    {0x08110040, nullptr, "DeleteSystemSaveData"},
 | 
			
		||||
    {0x08120080, GetFreeBytes, "GetFreeBytes"},
 | 
			
		||||
    {0x08130000, nullptr, "GetCardType"},
 | 
			
		||||
    {0x08140000, nullptr, "GetSdmcArchiveResource"},
 | 
			
		||||
    {0x08150000, nullptr, "GetNandArchiveResource"},
 | 
			
		||||
    {0x08160000, nullptr, "GetSdmcFatfsError"},
 | 
			
		||||
    {0x08170000, IsSdmcDetected, "IsSdmcDetected"},
 | 
			
		||||
    {0x08180000, IsSdmcWriteable, "IsSdmcWritable"},
 | 
			
		||||
    {0x08190042, nullptr, "GetSdmcCid"},
 | 
			
		||||
    {0x081A0042, nullptr, "GetNandCid"},
 | 
			
		||||
    {0x081B0000, nullptr, "GetSdmcSpeedInfo"},
 | 
			
		||||
    {0x081C0000, nullptr, "GetNandSpeedInfo"},
 | 
			
		||||
    {0x081D0042, nullptr, "GetSdmcLog"},
 | 
			
		||||
    {0x081E0042, nullptr, "GetNandLog"},
 | 
			
		||||
    {0x081F0000, nullptr, "ClearSdmcLog"},
 | 
			
		||||
    {0x08200000, nullptr, "ClearNandLog"},
 | 
			
		||||
    {0x08210000, CardSlotIsInserted, "CardSlotIsInserted"},
 | 
			
		||||
    {0x08220000, nullptr, "CardSlotPowerOn"},
 | 
			
		||||
    {0x08230000, nullptr, "CardSlotPowerOff"},
 | 
			
		||||
    {0x08240000, nullptr, "CardSlotGetCardIFPowerStatus"},
 | 
			
		||||
    {0x08250040, nullptr, "CardNorDirectCommand"},
 | 
			
		||||
    {0x08260080, nullptr, "CardNorDirectCommandWithAddress"},
 | 
			
		||||
    {0x08270082, nullptr, "CardNorDirectRead"},
 | 
			
		||||
    {0x082800C2, nullptr, "CardNorDirectReadWithAddress"},
 | 
			
		||||
    {0x08290082, nullptr, "CardNorDirectWrite"},
 | 
			
		||||
    {0x082A00C2, nullptr, "CardNorDirectWriteWithAddress"},
 | 
			
		||||
    {0x082B00C2, nullptr, "CardNorDirectRead_4xIO"},
 | 
			
		||||
    {0x082C0082, nullptr, "CardNorDirectCpuWriteWithoutVerify"},
 | 
			
		||||
    {0x082D0040, nullptr, "CardNorDirectSectorEraseWithoutVerify"},
 | 
			
		||||
    {0x082E0040, nullptr, "GetProductInfo"},
 | 
			
		||||
    {0x082F0040, nullptr, "GetProgramLaunchInfo"},
 | 
			
		||||
    {0x08300182, nullptr, "CreateExtSaveData"},
 | 
			
		||||
    {0x08310180, nullptr, "CreateSharedExtSaveData"},
 | 
			
		||||
    {0x08320102, nullptr, "ReadExtSaveDataIcon"},
 | 
			
		||||
    {0x08330082, nullptr, "EnumerateExtSaveData"},
 | 
			
		||||
    {0x08340082, nullptr, "EnumerateSharedExtSaveData"},
 | 
			
		||||
    {0x08350080, nullptr, "DeleteExtSaveData"},
 | 
			
		||||
    {0x08360080, nullptr, "DeleteSharedExtSaveData"},
 | 
			
		||||
    {0x08370040, nullptr, "SetCardSpiBaudRate"},
 | 
			
		||||
    {0x08380040, nullptr, "SetCardSpiBusMode"},
 | 
			
		||||
    {0x08390000, nullptr, "SendInitializeInfoTo9"},
 | 
			
		||||
    {0x083A0100, nullptr, "GetSpecialContentIndex"},
 | 
			
		||||
    {0x083B00C2, nullptr, "GetLegacyRomHeader"},
 | 
			
		||||
    {0x083C00C2, nullptr, "GetLegacyBannerData"},
 | 
			
		||||
    {0x083D0100, nullptr, "CheckAuthorityToAccessExtSaveData"},
 | 
			
		||||
    {0x083E00C2, nullptr, "QueryTotalQuotaSize"},
 | 
			
		||||
    {0x083F00C0, nullptr, "GetExtDataBlockSize"},
 | 
			
		||||
    {0x08400040, nullptr, "AbnegateAccessRight"},
 | 
			
		||||
    {0x08410000, nullptr, "DeleteSdmcRoot"},
 | 
			
		||||
    {0x08420040, nullptr, "DeleteAllExtSaveDataOnNand"},
 | 
			
		||||
    {0x08430000, nullptr, "InitializeCtrFileSystem"},
 | 
			
		||||
    {0x08440000, nullptr, "CreateSeed"},
 | 
			
		||||
    {0x084500C2, GetFormatInfo, "GetFormatInfo"},
 | 
			
		||||
    {0x08460102, nullptr, "GetLegacyRomHeader2"},
 | 
			
		||||
    {0x08470180, nullptr, "FormatCtrCardUserSaveData"},
 | 
			
		||||
    {0x08480042, nullptr, "GetSdmcCtrRootPath"},
 | 
			
		||||
    {0x08490040, GetArchiveResource, "GetArchiveResource"},
 | 
			
		||||
    {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"},
 | 
			
		||||
    {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"},
 | 
			
		||||
    {0x084C0242, FormatSaveData, "FormatSaveData"},
 | 
			
		||||
    {0x084D0102, nullptr, "GetLegacySubBannerData"},
 | 
			
		||||
    {0x084E0342, nullptr, "UpdateSha256Context"},
 | 
			
		||||
    {0x084F0102, nullptr, "ReadSpecialFile"},
 | 
			
		||||
    {0x08500040, nullptr, "GetSpecialFileSize"},
 | 
			
		||||
    {0x08510242, CreateExtSaveData, "CreateExtSaveData"},
 | 
			
		||||
    {0x08520100, DeleteExtSaveData, "DeleteExtSaveData"},
 | 
			
		||||
    {0x08530142, nullptr, "ReadExtSaveDataIcon"},
 | 
			
		||||
    {0x085400C0, nullptr, "GetExtDataBlockSize"},
 | 
			
		||||
    {0x08550102, nullptr, "EnumerateExtSaveData"},
 | 
			
		||||
    {0x08560240, CreateSystemSaveData, "CreateSystemSaveData"},
 | 
			
		||||
    {0x08570080, DeleteSystemSaveData, "DeleteSystemSaveData"},
 | 
			
		||||
    {0x08580000, nullptr, "StartDeviceMoveAsSource"},
 | 
			
		||||
    {0x08590200, nullptr, "StartDeviceMoveAsDestination"},
 | 
			
		||||
    {0x085A00C0, nullptr, "SetArchivePriority"},
 | 
			
		||||
    {0x085B0080, nullptr, "GetArchivePriority"},
 | 
			
		||||
    {0x085C00C0, nullptr, "SetCtrCardLatencyParameter"},
 | 
			
		||||
    {0x085D01C0, nullptr, "SetFsCompatibilityInfo"},
 | 
			
		||||
    {0x085E0040, nullptr, "ResetCardCompatibilityParameter"},
 | 
			
		||||
    {0x085F0040, nullptr, "SwitchCleanupInvalidSaveData"},
 | 
			
		||||
    {0x08600042, nullptr, "EnumerateSystemSaveData"},
 | 
			
		||||
    {0x08610042, InitializeWithSdkVersion, "InitializeWithSdkVersion"},
 | 
			
		||||
    {0x08620040, SetPriority,              "SetPriority"},
 | 
			
		||||
    {0x08630000, GetPriority,              "GetPriority"},
 | 
			
		||||
    {0x08640000, nullptr,                  "GetNandInfo"},
 | 
			
		||||
    {0x08650140, nullptr,                  "SetSaveDataSecureValue"},
 | 
			
		||||
    {0x086600C0, nullptr,                  "GetSaveDataSecureValue"},
 | 
			
		||||
    {0x086700C4, nullptr,                  "ControlSecureSave"},
 | 
			
		||||
    {0x08680000, nullptr,                  "GetMediaType"},
 | 
			
		||||
    {0x08690000, nullptr,                  "GetNandEraseCount"},
 | 
			
		||||
    {0x086A0082, nullptr,                  "ReadNandReport"}
 | 
			
		||||
};
 | 
			
		||||
    {0x08620040, SetPriority, "SetPriority"},
 | 
			
		||||
    {0x08630000, GetPriority, "GetPriority"},
 | 
			
		||||
    {0x08640000, nullptr, "GetNandInfo"},
 | 
			
		||||
    {0x08650140, nullptr, "SetSaveDataSecureValue"},
 | 
			
		||||
    {0x086600C0, nullptr, "GetSaveDataSecureValue"},
 | 
			
		||||
    {0x086700C4, nullptr, "ControlSecureSave"},
 | 
			
		||||
    {0x08680000, nullptr, "GetMediaType"},
 | 
			
		||||
    {0x08690000, nullptr, "GetNandEraseCount"},
 | 
			
		||||
    {0x086A0082, nullptr, "ReadNandReport"}};
 | 
			
		||||
 | 
			
		||||
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
// Interface class
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue