controller.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Copyright 2017 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "common/logging/log.h"
  5. #include "core/hle/ipc_helpers.h"
  6. #include "core/hle/kernel/domain.h"
  7. #include "core/hle/service/sm/controller.h"
  8. namespace Service {
  9. namespace SM {
  10. void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
  11. auto domain = Kernel::Domain::CreateFromSession(*ctx.ServerSession()->parent).Unwrap();
  12. IPC::RequestBuilder rb{ctx, 3};
  13. rb.Push(RESULT_SUCCESS);
  14. rb.Skip(1, true);
  15. rb.Push<u32>(static_cast<u32>(domain->request_handlers.size()));
  16. LOG_DEBUG(Service, "called, domain=%d", domain->GetObjectId());
  17. }
  18. void Controller::DuplicateSession(Kernel::HLERequestContext& ctx) {
  19. IPC::RequestBuilder rb{ctx, 1, 0, 1};
  20. rb.Push(RESULT_SUCCESS);
  21. rb.PushObjects(ctx.ServerSession());
  22. LOG_DEBUG(Service, "called");
  23. }
  24. void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
  25. IPC::RequestBuilder rb{ctx, 3};
  26. rb.Push(RESULT_SUCCESS);
  27. rb.Skip(1, true);
  28. rb.Push<u32>(0x500);
  29. LOG_WARNING(Service, "(STUBBED) called");
  30. }
  31. Controller::Controller() : ServiceFramework("IpcController") {
  32. static const FunctionInfo functions[] = {
  33. {0x00000000, &Controller::ConvertSessionToDomain, "ConvertSessionToDomain"},
  34. {0x00000001, nullptr, "ConvertDomainToSession"},
  35. {0x00000002, &Controller::DuplicateSession, "DuplicateSession"},
  36. {0x00000003, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
  37. {0x00000004, nullptr, "DuplicateSessionEx"},
  38. };
  39. RegisterHandlers(functions);
  40. }
  41. } // namespace SM
  42. } // namespace Service