|
|
|
@ -68,13 +68,16 @@ static void OpenFile(Service::Interface* self) {
|
|
|
|
|
LOG_DEBUG(Service_FS, "path=%s, mode=%u attrs=%u", file_path.DebugStr().c_str(), mode.hex,
|
|
|
|
|
attributes);
|
|
|
|
|
|
|
|
|
|
ResultVal<std::shared_ptr<File>> file_res = OpenFileFromArchive(archive_handle, file_path, mode);
|
|
|
|
|
ResultVal<std::shared_ptr<File>> file_res =
|
|
|
|
|
OpenFileFromArchive(archive_handle, file_path, mode);
|
|
|
|
|
cmd_buff[1] = file_res.Code().raw;
|
|
|
|
|
if (file_res.Succeeded()) {
|
|
|
|
|
std::shared_ptr<File> file = *file_res;
|
|
|
|
|
auto sessions = ServerSession::CreateSessionPair(file->GetName(), file);
|
|
|
|
|
file->ClientConnected(std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions));
|
|
|
|
|
cmd_buff[3] = Kernel::g_handle_table.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions)).MoveFrom();
|
|
|
|
|
cmd_buff[3] = Kernel::g_handle_table
|
|
|
|
|
.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions))
|
|
|
|
|
.MoveFrom();
|
|
|
|
|
} else {
|
|
|
|
|
cmd_buff[3] = 0;
|
|
|
|
|
LOG_ERROR(Service_FS, "failed to get a handle for file %s", file_path.DebugStr().c_str());
|
|
|
|
@ -131,13 +134,16 @@ static void OpenFileDirectly(Service::Interface* self) {
|
|
|
|
|
}
|
|
|
|
|
SCOPE_EXIT({ CloseArchive(*archive_handle); });
|
|
|
|
|
|
|
|
|
|
ResultVal<std::shared_ptr<File>> file_res = OpenFileFromArchive(*archive_handle, file_path, mode);
|
|
|
|
|
ResultVal<std::shared_ptr<File>> file_res =
|
|
|
|
|
OpenFileFromArchive(*archive_handle, file_path, mode);
|
|
|
|
|
cmd_buff[1] = file_res.Code().raw;
|
|
|
|
|
if (file_res.Succeeded()) {
|
|
|
|
|
std::shared_ptr<File> file = *file_res;
|
|
|
|
|
auto sessions = ServerSession::CreateSessionPair(file->GetName(), file);
|
|
|
|
|
file->ClientConnected(std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions));
|
|
|
|
|
cmd_buff[3] = Kernel::g_handle_table.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions)).MoveFrom();
|
|
|
|
|
cmd_buff[3] = Kernel::g_handle_table
|
|
|
|
|
.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions))
|
|
|
|
|
.MoveFrom();
|
|
|
|
|
} else {
|
|
|
|
|
cmd_buff[3] = 0;
|
|
|
|
|
LOG_ERROR(Service_FS, "failed to get a handle for file %s mode=%u attributes=%u",
|
|
|
|
@ -395,13 +401,16 @@ static void OpenDirectory(Service::Interface* self) {
|
|
|
|
|
LOG_DEBUG(Service_FS, "type=%u size=%u data=%s", static_cast<u32>(dirname_type), dirname_size,
|
|
|
|
|
dir_path.DebugStr().c_str());
|
|
|
|
|
|
|
|
|
|
ResultVal<std::shared_ptr<Directory>> dir_res = OpenDirectoryFromArchive(archive_handle, dir_path);
|
|
|
|
|
ResultVal<std::shared_ptr<Directory>> dir_res =
|
|
|
|
|
OpenDirectoryFromArchive(archive_handle, dir_path);
|
|
|
|
|
cmd_buff[1] = dir_res.Code().raw;
|
|
|
|
|
if (dir_res.Succeeded()) {
|
|
|
|
|
std::shared_ptr<Directory> directory = *dir_res;
|
|
|
|
|
auto sessions = ServerSession::CreateSessionPair(directory->GetName(), directory);
|
|
|
|
|
directory->ClientConnected(std::get<Kernel::SharedPtr<Kernel::ServerSession>>(sessions));
|
|
|
|
|
cmd_buff[3] = Kernel::g_handle_table.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions)).MoveFrom();
|
|
|
|
|
cmd_buff[3] = Kernel::g_handle_table
|
|
|
|
|
.Create(std::get<Kernel::SharedPtr<Kernel::ClientSession>>(sessions))
|
|
|
|
|
.MoveFrom();
|
|
|
|
|
} else {
|
|
|
|
|
LOG_ERROR(Service_FS, "failed to get a handle for directory type=%d size=%d data=%s",
|
|
|
|
|
dirname_type, dirname_size, dir_path.DebugStr().c_str());
|
|
|
|
|