diff options
| author | 2018-11-21 21:20:02 -0500 | |
|---|---|---|
| committer | 2018-11-21 21:20:02 -0500 | |
| commit | 699900eed0fd25d0a60521e443d0d20e818c86d2 (patch) | |
| tree | 57bd7369b02ba59bd560030ffcd3f43da572e233 | |
| parent | Merge pull request #1753 from FernandoS27/ufbtype (diff) | |
| download | yuzu-699900eed0fd25d0a60521e443d0d20e818c86d2.tar.gz yuzu-699900eed0fd25d0a60521e443d0d20e818c86d2.tar.xz yuzu-699900eed0fd25d0a60521e443d0d20e818c86d2.zip | |
applets: Add StubApplet
This will log all data it receives, log all calls to its methods and push dummy data into both channels on execution.
| -rw-r--r-- | src/core/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/stub_applet.cpp | 65 | ||||
| -rw-r--r-- | src/core/hle/service/am/applets/stub_applet.h | 31 |
3 files changed, 98 insertions, 0 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a355eaca6..c100340d0 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -156,6 +156,8 @@ add_library(core STATIC | |||
| 156 | hle/service/am/applets/applets.h | 156 | hle/service/am/applets/applets.h |
| 157 | hle/service/am/applets/software_keyboard.cpp | 157 | hle/service/am/applets/software_keyboard.cpp |
| 158 | hle/service/am/applets/software_keyboard.h | 158 | hle/service/am/applets/software_keyboard.h |
| 159 | hle/service/am/applets/stub_applet.cpp | ||
| 160 | hle/service/am/applets/stub_applet.h | ||
| 159 | hle/service/am/idle.cpp | 161 | hle/service/am/idle.cpp |
| 160 | hle/service/am/idle.h | 162 | hle/service/am/idle.h |
| 161 | hle/service/am/omm.cpp | 163 | hle/service/am/omm.cpp |
diff --git a/src/core/hle/service/am/applets/stub_applet.cpp b/src/core/hle/service/am/applets/stub_applet.cpp new file mode 100644 index 000000000..c9bd3d973 --- /dev/null +++ b/src/core/hle/service/am/applets/stub_applet.cpp | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/hex_util.h" | ||
| 6 | #include "core/hle/service/am/applets/stub_applet.h" | ||
| 7 | |||
| 8 | namespace Service::AM::Applets { | ||
| 9 | |||
| 10 | static void LogCurrentStorage(AppletDataBroker& broker, std::string prefix) { | ||
| 11 | std::unique_ptr<IStorage> storage = broker.PopNormalDataToApplet(); | ||
| 12 | for (; storage != nullptr; storage = broker.PopNormalDataToApplet()) { | ||
| 13 | const auto data = storage->GetData(); | ||
| 14 | LOG_INFO(Service_AM, | ||
| 15 | "called (STUBBED), during {} recieved normal data with size={:08X}, data={}", | ||
| 16 | prefix, data.size(), Common::HexVectorToString(data)); | ||
| 17 | } | ||
| 18 | |||
| 19 | storage = broker.PopInteractiveDataToApplet(); | ||
| 20 | for (; storage != nullptr; storage = broker.PopInteractiveDataToApplet()) { | ||
| 21 | const auto data = storage->GetData(); | ||
| 22 | LOG_INFO(Service_AM, | ||
| 23 | "called (STUBBED), during {} recieved interactive data with size={:08X}, data={}", | ||
| 24 | prefix, data.size(), Common::HexVectorToString(data)); | ||
| 25 | } | ||
| 26 | } | ||
| 27 | |||
| 28 | StubApplet::StubApplet() = default; | ||
| 29 | |||
| 30 | StubApplet::~StubApplet() = default; | ||
| 31 | |||
| 32 | void StubApplet::Initialize() { | ||
| 33 | LOG_WARNING(Service_AM, "called (STUBBED)"); | ||
| 34 | Applet::Initialize(); | ||
| 35 | LogCurrentStorage(broker, "Initialize"); | ||
| 36 | } | ||
| 37 | |||
| 38 | bool StubApplet::TransactionComplete() const { | ||
| 39 | LOG_WARNING(Service_AM, "called (STUBBED)"); | ||
| 40 | return true; | ||
| 41 | } | ||
| 42 | |||
| 43 | ResultCode StubApplet::GetStatus() const { | ||
| 44 | LOG_WARNING(Service_AM, "called (STUBBED)"); | ||
| 45 | return RESULT_SUCCESS; | ||
| 46 | } | ||
| 47 | |||
| 48 | void StubApplet::ExecuteInteractive() { | ||
| 49 | LOG_WARNING(Service_AM, "called (STUBBED)"); | ||
| 50 | LogCurrentStorage(broker, "ExecuteInteractive"); | ||
| 51 | |||
| 52 | broker.PushNormalDataFromApplet(IStorage{std::vector<u8>(0x1000)}); | ||
| 53 | broker.PushInteractiveDataFromApplet(IStorage{std::vector<u8>(0x1000)}); | ||
| 54 | broker.SignalStateChanged(); | ||
| 55 | } | ||
| 56 | |||
| 57 | void StubApplet::Execute() { | ||
| 58 | LOG_WARNING(Service_AM, "called (STUBBED)"); | ||
| 59 | LogCurrentStorage(broker, "Execute"); | ||
| 60 | |||
| 61 | broker.PushNormalDataFromApplet(IStorage{std::vector<u8>(0x1000)}); | ||
| 62 | broker.PushInteractiveDataFromApplet(IStorage{std::vector<u8>(0x1000)}); | ||
| 63 | broker.SignalStateChanged(); | ||
| 64 | } | ||
| 65 | } // namespace Service::AM::Applets | ||
diff --git a/src/core/hle/service/am/applets/stub_applet.h b/src/core/hle/service/am/applets/stub_applet.h new file mode 100644 index 000000000..41add5fe6 --- /dev/null +++ b/src/core/hle/service/am/applets/stub_applet.h | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | // Copyright 2018 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <array> | ||
| 8 | #include <string> | ||
| 9 | #include <vector> | ||
| 10 | |||
| 11 | #include "common/common_funcs.h" | ||
| 12 | #include "common/swap.h" | ||
| 13 | #include "core/hle/service/am/am.h" | ||
| 14 | #include "core/hle/service/am/applets/applets.h" | ||
| 15 | |||
| 16 | namespace Service::AM::Applets { | ||
| 17 | |||
| 18 | class StubApplet final : public Applet { | ||
| 19 | public: | ||
| 20 | StubApplet(); | ||
| 21 | ~StubApplet() override; | ||
| 22 | |||
| 23 | void Initialize() override; | ||
| 24 | |||
| 25 | bool TransactionComplete() const override; | ||
| 26 | ResultCode GetStatus() const override; | ||
| 27 | void ExecuteInteractive() override; | ||
| 28 | void Execute() override; | ||
| 29 | }; | ||
| 30 | |||
| 31 | } // namespace Service::AM::Applets | ||