mii.cpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Copyright 2018 yuzu emulator team
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <memory>
  5. #include "common/logging/log.h"
  6. #include "core/hle/ipc_helpers.h"
  7. #include "core/hle/kernel/hle_ipc.h"
  8. #include "core/hle/service/mii/mii.h"
  9. #include "core/hle/service/service.h"
  10. #include "core/hle/service/sm/sm.h"
  11. namespace Service::Mii {
  12. class IDatabaseService final : public ServiceFramework<IDatabaseService> {
  13. public:
  14. explicit IDatabaseService() : ServiceFramework{"IDatabaseService"} {
  15. // clang-format off
  16. static const FunctionInfo functions[] = {
  17. {0, nullptr, "IsUpdated"},
  18. {1, nullptr, "IsFullDatabase"},
  19. {2, nullptr, "GetCount"},
  20. {3, nullptr, "Get"},
  21. {4, nullptr, "Get1"},
  22. {5, nullptr, "UpdateLatest"},
  23. {6, nullptr, "BuildRandom"},
  24. {7, nullptr, "BuildDefault"},
  25. {8, nullptr, "Get2"},
  26. {9, nullptr, "Get3"},
  27. {10, nullptr, "UpdateLatest1"},
  28. {11, nullptr, "FindIndex"},
  29. {12, nullptr, "Move"},
  30. {13, nullptr, "AddOrReplace"},
  31. {14, nullptr, "Delete"},
  32. {15, nullptr, "DestroyFile"},
  33. {16, nullptr, "DeleteFile"},
  34. {17, nullptr, "Format"},
  35. {18, nullptr, "Import"},
  36. {19, nullptr, "Export"},
  37. {20, nullptr, "IsBrokenDatabaseWithClearFlag"},
  38. {21, nullptr, "GetIndex"},
  39. {22, nullptr, "SetInterfaceVersion"},
  40. {23, nullptr, "Convert"},
  41. };
  42. // clang-format on
  43. RegisterHandlers(functions);
  44. }
  45. };
  46. class MiiDBModule final : public ServiceFramework<MiiDBModule> {
  47. public:
  48. explicit MiiDBModule(const char* name) : ServiceFramework{name} {
  49. // clang-format off
  50. static const FunctionInfo functions[] = {
  51. {0, &MiiDBModule::GetDatabaseService, "GetDatabaseService"},
  52. };
  53. // clang-format on
  54. RegisterHandlers(functions);
  55. }
  56. private:
  57. void GetDatabaseService(Kernel::HLERequestContext& ctx) {
  58. IPC::ResponseBuilder rb{ctx, 2, 0, 1};
  59. rb.Push(RESULT_SUCCESS);
  60. rb.PushIpcInterface<IDatabaseService>();
  61. LOG_DEBUG(Service_Mii, "called");
  62. }
  63. };
  64. class MiiImg final : public ServiceFramework<MiiImg> {
  65. public:
  66. explicit MiiImg() : ServiceFramework{"miiimg"} {
  67. // clang-format off
  68. static const FunctionInfo functions[] = {
  69. {0, nullptr, "Initialize"},
  70. {10, nullptr, "Reload"},
  71. {11, nullptr, "GetCount"},
  72. {12, nullptr, "IsEmpty"},
  73. {13, nullptr, "IsFull"},
  74. {14, nullptr, "GetAttribute"},
  75. {15, nullptr, "LoadImage"},
  76. {16, nullptr, "AddOrUpdateImage"},
  77. {17, nullptr, "DeleteImages"},
  78. {100, nullptr, "DeleteFile"},
  79. {101, nullptr, "DestroyFile"},
  80. {102, nullptr, "ImportFile"},
  81. {103, nullptr, "ExportFile"},
  82. {104, nullptr, "ForceInitialize"},
  83. };
  84. // clang-format on
  85. RegisterHandlers(functions);
  86. }
  87. };
  88. void InstallInterfaces(SM::ServiceManager& sm) {
  89. std::make_shared<MiiDBModule>("mii:e")->InstallAsService(sm);
  90. std::make_shared<MiiDBModule>("mii:u")->InstallAsService(sm);
  91. std::make_shared<MiiImg>()->InstallAsService(sm);
  92. }
  93. } // namespace Service::Mii