diff options
| author | 2019-07-03 07:55:54 -0500 | |
|---|---|---|
| committer | 2019-07-03 07:55:54 -0500 | |
| commit | 39f6d57c34a06df0340d9f68776a397161c7c965 (patch) | |
| tree | ca95e39282e0e7ef9724af3ca5a8c1c803f3b5a9 /src | |
| parent | Merge pull request #2659 from FernandoS27/safe-caches (diff) | |
| download | yuzu-39f6d57c34a06df0340d9f68776a397161c7c965.tar.gz yuzu-39f6d57c34a06df0340d9f68776a397161c7c965.tar.xz yuzu-39f6d57c34a06df0340d9f68776a397161c7c965.zip | |
acc: Add IProfileCommon for IProfile and IProfileEditor
Since 2/3 of the commands are shared, this is likely how its done on HW.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/acc/acc.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 0cd8158df..fe4b0e7c3 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp | |||
| @@ -36,20 +36,31 @@ static constexpr u32 SanitizeJPEGSize(std::size_t size) { | |||
| 36 | return static_cast<u32>(std::min(size, max_jpeg_image_size)); | 36 | return static_cast<u32>(std::min(size, max_jpeg_image_size)); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | class IProfile final : public ServiceFramework<IProfile> { | 39 | class IProfileCommon : public ServiceFramework<IProfileCommon> { |
| 40 | public: | 40 | public: |
| 41 | explicit IProfile(Common::UUID user_id, ProfileManager& profile_manager) | 41 | explicit IProfileCommon(const char* name, bool editor_commands, Common::UUID user_id, |
| 42 | : ServiceFramework("IProfile"), profile_manager(profile_manager), user_id(user_id) { | 42 | ProfileManager& profile_manager) |
| 43 | : ServiceFramework(name), profile_manager(profile_manager), user_id(user_id) { | ||
| 43 | static const FunctionInfo functions[] = { | 44 | static const FunctionInfo functions[] = { |
| 44 | {0, &IProfile::Get, "Get"}, | 45 | {0, &IProfileCommon::Get, "Get"}, |
| 45 | {1, &IProfile::GetBase, "GetBase"}, | 46 | {1, &IProfileCommon::GetBase, "GetBase"}, |
| 46 | {10, &IProfile::GetImageSize, "GetImageSize"}, | 47 | {10, &IProfileCommon::GetImageSize, "GetImageSize"}, |
| 47 | {11, &IProfile::LoadImage, "LoadImage"}, | 48 | {11, &IProfileCommon::LoadImage, "LoadImage"}, |
| 48 | }; | 49 | }; |
| 50 | |||
| 49 | RegisterHandlers(functions); | 51 | RegisterHandlers(functions); |
| 52 | |||
| 53 | if (editor_commands) { | ||
| 54 | static const FunctionInfo editor_functions[] = { | ||
| 55 | {100, &IProfileCommon::Store, "Store"}, | ||
| 56 | {101, &IProfileCommon::StoreWithImage, "StoreWithImage"}, | ||
| 57 | }; | ||
| 58 | |||
| 59 | RegisterHandlers(editor_functions); | ||
| 60 | } | ||
| 50 | } | 61 | } |
| 51 | 62 | ||
| 52 | private: | 63 | protected: |
| 53 | void Get(Kernel::HLERequestContext& ctx) { | 64 | void Get(Kernel::HLERequestContext& ctx) { |
| 54 | LOG_INFO(Service_ACC, "called user_id={}", user_id.Format()); | 65 | LOG_INFO(Service_ACC, "called user_id={}", user_id.Format()); |
| 55 | ProfileBase profile_base{}; | 66 | ProfileBase profile_base{}; |
| @@ -126,6 +137,18 @@ private: | |||
| 126 | Common::UUID user_id; ///< The user id this profile refers to. | 137 | Common::UUID user_id; ///< The user id this profile refers to. |
| 127 | }; | 138 | }; |
| 128 | 139 | ||
| 140 | class IProfile final : public IProfileCommon { | ||
| 141 | public: | ||
| 142 | IProfile(Common::UUID user_id, ProfileManager& profile_manager) | ||
| 143 | : IProfileCommon("IProfile", false, user_id, profile_manager) {} | ||
| 144 | }; | ||
| 145 | |||
| 146 | class IProfileEditor final : public IProfileCommon { | ||
| 147 | public: | ||
| 148 | IProfileEditor(Common::UUID user_id, ProfileManager& profile_manager) | ||
| 149 | : IProfileCommon("IProfileEditor", true, user_id, profile_manager) {} | ||
| 150 | }; | ||
| 151 | |||
| 129 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { | 152 | class IManagerForApplication final : public ServiceFramework<IManagerForApplication> { |
| 130 | public: | 153 | public: |
| 131 | IManagerForApplication() : ServiceFramework("IManagerForApplication") { | 154 | IManagerForApplication() : ServiceFramework("IManagerForApplication") { |