summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets/stub_applet.cpp
blob: ed166b87d15998ac4b312428d7419cebe8fea393 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
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