2020-12-28 16:15:37 +01:00
|
|
|
// Copyright 2019 yuzu emulator team
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#include "core/hle/kernel/client_session.h"
|
|
|
|
#include "core/hle/kernel/errors.h"
|
|
|
|
#include "core/hle/kernel/hle_ipc.h"
|
2021-01-22 01:15:25 +01:00
|
|
|
#include "core/hle/kernel/k_thread.h"
|
2020-12-28 16:15:37 +01:00
|
|
|
#include "core/hle/kernel/server_session.h"
|
|
|
|
#include "core/hle/kernel/session.h"
|
|
|
|
#include "core/hle/result.h"
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
|
2020-12-31 11:03:11 +01:00
|
|
|
ClientSession::ClientSession(KernelCore& kernel) : KSynchronizationObject{kernel} {}
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
ClientSession::~ClientSession() {
|
|
|
|
// This destructor will be called automatically when the last ClientSession handle is closed by
|
|
|
|
// the emulated application.
|
|
|
|
if (parent->Server()) {
|
|
|
|
parent->Server()->ClientDisconnected();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ClientSession::IsSignaled() const {
|
|
|
|
UNIMPLEMENTED();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
ResultVal<std::shared_ptr<ClientSession>> ClientSession::Create(KernelCore& kernel,
|
|
|
|
std::shared_ptr<Session> parent,
|
|
|
|
std::string name) {
|
|
|
|
std::shared_ptr<ClientSession> client_session{std::make_shared<ClientSession>(kernel)};
|
|
|
|
|
|
|
|
client_session->name = std::move(name);
|
|
|
|
client_session->parent = std::move(parent);
|
|
|
|
|
|
|
|
return MakeResult(std::move(client_session));
|
|
|
|
}
|
|
|
|
|
2021-01-22 01:15:25 +01:00
|
|
|
ResultCode ClientSession::SendSyncRequest(std::shared_ptr<KThread> thread,
|
2020-12-28 16:15:37 +01:00
|
|
|
Core::Memory::Memory& memory,
|
|
|
|
Core::Timing::CoreTiming& core_timing) {
|
|
|
|
// Keep ServerSession alive until we're done working with it.
|
|
|
|
if (!parent->Server()) {
|
|
|
|
return ERR_SESSION_CLOSED_BY_REMOTE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Signal the server session that new data is available
|
|
|
|
return parent->Server()->HandleSyncRequest(std::move(thread), memory, core_timing);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Kernel
|