client_session.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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) : SynchronizationObject{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::ShouldWait(const Thread* thread) const {
  21. UNIMPLEMENTED();
  22. return {};
  23. }
  24. void ClientSession::Acquire(Thread* thread) {
  25. UNIMPLEMENTED();
  26. }
  27. bool ClientSession::IsSignaled() const {
  28. UNIMPLEMENTED();
  29. return true;
  30. }
  31. ResultVal<std::shared_ptr<ClientSession>> ClientSession::Create(KernelCore& kernel,
  32. std::shared_ptr<Session> parent,
  33. std::string name) {
  34. std::shared_ptr<ClientSession> client_session{std::make_shared<ClientSession>(kernel)};
  35. client_session->name = std::move(name);
  36. client_session->parent = std::move(parent);
  37. return MakeResult(std::move(client_session));
  38. }
  39. ResultCode ClientSession::SendSyncRequest(std::shared_ptr<Thread> thread,
  40. Core::Memory::Memory& memory,
  41. Core::Timing::CoreTiming& core_timing) {
  42. // Keep ServerSession alive until we're done working with it.
  43. if (!parent->Server()) {
  44. return ERR_SESSION_CLOSED_BY_REMOTE;
  45. }
  46. // Signal the server session that new data is available
  47. return parent->Server()->HandleSyncRequest(std::move(thread), memory, core_timing);
  48. }
  49. } // namespace Kernel