client_session.cpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2019 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "core/hle/kernel/client_session.h"
  5. #include "core/hle/kernel/errors.h"
  6. #include "core/hle/kernel/hle_ipc.h"
  7. #include "core/hle/kernel/server_session.h"
  8. #include "core/hle/kernel/session.h"
  9. #include "core/hle/kernel/thread.h"
  10. #include "core/hle/result.h"
  11. namespace Kernel {
  12. ClientSession::ClientSession(KernelCore& kernel) : KSynchronizationObject{kernel} {}
  13. ClientSession::~ClientSession() {
  14. // This destructor will be called automatically when the last ClientSession handle is closed by
  15. // the emulated application.
  16. if (parent->Server()) {
  17. parent->Server()->ClientDisconnected();
  18. }
  19. }
  20. bool ClientSession::IsSignaled() const {
  21. UNIMPLEMENTED();
  22. return true;
  23. }
  24. ResultVal<std::shared_ptr<ClientSession>> ClientSession::Create(KernelCore& kernel,
  25. std::shared_ptr<Session> parent,
  26. std::string name) {
  27. std::shared_ptr<ClientSession> client_session{std::make_shared<ClientSession>(kernel)};
  28. client_session->name = std::move(name);
  29. client_session->parent = std::move(parent);
  30. return MakeResult(std::move(client_session));
  31. }
  32. ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread,
  33. Core::Memory::Memory& memory,
  34. Core::Timing::CoreTiming& core_timing) {
  35. // Keep ServerSession alive until we're done working with it.
  36. if (!parent->Server()) {
  37. return ERR_SESSION_CLOSED_BY_REMOTE;
  38. }
  39. // Signal the server session that new data is available
  40. return parent->Server()->HandleSyncRequest(std::move(thread), memory, core_timing);
  41. }
  42. } // namespace Kernel