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 "core/hle/service/glue/manager.h"
8 #include "core/hle/service/service.h"
9 
10 namespace Service::Account {
11 
12 class ProfileManager;
13 
14 class Module final {
15 public:
16     class Interface : public ServiceFramework<Interface> {
17     public:
18         explicit Interface(std::shared_ptr<Module> module_,
19                            std::shared_ptr<ProfileManager> profile_manager_, Core::System& system_,
20                            const char* name);
21         ~Interface() override;
22 
23         void GetUserCount(Kernel::HLERequestContext& ctx);
24         void GetUserExistence(Kernel::HLERequestContext& ctx);
25         void ListAllUsers(Kernel::HLERequestContext& ctx);
26         void ListOpenUsers(Kernel::HLERequestContext& ctx);
27         void GetLastOpenedUser(Kernel::HLERequestContext& ctx);
28         void GetProfile(Kernel::HLERequestContext& ctx);
29         void InitializeApplicationInfo(Kernel::HLERequestContext& ctx);
30         void InitializeApplicationInfoRestricted(Kernel::HLERequestContext& ctx);
31         void GetBaasAccountManagerForApplication(Kernel::HLERequestContext& ctx);
32         void IsUserRegistrationRequestPermitted(Kernel::HLERequestContext& ctx);
33         void TrySelectUserWithoutInteraction(Kernel::HLERequestContext& ctx);
34         void IsUserAccountSwitchLocked(Kernel::HLERequestContext& ctx);
35         void GetProfileEditor(Kernel::HLERequestContext& ctx);
36         void ListQualifiedUsers(Kernel::HLERequestContext& ctx);
37         void LoadOpenContext(Kernel::HLERequestContext& ctx);
38         void ListOpenContextStoredUsers(Kernel::HLERequestContext& ctx);
39 
40     private:
41         ResultCode InitializeApplicationInfoBase();
42 
43         enum class ApplicationType : u32_le {
44             GameCard = 0,
45             Digital = 1,
46             Unknown = 3,
47         };
48 
49         struct ApplicationInfo {
50             Service::Glue::ApplicationLaunchProperty launch_property;
51             ApplicationType application_type;
52 
53             constexpr explicit operator bool() const {
54                 return launch_property.title_id != 0x0;
55             }
56         };
57 
58         ApplicationInfo application_info{};
59 
60     protected:
61         std::shared_ptr<Module> module;
62         std::shared_ptr<ProfileManager> profile_manager;
63     };
64 };
65 
66 /// Registers all ACC services with the specified service manager.
67 void InstallInterfaces(Core::System& system);
68 
69 } // namespace Service::Account
70