srv.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2
  3. // Refer to the license.txt file included.
  4. #include "core/hle/hle.h"
  5. #include "core/hle/service/srv.h"
  6. #include "core/hle/service/service.h"
  7. ////////////////////////////////////////////////////////////////////////////////////////////////////
  8. // Namespace SRV
  9. namespace SRV {
  10. void Initialize(Service::Interface* self) {
  11. NOTICE_LOG(OSHLE, "SRV::Sync - Initialize");
  12. }
  13. void GetProcSemaphore(Service::Interface* self) {
  14. // Get process semaphore?
  15. u32* cmd_buff = Service::GetCommandBuffer();
  16. cmd_buff[3] = 0xDEADBEEF; // Return something... 0 == NULL, raises an exception
  17. }
  18. void GetServiceHandle(Service::Interface* self) {
  19. Syscall::Result res = 0;
  20. u32* cmd_buff = Service::GetCommandBuffer();
  21. std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
  22. Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
  23. NOTICE_LOG(OSHLE, "SRV::Sync - GetHandle - port: %s, handle: 0x%08X", port_name.c_str(),
  24. service->GetUID());
  25. if (NULL != service) {
  26. cmd_buff[3] = service->GetUID();
  27. } else {
  28. ERROR_LOG(OSHLE, "Service %s does not exist", port_name.c_str());
  29. res = -1;
  30. }
  31. cmd_buff[1] = res;
  32. //return res;
  33. }
  34. const Interface::FunctionInfo FunctionTable[] = {
  35. {0x00010002, Initialize, "Initialize"},
  36. {0x00020000, GetProcSemaphore, "GetProcSemaphore"},
  37. {0x00030100, NULL, "RegisterService"},
  38. {0x000400C0, NULL, "UnregisterService"},
  39. {0x00050100, GetServiceHandle, "GetServiceHandle"},
  40. };
  41. ////////////////////////////////////////////////////////////////////////////////////////////////////
  42. // Interface class
  43. Interface::Interface() {
  44. Register(FunctionTable, ARRAY_SIZE(FunctionTable));
  45. }
  46. Interface::~Interface() {
  47. }
  48. } // namespace