From a164635f32ea5d196d864029aa26ef24bf022eee Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 11 May 2022 23:15:03 +0100 Subject: [PATCH] Stub LibraryAppletPlayerSelect --- app/CMakeLists.txt | 1 + .../cpp/skyline/applet/applet_creator.cpp | 3 ++ .../skyline/applet/player_select_applet.cpp | 32 ++++++++++++++++ .../cpp/skyline/applet/player_select_applet.h | 37 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 app/src/main/cpp/skyline/applet/player_select_applet.cpp create mode 100644 app/src/main/cpp/skyline/applet/player_select_applet.h diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 6f36d588..7d04cd0c 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -258,6 +258,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/btm/IBtmUserCore.cpp ${source_DIR}/skyline/applet/applet_creator.cpp ${source_DIR}/skyline/applet/controller_applet.cpp + ${source_DIR}/skyline/applet/player_select_applet.cpp ${source_DIR}/skyline/services/codec/IHardwareOpusDecoder.cpp ${source_DIR}/skyline/services/codec/IHardwareOpusDecoderManager.cpp ${source_DIR}/skyline/services/hid/IHidServer.cpp diff --git a/app/src/main/cpp/skyline/applet/applet_creator.cpp b/app/src/main/cpp/skyline/applet/applet_creator.cpp index f10d39a0..5f5d17fd 100644 --- a/app/src/main/cpp/skyline/applet/applet_creator.cpp +++ b/app/src/main/cpp/skyline/applet/applet_creator.cpp @@ -2,6 +2,7 @@ // Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) #include "controller_applet.h" +#include "player_select_applet.h" #include "applet_creator.h" namespace skyline::applet { @@ -14,6 +15,8 @@ namespace skyline::applet { switch (appletId) { case AppletId::LibraryAppletController: return std::make_shared(state, manager, std::move(onAppletStateChanged), std::move(onNormalDataPushFromApplet), std::move(onInteractiveDataPushFromApplet), appletMode); + case AppletId::LibraryAppletPlayerSelect: + return std::make_shared(state, manager, std::move(onAppletStateChanged), std::move(onNormalDataPushFromApplet), std::move(onInteractiveDataPushFromApplet), appletMode); default: throw exception("Unimplemented Applet: 0x{:X} ({})", static_cast(appletId), ToString(appletId)); } diff --git a/app/src/main/cpp/skyline/applet/player_select_applet.cpp b/app/src/main/cpp/skyline/applet/player_select_applet.cpp new file mode 100644 index 00000000..23e0b923 --- /dev/null +++ b/app/src/main/cpp/skyline/applet/player_select_applet.cpp @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#include +#include "player_select_applet.h" + +namespace skyline::applet { + PlayerSelectApplet::PlayerSelectApplet(const DeviceState &state, + service::ServiceManager &manager, + std::shared_ptr onAppletStateChanged, + std::shared_ptr onNormalDataPushFromApplet, + std::shared_ptr onInteractiveDataPushFromApplet, + service::applet::LibraryAppletMode appletMode) + : IApplet(state, manager, std::move(onAppletStateChanged), std::move(onNormalDataPushFromApplet), std::move(onInteractiveDataPushFromApplet), appletMode) {} + + Result PlayerSelectApplet::Start() { + // Return default user + PushNormalDataAndSignal(std::make_shared>(state, manager, AccountResult{})); + + // Notify the guest that we've finished running + onAppletStateChanged->Signal(); + return {}; + }; + + Result PlayerSelectApplet::GetResult() { + return {}; + } + + void PlayerSelectApplet::PushNormalDataToApplet(std::shared_ptr data) {} + + void PlayerSelectApplet::PushInteractiveDataToApplet(std::shared_ptr data) {} +} diff --git a/app/src/main/cpp/skyline/applet/player_select_applet.h b/app/src/main/cpp/skyline/applet/player_select_applet.h new file mode 100644 index 00000000..29a31adb --- /dev/null +++ b/app/src/main/cpp/skyline/applet/player_select_applet.h @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: MPL-2.0 +// Copyright © 2022 Skyline Team and Contributors (https://github.com/skyline-emu/) + +#pragma once + +#include +#include +#include + +namespace skyline::applet { + /** + * @brief The player select applet is responsible for allowing the user to select a player to use with the application + */ + class PlayerSelectApplet : public service::am::IApplet { + private: + /** + * @brief Result structure for the player select applet + */ + struct AccountResult { + Result result{}; + u32 _pad_; + service::account::UserId accountId{constant::DefaultUserId}; + }; + static_assert(sizeof(AccountResult) == 0x18); + + public: + PlayerSelectApplet(const DeviceState &state, service::ServiceManager &manager, std::shared_ptr onAppletStateChanged, std::shared_ptr onNormalDataPushFromApplet, std::shared_ptr onInteractiveDataPushFromApplet, service::applet::LibraryAppletMode appletMode); + + Result Start() override; + + Result GetResult() override; + + void PushNormalDataToApplet(std::shared_ptr data) override; + + void PushInteractiveDataToApplet(std::shared_ptr data) override; + }; +} \ No newline at end of file