diff options
| author | 2019-05-17 21:47:07 -0400 | |
|---|---|---|
| committer | 2019-05-25 16:09:20 -0400 | |
| commit | bdc47693f154ffe41f16a452f65d9bd609a72683 (patch) | |
| tree | c42661106b8c1d0b9efcc54e9cd55ba697dbeb3e /src | |
| parent | svc: Save report on call to svcBreak (diff) | |
| download | yuzu-bdc47693f154ffe41f16a452f65d9bd609a72683.tar.gz yuzu-bdc47693f154ffe41f16a452f65d9bd609a72683.tar.xz yuzu-bdc47693f154ffe41f16a452f65d9bd609a72683.zip | |
applets: Save report on stubbed applet
This also reworks the applet data storage to be peekable.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/am/applets/applets.cpp | 33 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/applets.h | 16 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/general_backend.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/general_backend.h | 5 |
4 files changed, 49 insertions, 15 deletions
diff --git a/src/core/hle/service/am/applets/applets.cpp b/src/core/hle/service/am/applets/applets.cpp index e812c66e9..2a945bc7b 100644 --- a/src/core/hle/service/am/applets/applets.cpp +++ b/src/core/hle/service/am/applets/applets.cpp | |||
| @@ -35,12 +35,27 @@ AppletDataBroker::AppletDataBroker() { | |||
| 35 | 35 | ||
| 36 | AppletDataBroker::~AppletDataBroker() = default; | 36 | AppletDataBroker::~AppletDataBroker() = default; |
| 37 | 37 | ||
| 38 | AppletDataBroker::RawChannelData AppletDataBroker::PeekDataToAppletForDebug() const { | ||
| 39 | std::vector<std::vector<u8>> out_normal; | ||
| 40 | std::vector<std::vector<u8>> out_interactive; | ||
| 41 | |||
| 42 | for (const auto& storage : in_channel) { | ||
| 43 | out_normal.push_back(storage->GetData()); | ||
| 44 | } | ||
| 45 | |||
| 46 | for (const auto& storage : in_interactive_channel) { | ||
| 47 | out_interactive.push_back(storage->GetData()); | ||
| 48 | } | ||
| 49 | |||
| 50 | return {out_normal, out_interactive}; | ||
| 51 | } | ||
| 52 | |||
| 38 | std::unique_ptr<IStorage> AppletDataBroker::PopNormalDataToGame() { | 53 | std::unique_ptr<IStorage> AppletDataBroker::PopNormalDataToGame() { |
| 39 | if (out_channel.empty()) | 54 | if (out_channel.empty()) |
| 40 | return nullptr; | 55 | return nullptr; |
| 41 | 56 | ||
| 42 | auto out = std::move(out_channel.front()); | 57 | auto out = std::move(out_channel.front()); |
| 43 | out_channel.pop(); | 58 | out_channel.pop_front(); |
| 44 | return out; | 59 | return out; |
| 45 | } | 60 | } |
| 46 | 61 | ||
| @@ -49,7 +64,7 @@ std::unique_ptr<IStorage> AppletDataBroker::PopNormalDataToApplet() { | |||
| 49 | return nullptr; | 64 | return nullptr; |
| 50 | 65 | ||
| 51 | auto out = std::move(in_channel.front()); | 66 | auto out = std::move(in_channel.front()); |
| 52 | in_channel.pop(); | 67 | in_channel.pop_front(); |
| 53 | return out; | 68 | return out; |
| 54 | } | 69 | } |
| 55 | 70 | ||
| @@ -58,7 +73,7 @@ std::unique_ptr<IStorage> AppletDataBroker::PopInteractiveDataToGame() { | |||
| 58 | return nullptr; | 73 | return nullptr; |
| 59 | 74 | ||
| 60 | auto out = std::move(out_interactive_channel.front()); | 75 | auto out = std::move(out_interactive_channel.front()); |
| 61 | out_interactive_channel.pop(); | 76 | out_interactive_channel.pop_front(); |
| 62 | return out; | 77 | return out; |
| 63 | } | 78 | } |
| 64 | 79 | ||
| @@ -67,25 +82,25 @@ std::unique_ptr<IStorage> AppletDataBroker::PopInteractiveDataToApplet() { | |||
| 67 | return nullptr; | 82 | return nullptr; |
| 68 | 83 | ||
| 69 | auto out = std::move(in_interactive_channel.front()); | 84 | auto out = std::move(in_interactive_channel.front()); |
| 70 | in_interactive_channel.pop(); | 85 | in_interactive_channel.pop_front(); |
| 71 | return out; | 86 | return out; |
| 72 | } | 87 | } |
| 73 | 88 | ||
| 74 | void AppletDataBroker::PushNormalDataFromGame(IStorage storage) { | 89 | void AppletDataBroker::PushNormalDataFromGame(IStorage storage) { |
| 75 | in_channel.push(std::make_unique<IStorage>(storage)); | 90 | in_channel.push_back(std::make_unique<IStorage>(storage)); |
| 76 | } | 91 | } |
| 77 | 92 | ||
| 78 | void AppletDataBroker::PushNormalDataFromApplet(IStorage storage) { | 93 | void AppletDataBroker::PushNormalDataFromApplet(IStorage storage) { |
| 79 | out_channel.push(std::make_unique<IStorage>(storage)); | 94 | out_channel.push_back(std::make_unique<IStorage>(storage)); |
| 80 | pop_out_data_event.writable->Signal(); | 95 | pop_out_data_event.writable->Signal(); |
| 81 | } | 96 | } |
| 82 | 97 | ||
| 83 | void AppletDataBroker::PushInteractiveDataFromGame(IStorage storage) { | 98 | void AppletDataBroker::PushInteractiveDataFromGame(IStorage storage) { |
| 84 | in_interactive_channel.push(std::make_unique<IStorage>(storage)); | 99 | in_interactive_channel.push_back(std::make_unique<IStorage>(storage)); |
| 85 | } | 100 | } |
| 86 | 101 | ||
| 87 | void AppletDataBroker::PushInteractiveDataFromApplet(IStorage storage) { | 102 | void AppletDataBroker::PushInteractiveDataFromApplet(IStorage storage) { |
| 88 | out_interactive_channel.push(std::make_unique<IStorage>(storage)); | 103 | out_interactive_channel.push_back(std::make_unique<IStorage>(storage)); |
| 89 | pop_interactive_out_data_event.writable->Signal(); | 104 | pop_interactive_out_data_event.writable->Signal(); |
| 90 | } | 105 | } |
| 91 | 106 | ||
| @@ -189,7 +204,7 @@ std::shared_ptr<Applet> AppletManager::GetApplet(AppletId id) const { | |||
| 189 | UNIMPLEMENTED_MSG( | 204 | UNIMPLEMENTED_MSG( |
| 190 | "No backend implementation exists for applet_id={:02X}! Falling back to stub applet.", | 205 | "No backend implementation exists for applet_id={:02X}! Falling back to stub applet.", |
| 191 | static_cast<u8>(id)); | 206 | static_cast<u8>(id)); |
| 192 | return std::make_shared<StubApplet>(); | 207 | return std::make_shared<StubApplet>(id); |
| 193 | } | 208 | } |
| 194 | } | 209 | } |
| 195 | 210 | ||
diff --git a/src/core/hle/service/am/applets/applets.h b/src/core/hle/service/am/applets/applets.h index 7f932672c..8c2c15968 100644 --- a/src/core/hle/service/am/applets/applets.h +++ b/src/core/hle/service/am/applets/applets.h | |||
| @@ -54,6 +54,14 @@ public: | |||
| 54 | AppletDataBroker(); | 54 | AppletDataBroker(); |
| 55 | ~AppletDataBroker(); | 55 | ~AppletDataBroker(); |
| 56 | 56 | ||
| 57 | struct RawChannelData { | ||
| 58 | std::vector<std::vector<u8>> normal; | ||
| 59 | std::vector<std::vector<u8>> interactive; | ||
| 60 | }; | ||
| 61 | |||
| 62 | // Retrieves but does not pop the data sent to applet. | ||
| 63 | RawChannelData PeekDataToAppletForDebug() const; | ||
| 64 | |||
| 57 | std::unique_ptr<IStorage> PopNormalDataToGame(); | 65 | std::unique_ptr<IStorage> PopNormalDataToGame(); |
| 58 | std::unique_ptr<IStorage> PopNormalDataToApplet(); | 66 | std::unique_ptr<IStorage> PopNormalDataToApplet(); |
| 59 | 67 | ||
| @@ -76,16 +84,16 @@ private: | |||
| 76 | // Queues are named from applet's perspective | 84 | // Queues are named from applet's perspective |
| 77 | 85 | ||
| 78 | // PopNormalDataToApplet and PushNormalDataFromGame | 86 | // PopNormalDataToApplet and PushNormalDataFromGame |
| 79 | std::queue<std::unique_ptr<IStorage>> in_channel; | 87 | std::deque<std::unique_ptr<IStorage>> in_channel; |
| 80 | 88 | ||
| 81 | // PopNormalDataToGame and PushNormalDataFromApplet | 89 | // PopNormalDataToGame and PushNormalDataFromApplet |
| 82 | std::queue<std::unique_ptr<IStorage>> out_channel; | 90 | std::deque<std::unique_ptr<IStorage>> out_channel; |
| 83 | 91 | ||
| 84 | // PopInteractiveDataToApplet and PushInteractiveDataFromGame | 92 | // PopInteractiveDataToApplet and PushInteractiveDataFromGame |
| 85 | std::queue<std::unique_ptr<IStorage>> in_interactive_channel; | 93 | std::deque<std::unique_ptr<IStorage>> in_interactive_channel; |
| 86 | 94 | ||
| 87 | // PopInteractiveDataToGame and PushInteractiveDataFromApplet | 95 | // PopInteractiveDataToGame and PushInteractiveDataFromApplet |
| 88 | std::queue<std::unique_ptr<IStorage>> out_interactive_channel; | 96 | std::deque<std::unique_ptr<IStorage>> out_interactive_channel; |
| 89 | 97 | ||
| 90 | Kernel::EventPair state_changed_event; | 98 | Kernel::EventPair state_changed_event; |
| 91 | 99 | ||
diff --git a/src/core/hle/service/am/applets/general_backend.cpp b/src/core/hle/service/am/applets/general_backend.cpp index c591b9ac2..55865176c 100644 --- a/src/core/hle/service/am/applets/general_backend.cpp +++ b/src/core/hle/service/am/applets/general_backend.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "core/hle/result.h" | 13 | #include "core/hle/result.h" |
| 14 | #include "core/hle/service/am/am.h" | 14 | #include "core/hle/service/am/am.h" |
| 15 | #include "core/hle/service/am/applets/general_backend.h" | 15 | #include "core/hle/service/am/applets/general_backend.h" |
| 16 | #include "core/reporter.h" | ||
| 16 | 17 | ||
| 17 | namespace Service::AM::Applets { | 18 | namespace Service::AM::Applets { |
| 18 | 19 | ||
| @@ -83,13 +84,20 @@ void PhotoViewer::ViewFinished() { | |||
| 83 | broker.SignalStateChanged(); | 84 | broker.SignalStateChanged(); |
| 84 | } | 85 | } |
| 85 | 86 | ||
| 86 | StubApplet::StubApplet() = default; | 87 | StubApplet::StubApplet(AppletId id) : id(id) {} |
| 87 | 88 | ||
| 88 | StubApplet::~StubApplet() = default; | 89 | StubApplet::~StubApplet() = default; |
| 89 | 90 | ||
| 90 | void StubApplet::Initialize() { | 91 | void StubApplet::Initialize() { |
| 91 | LOG_WARNING(Service_AM, "called (STUBBED)"); | 92 | LOG_WARNING(Service_AM, "called (STUBBED)"); |
| 92 | Applet::Initialize(); | 93 | Applet::Initialize(); |
| 94 | |||
| 95 | const auto data = broker.PeekDataToAppletForDebug(); | ||
| 96 | Core::System::GetInstance().GetReporter().SaveUnimplementedAppletReport( | ||
| 97 | static_cast<u32>(id), common_args.arguments_version, common_args.library_version, | ||
| 98 | common_args.theme_color, common_args.play_startup_sound, common_args.system_tick, | ||
| 99 | data.normal, data.interactive); | ||
| 100 | |||
| 93 | LogCurrentStorage(broker, "Initialize"); | 101 | LogCurrentStorage(broker, "Initialize"); |
| 94 | } | 102 | } |
| 95 | 103 | ||
diff --git a/src/core/hle/service/am/applets/general_backend.h b/src/core/hle/service/am/applets/general_backend.h index 2dd255d7c..bc919a8dd 100644 --- a/src/core/hle/service/am/applets/general_backend.h +++ b/src/core/hle/service/am/applets/general_backend.h | |||
| @@ -34,7 +34,7 @@ private: | |||
| 34 | 34 | ||
| 35 | class StubApplet final : public Applet { | 35 | class StubApplet final : public Applet { |
| 36 | public: | 36 | public: |
| 37 | StubApplet(); | 37 | StubApplet(AppletId id); |
| 38 | ~StubApplet() override; | 38 | ~StubApplet() override; |
| 39 | 39 | ||
| 40 | void Initialize() override; | 40 | void Initialize() override; |
| @@ -43,6 +43,9 @@ public: | |||
| 43 | ResultCode GetStatus() const override; | 43 | ResultCode GetStatus() const override; |
| 44 | void ExecuteInteractive() override; | 44 | void ExecuteInteractive() override; |
| 45 | void Execute() override; | 45 | void Execute() override; |
| 46 | |||
| 47 | private: | ||
| 48 | AppletId id; | ||
| 46 | }; | 49 | }; |
| 47 | 50 | ||
| 48 | } // namespace Service::AM::Applets | 51 | } // namespace Service::AM::Applets |