diff options
author | bunnei <bunneidev@gmail.com> | 2018-11-23 18:02:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-23 18:02:25 +0100 |
commit | c267aea29b23f52add7c36578e55312b70480947 (patch) | |
tree | 39dc9177ca6b0fc6d8350b289e3e82bd6b935389 /src/core/hle/service/am/applets/stub_applet.cpp | |
parent | Merge pull request #1777 from lioncash/core-mgr (diff) | |
parent | am: Return StubApplet instead of nullptr when AppletId not found (diff) | |
download | yuzu-c267aea29b23f52add7c36578e55312b70480947.tar yuzu-c267aea29b23f52add7c36578e55312b70480947.tar.gz yuzu-c267aea29b23f52add7c36578e55312b70480947.tar.bz2 yuzu-c267aea29b23f52add7c36578e55312b70480947.tar.lz yuzu-c267aea29b23f52add7c36578e55312b70480947.tar.xz yuzu-c267aea29b23f52add7c36578e55312b70480947.tar.zst yuzu-c267aea29b23f52add7c36578e55312b70480947.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/service/am/applets/stub_applet.cpp | 70 |
1 files changed, 70 insertions, 0 deletions
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..ed166b87d --- /dev/null +++ b/src/core/hle/service/am/applets/stub_applet.cpp @@ -0,0 +1,70 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <string> + +#include "common/hex_util.h" +#include "common/logging/log.h" +#include "core/hle/result.h" +#include "core/hle/service/am/am.h" +#include "core/hle/service/am/applets/stub_applet.h" + +namespace Service::AM::Applets { + +static void LogCurrentStorage(AppletDataBroker& broker, std::string prefix) { + std::unique_ptr<IStorage> storage = broker.PopNormalDataToApplet(); + for (; storage != nullptr; storage = broker.PopNormalDataToApplet()) { + const auto data = storage->GetData(); + LOG_INFO(Service_AM, + "called (STUBBED), during {} recieved normal data with size={:08X}, data={}", + prefix, data.size(), Common::HexVectorToString(data)); + } + + storage = broker.PopInteractiveDataToApplet(); + for (; storage != nullptr; storage = broker.PopInteractiveDataToApplet()) { + const auto data = storage->GetData(); + LOG_INFO(Service_AM, + "called (STUBBED), during {} recieved interactive data with size={:08X}, data={}", + prefix, data.size(), Common::HexVectorToString(data)); + } +} + +StubApplet::StubApplet() = default; + +StubApplet::~StubApplet() = default; + +void StubApplet::Initialize() { + LOG_WARNING(Service_AM, "called (STUBBED)"); + Applet::Initialize(); + LogCurrentStorage(broker, "Initialize"); +} + +bool StubApplet::TransactionComplete() const { + LOG_WARNING(Service_AM, "called (STUBBED)"); + return true; +} + +ResultCode StubApplet::GetStatus() const { + LOG_WARNING(Service_AM, "called (STUBBED)"); + return RESULT_SUCCESS; +} + +void StubApplet::ExecuteInteractive() { + LOG_WARNING(Service_AM, "called (STUBBED)"); + LogCurrentStorage(broker, "ExecuteInteractive"); + + broker.PushNormalDataFromApplet(IStorage{std::vector<u8>(0x1000)}); + broker.PushInteractiveDataFromApplet(IStorage{std::vector<u8>(0x1000)}); + broker.SignalStateChanged(); +} + +void StubApplet::Execute() { + LOG_WARNING(Service_AM, "called (STUBBED)"); + LogCurrentStorage(broker, "Execute"); + + broker.PushNormalDataFromApplet(IStorage{std::vector<u8>(0x1000)}); + broker.PushInteractiveDataFromApplet(IStorage{std::vector<u8>(0x1000)}); + broker.SignalStateChanged(); +} +} // namespace Service::AM::Applets |