summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/am/applets/applet_profile_select.h
blob: 85705c216aa8a800f0bc591399df47b21beaf809 (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
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#include <vector>

#include "common/common_funcs.h"
#include "common/uuid.h"
#include "core/hle/result.h"
#include "core/hle/service/am/applets/applets.h"

namespace Core {
class System;
}

namespace Service::AM::Applets {

struct UserSelectionConfig {
    // TODO(DarkLordZach): RE this structure
    // It seems to be flags and the like that determine the UI of the applet on the switch... from
    // my research this is safe to ignore for now.
    INSERT_PADDING_BYTES(0xA0);
};
static_assert(sizeof(UserSelectionConfig) == 0xA0, "UserSelectionConfig has incorrect size.");

struct UserSelectionOutput {
    u64 result;
    Common::UUID uuid_selected;
};
static_assert(sizeof(UserSelectionOutput) == 0x18, "UserSelectionOutput has incorrect size.");

class ProfileSelect final : public Applet {
public:
    explicit ProfileSelect(Core::System& system_, LibraryAppletMode applet_mode_,
                           const Core::Frontend::ProfileSelectApplet& frontend_);
    ~ProfileSelect() override;

    void Initialize() override;

    bool TransactionComplete() const override;
    Result GetStatus() const override;
    void ExecuteInteractive() override;
    void Execute() override;
    Result RequestExit() override;

    void SelectionComplete(std::optional<Common::UUID> uuid);

private:
    const Core::Frontend::ProfileSelectApplet& frontend;

    UserSelectionConfig config;
    bool complete = false;
    Result status = ResultSuccess;
    std::vector<u8> final_data;
    Core::System& system;
};

} // namespace Service::AM::Applets