diff options
| author | 2019-06-06 18:40:59 -0400 | |
|---|---|---|
| committer | 2019-06-24 20:05:11 -0400 | |
| commit | 01ff38cca80c5cf7e64494b129dde8d7c8ebbee5 (patch) | |
| tree | 1bcb28a01c067abe641fe167e99416217fba0f5c /src/core | |
| parent | web_browser: Only delete temporary directory if it was created (diff) | |
| download | yuzu-01ff38cca80c5cf7e64494b129dde8d7c8ebbee5.tar.gz yuzu-01ff38cca80c5cf7e64494b129dde8d7c8ebbee5.tar.xz yuzu-01ff38cca80c5cf7e64494b129dde8d7c8ebbee5.zip | |
general_frontend: Add documentation for parental controls and ecommerce applets
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/frontend/applets/general_frontend.cpp | 12 | ||||
| -rw-r--r-- | src/core/frontend/applets/general_frontend.h | 24 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/web_browser.cpp | 30 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/web_browser.h | 2 |
4 files changed, 48 insertions, 20 deletions
diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general_frontend.cpp index e6cb59b64..c30b36de7 100644 --- a/src/core/frontend/applets/general_frontend.cpp +++ b/src/core/frontend/applets/general_frontend.cpp | |||
| @@ -60,10 +60,11 @@ DefaultECommerceApplet::~DefaultECommerceApplet() = default; | |||
| 60 | void DefaultECommerceApplet::ShowApplicationInformation( | 60 | void DefaultECommerceApplet::ShowApplicationInformation( |
| 61 | std::function<void()> finished, u64 title_id, std::optional<u128> user_id, | 61 | std::function<void()> finished, u64 title_id, std::optional<u128> user_id, |
| 62 | std::optional<bool> full_display, std::optional<std::string> extra_parameter) { | 62 | std::optional<bool> full_display, std::optional<std::string> extra_parameter) { |
| 63 | const auto value = user_id.value_or(u128{}); | ||
| 63 | LOG_INFO(Service_AM, | 64 | LOG_INFO(Service_AM, |
| 64 | "Application requested frontend show application information for EShop, " | 65 | "Application requested frontend show application information for EShop, " |
| 65 | "title_id={:016X}, user_id={:016X}{:016X}, full_display={}, extra_parameter={}", | 66 | "title_id={:016X}, user_id={:016X}{:016X}, full_display={}, extra_parameter={}", |
| 66 | title_id, user_id.value_or(u128{})[1], user_id.value_or(u128{})[0], | 67 | title_id, value[1], value[0], |
| 67 | full_display.has_value() ? fmt::format("{}", *full_display) : "null", | 68 | full_display.has_value() ? fmt::format("{}", *full_display) : "null", |
| 68 | extra_parameter.value_or("null")); | 69 | extra_parameter.value_or("null")); |
| 69 | finished(); | 70 | finished(); |
| @@ -72,30 +73,33 @@ void DefaultECommerceApplet::ShowApplicationInformation( | |||
| 72 | void DefaultECommerceApplet::ShowAddOnContentList(std::function<void()> finished, u64 title_id, | 73 | void DefaultECommerceApplet::ShowAddOnContentList(std::function<void()> finished, u64 title_id, |
| 73 | std::optional<u128> user_id, | 74 | std::optional<u128> user_id, |
| 74 | std::optional<bool> full_display) { | 75 | std::optional<bool> full_display) { |
| 76 | const auto value = user_id.value_or(u128{}); | ||
| 75 | LOG_INFO(Service_AM, | 77 | LOG_INFO(Service_AM, |
| 76 | "Application requested frontend show add on content list for EShop, " | 78 | "Application requested frontend show add on content list for EShop, " |
| 77 | "title_id={:016X}, user_id={:016X}{:016X}, full_display={}", | 79 | "title_id={:016X}, user_id={:016X}{:016X}, full_display={}", |
| 78 | title_id, user_id.value_or(u128{})[1], user_id.value_or(u128{})[0], | 80 | title_id, value[1], value[0], |
| 79 | full_display.has_value() ? fmt::format("{}", *full_display) : "null"); | 81 | full_display.has_value() ? fmt::format("{}", *full_display) : "null"); |
| 80 | finished(); | 82 | finished(); |
| 81 | } | 83 | } |
| 82 | 84 | ||
| 83 | void DefaultECommerceApplet::ShowSubscriptionList(std::function<void()> finished, u64 title_id, | 85 | void DefaultECommerceApplet::ShowSubscriptionList(std::function<void()> finished, u64 title_id, |
| 84 | std::optional<u128> user_id) { | 86 | std::optional<u128> user_id) { |
| 87 | const auto value = user_id.value_or(u128{}); | ||
| 85 | LOG_INFO(Service_AM, | 88 | LOG_INFO(Service_AM, |
| 86 | "Application requested frontend show subscription list for EShop, title_id={:016X}, " | 89 | "Application requested frontend show subscription list for EShop, title_id={:016X}, " |
| 87 | "user_id={:016X}{:016X}", | 90 | "user_id={:016X}{:016X}", |
| 88 | title_id, user_id.value_or(u128{})[1], user_id.value_or(u128{})[0]); | 91 | title_id, value[1], value[0]); |
| 89 | finished(); | 92 | finished(); |
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | void DefaultECommerceApplet::ShowConsumableItemList(std::function<void()> finished, u64 title_id, | 95 | void DefaultECommerceApplet::ShowConsumableItemList(std::function<void()> finished, u64 title_id, |
| 93 | std::optional<u128> user_id) { | 96 | std::optional<u128> user_id) { |
| 97 | const auto value = user_id.value_or(u128{}); | ||
| 94 | LOG_INFO( | 98 | LOG_INFO( |
| 95 | Service_AM, | 99 | Service_AM, |
| 96 | "Application requested frontend show consumable item list for EShop, title_id={:016X}, " | 100 | "Application requested frontend show consumable item list for EShop, title_id={:016X}, " |
| 97 | "user_id={:016X}{:016X}", | 101 | "user_id={:016X}{:016X}", |
| 98 | title_id, user_id.value_or(u128{})[1], user_id.value_or(u128{})[0]); | 102 | title_id, value[1], value[0]); |
| 99 | finished(); | 103 | finished(); |
| 100 | } | 104 | } |
| 101 | 105 | ||
diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general_frontend.h index 616112cfc..4b63f828e 100644 --- a/src/core/frontend/applets/general_frontend.h +++ b/src/core/frontend/applets/general_frontend.h | |||
| @@ -14,10 +14,20 @@ class ParentalControlsApplet { | |||
| 14 | public: | 14 | public: |
| 15 | virtual ~ParentalControlsApplet(); | 15 | virtual ~ParentalControlsApplet(); |
| 16 | 16 | ||
| 17 | // Prompts the user to enter a PIN and calls the callback with whether or not it matches the | ||
| 18 | // correct PIN. If the bool is passed, and the PIN was recently entered correctly, the frontend | ||
| 19 | // should not prompt and simply return true. | ||
| 17 | virtual void VerifyPIN(std::function<void(bool)> finished, | 20 | virtual void VerifyPIN(std::function<void(bool)> finished, |
| 18 | bool suspend_future_verification_temporarily) = 0; | 21 | bool suspend_future_verification_temporarily) = 0; |
| 22 | |||
| 23 | // Prompts the user to enter a PIN and calls the callback for correctness. Frontends can | ||
| 24 | // optionally alert the user that this is to change parental controls settings. | ||
| 19 | virtual void VerifyPINForSettings(std::function<void(bool)> finished) = 0; | 25 | virtual void VerifyPINForSettings(std::function<void(bool)> finished) = 0; |
| 26 | |||
| 27 | // Prompts the user to create a new PIN for pctl and stores it with the service. | ||
| 20 | virtual void RegisterPIN(std::function<void()> finished) = 0; | 28 | virtual void RegisterPIN(std::function<void()> finished) = 0; |
| 29 | |||
| 30 | // Prompts the user to verify the current PIN and then store a new one into pctl. | ||
| 21 | virtual void ChangePIN(std::function<void()> finished) = 0; | 31 | virtual void ChangePIN(std::function<void()> finished) = 0; |
| 22 | }; | 32 | }; |
| 23 | 33 | ||
| @@ -52,18 +62,32 @@ class ECommerceApplet { | |||
| 52 | public: | 62 | public: |
| 53 | virtual ~ECommerceApplet(); | 63 | virtual ~ECommerceApplet(); |
| 54 | 64 | ||
| 65 | // Shows a page with application icons, description, name, and price. | ||
| 55 | virtual void ShowApplicationInformation(std::function<void()> finished, u64 title_id, | 66 | virtual void ShowApplicationInformation(std::function<void()> finished, u64 title_id, |
| 56 | std::optional<u128> user_id = {}, | 67 | std::optional<u128> user_id = {}, |
| 57 | std::optional<bool> full_display = {}, | 68 | std::optional<bool> full_display = {}, |
| 58 | std::optional<std::string> extra_parameter = {}) = 0; | 69 | std::optional<std::string> extra_parameter = {}) = 0; |
| 70 | |||
| 71 | // Shows a page with all of the add on content available for a game, with name, description, and | ||
| 72 | // price. | ||
| 59 | virtual void ShowAddOnContentList(std::function<void()> finished, u64 title_id, | 73 | virtual void ShowAddOnContentList(std::function<void()> finished, u64 title_id, |
| 60 | std::optional<u128> user_id = {}, | 74 | std::optional<u128> user_id = {}, |
| 61 | std::optional<bool> full_display = {}) = 0; | 75 | std::optional<bool> full_display = {}) = 0; |
| 76 | |||
| 77 | // Shows a page with all of the subscriptions (recurring payments) for a game, with name, | ||
| 78 | // description, price, and renewal period. | ||
| 62 | virtual void ShowSubscriptionList(std::function<void()> finished, u64 title_id, | 79 | virtual void ShowSubscriptionList(std::function<void()> finished, u64 title_id, |
| 63 | std::optional<u128> user_id = {}) = 0; | 80 | std::optional<u128> user_id = {}) = 0; |
| 81 | |||
| 82 | // Shows a page with a list of any additional game related purchasable items (DLC, | ||
| 83 | // subscriptions, etc) for a particular game, with name, description, type, and price. | ||
| 64 | virtual void ShowConsumableItemList(std::function<void()> finished, u64 title_id, | 84 | virtual void ShowConsumableItemList(std::function<void()> finished, u64 title_id, |
| 65 | std::optional<u128> user_id = {}) = 0; | 85 | std::optional<u128> user_id = {}) = 0; |
| 86 | |||
| 87 | // Shows the home page of the shop. | ||
| 66 | virtual void ShowShopHome(std::function<void()> finished, u128 user_id, bool full_display) = 0; | 88 | virtual void ShowShopHome(std::function<void()> finished, u128 user_id, bool full_display) = 0; |
| 89 | |||
| 90 | // Shows the user settings page of the shop. | ||
| 67 | virtual void ShowSettings(std::function<void()> finished, u128 user_id, bool full_display) = 0; | 91 | virtual void ShowSettings(std::function<void()> finished, u128 user_id, bool full_display) = 0; |
| 68 | }; | 92 | }; |
| 69 | 93 | ||
diff --git a/src/core/hle/service/am/applets/web_browser.cpp b/src/core/hle/service/am/applets/web_browser.cpp index 3c3af476c..3aa8f2468 100644 --- a/src/core/hle/service/am/applets/web_browser.cpp +++ b/src/core/hle/service/am/applets/web_browser.cpp | |||
| @@ -103,6 +103,17 @@ enum class ShimKind : u32 { | |||
| 103 | Lobby = 7, | 103 | Lobby = 7, |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | enum class ShopWebTarget { | ||
| 107 | ApplicationInfo, | ||
| 108 | AddOnContentList, | ||
| 109 | SubscriptionList, | ||
| 110 | ConsumableItemList, | ||
| 111 | Home, | ||
| 112 | Settings, | ||
| 113 | }; | ||
| 114 | |||
| 115 | namespace { | ||
| 116 | |||
| 106 | constexpr std::size_t SHIM_KIND_COUNT = 0x8; | 117 | constexpr std::size_t SHIM_KIND_COUNT = 0x8; |
| 107 | 118 | ||
| 108 | struct WebArgHeader { | 119 | struct WebArgHeader { |
| @@ -148,31 +159,20 @@ enum class OfflineWebSource : u32 { | |||
| 148 | SystemDataPage = 0x3, | 159 | SystemDataPage = 0x3, |
| 149 | }; | 160 | }; |
| 150 | 161 | ||
| 151 | enum class ShopWebTarget { | ||
| 152 | ApplicationInfo, | ||
| 153 | AddOnContentList, | ||
| 154 | SubscriptionList, | ||
| 155 | ConsumableItemList, | ||
| 156 | Home, | ||
| 157 | Settings, | ||
| 158 | }; | ||
| 159 | |||
| 160 | namespace { | ||
| 161 | |||
| 162 | std::map<WebArgTLVType, std::vector<u8>> GetWebArguments(const std::vector<u8>& arg) { | 162 | std::map<WebArgTLVType, std::vector<u8>> GetWebArguments(const std::vector<u8>& arg) { |
| 163 | WebArgHeader header{}; | ||
| 164 | if (arg.size() < sizeof(WebArgHeader)) | 163 | if (arg.size() < sizeof(WebArgHeader)) |
| 165 | return {}; | 164 | return {}; |
| 166 | 165 | ||
| 166 | WebArgHeader header{}; | ||
| 167 | std::memcpy(&header, arg.data(), sizeof(WebArgHeader)); | 167 | std::memcpy(&header, arg.data(), sizeof(WebArgHeader)); |
| 168 | 168 | ||
| 169 | std::map<WebArgTLVType, std::vector<u8>> out; | 169 | std::map<WebArgTLVType, std::vector<u8>> out; |
| 170 | u64 offset = sizeof(WebArgHeader); | 170 | u64 offset = sizeof(WebArgHeader); |
| 171 | for (std::size_t i = 0; i < header.count; ++i) { | 171 | for (std::size_t i = 0; i < header.count; ++i) { |
| 172 | WebArgTLV tlv{}; | ||
| 173 | if (arg.size() < (offset + sizeof(WebArgTLV))) | 172 | if (arg.size() < (offset + sizeof(WebArgTLV))) |
| 174 | return out; | 173 | return out; |
| 175 | 174 | ||
| 175 | WebArgTLV tlv{}; | ||
| 176 | std::memcpy(&tlv, arg.data() + offset, sizeof(WebArgTLV)); | 176 | std::memcpy(&tlv, arg.data() + offset, sizeof(WebArgTLV)); |
| 177 | offset += sizeof(WebArgTLV); | 177 | offset += sizeof(WebArgTLV); |
| 178 | 178 | ||
| @@ -392,7 +392,7 @@ void WebBrowser::InitializeShop() { | |||
| 392 | return; | 392 | return; |
| 393 | } | 393 | } |
| 394 | 394 | ||
| 395 | const std::map<std::string, ShopWebTarget> target_map{ | 395 | const std::map<std::string, ShopWebTarget, std::less<>> target_map{ |
| 396 | {"product_detail", ShopWebTarget::ApplicationInfo}, | 396 | {"product_detail", ShopWebTarget::ApplicationInfo}, |
| 397 | {"aocs", ShopWebTarget::AddOnContentList}, | 397 | {"aocs", ShopWebTarget::AddOnContentList}, |
| 398 | {"subscriptions", ShopWebTarget::SubscriptionList}, | 398 | {"subscriptions", ShopWebTarget::SubscriptionList}, |
| @@ -480,7 +480,7 @@ void WebBrowser::InitializeOffline() { | |||
| 480 | 480 | ||
| 481 | std::string path_additional_directory; | 481 | std::string path_additional_directory; |
| 482 | if (source == OfflineWebSource::OfflineHtmlPage) { | 482 | if (source == OfflineWebSource::OfflineHtmlPage) { |
| 483 | path_additional_directory = std::string(DIR_SEP) + "html-document"; | 483 | path_additional_directory = std::string(DIR_SEP).append("html-document"); |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | filename = | 486 | filename = |
diff --git a/src/core/hle/service/am/applets/web_browser.h b/src/core/hle/service/am/applets/web_browser.h index 42f0a3e8a..9667dcf6f 100644 --- a/src/core/hle/service/am/applets/web_browser.h +++ b/src/core/hle/service/am/applets/web_browser.h | |||
| @@ -67,7 +67,7 @@ private: | |||
| 67 | std::string filename; | 67 | std::string filename; |
| 68 | 68 | ||
| 69 | ShopWebTarget shop_web_target; | 69 | ShopWebTarget shop_web_target; |
| 70 | std::map<std::string, std::string> shop_query; | 70 | std::map<std::string, std::string, std::less<>> shop_query; |
| 71 | std::optional<u64> title_id = 0; | 71 | std::optional<u64> title_id = 0; |
| 72 | std::optional<u128> user_id; | 72 | std::optional<u128> user_id; |
| 73 | std::optional<bool> shop_full_display; | 73 | std::optional<bool> shop_full_display; |