controller.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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/service/sm/controller.h"
  7. namespace Service {
  8. namespace SM {
  9. /**
  10. * Controller::ConvertSessionToDomain service function
  11. * Inputs:
  12. * 0: 0x00000000
  13. * Outputs:
  14. * 0: ResultCode
  15. * 2: Handle of domain
  16. */
  17. void Controller::ConvertSessionToDomain(Kernel::HLERequestContext& ctx) {
  18. ctx.Session()->ConvertToDomain();
  19. IPC::RequestBuilder rb{ctx, 3};
  20. rb.Push(RESULT_SUCCESS);
  21. rb.Skip(1, true);
  22. Kernel::Handle handle = Kernel::g_handle_table.Create(ctx.Session()).Unwrap();
  23. rb.Push(handle);
  24. LOG_DEBUG(Service, "called, handle=0x%08x", handle);
  25. }
  26. /**
  27. * Controller::QueryPointerBufferSize service function
  28. * Inputs:
  29. * 0: 0x00000003
  30. * Outputs:
  31. * 0: ResultCode
  32. * 2: Size of memory
  33. */
  34. void Controller::QueryPointerBufferSize(Kernel::HLERequestContext& ctx) {
  35. IPC::RequestBuilder rb{ctx, 3};
  36. rb.Push(RESULT_SUCCESS);
  37. rb.Skip(1, true);
  38. rb.Push<u32>(0x500);
  39. LOG_WARNING(Service, "(STUBBED) called");
  40. }
  41. Controller::Controller() : ServiceFramework("IpcController") {
  42. static const FunctionInfo functions[] = {
  43. {0x00000000, &Controller::ConvertSessionToDomain, "ConvertSessionToDomain"},
  44. {0x00000001, nullptr, "ConvertDomainToSession"},
  45. {0x00000002, nullptr, "DuplicateSession"},
  46. {0x00000003, &Controller::QueryPointerBufferSize, "QueryPointerBufferSize"},
  47. {0x00000004, nullptr, "DuplicateSessionEx"},
  48. };
  49. RegisterHandlers(functions);
  50. }
  51. Controller::~Controller() = default;
  52. } // namespace SM
  53. } // namespace Service