am: provide interface access to WindowSystem

This commit is contained in:
Liam 2024-02-25 20:50:54 -05:00
parent c623e7a86d
commit 7a57cf1a03
18 changed files with 91 additions and 49 deletions

View File

@ -18,10 +18,10 @@ void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system); auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("appletAE", server_manager->RegisterNamedService(
std::make_shared<IAllSystemAppletProxiesService>(system)); "appletAE", std::make_shared<IAllSystemAppletProxiesService>(system, window_system));
server_manager->RegisterNamedService("appletOE", server_manager->RegisterNamedService(
std::make_shared<IApplicationProxyService>(system)); "appletOE", std::make_shared<IApplicationProxyService>(system, window_system));
ServerManager::RunServer(std::move(server_manager)); ServerManager::RunServer(std::move(server_manager));
} }

View File

@ -6,12 +6,14 @@
#include "core/hle/service/am/service/all_system_applet_proxies_service.h" #include "core/hle/service/am/service/all_system_applet_proxies_service.h"
#include "core/hle/service/am/service/library_applet_proxy.h" #include "core/hle/service/am/service/library_applet_proxy.h"
#include "core/hle/service/am/service/system_applet_proxy.h" #include "core/hle/service/am/service/system_applet_proxy.h"
#include "core/hle/service/am/window_system.h"
#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/cmif_serialization.h"
namespace Service::AM { namespace Service::AM {
IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_) IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(Core::System& system_,
: ServiceFramework{system_, "appletAE"} { WindowSystem& window_system)
: ServiceFramework{system_, "appletAE"}, m_window_system{window_system} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"}, {100, D<&IAllSystemAppletProxiesService::OpenSystemAppletProxy>, "OpenSystemAppletProxy"},
@ -36,8 +38,8 @@ Result IAllSystemAppletProxiesService::OpenSystemAppletProxy(
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
if (const auto applet = this->GetAppletFromProcessId(pid); applet) { if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
*out_system_applet_proxy = *out_system_applet_proxy = std::make_shared<ISystemAppletProxy>(
std::make_shared<ISystemAppletProxy>(system, applet, process_handle.Get()); system, applet, process_handle.Get(), m_window_system);
R_SUCCEED(); R_SUCCEED();
} else { } else {
UNIMPLEMENTED(); UNIMPLEMENTED();
@ -52,8 +54,8 @@ Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
if (const auto applet = this->GetAppletFromProcessId(pid); applet) { if (const auto applet = this->GetAppletFromProcessId(pid); applet) {
*out_library_applet_proxy = *out_library_applet_proxy = std::make_shared<ILibraryAppletProxy>(
std::make_shared<ILibraryAppletProxy>(system, applet, process_handle.Get()); system, applet, process_handle.Get(), m_window_system);
R_SUCCEED(); R_SUCCEED();
} else { } else {
UNIMPLEMENTED(); UNIMPLEMENTED();

View File

@ -14,11 +14,12 @@ struct Applet;
struct AppletAttribute; struct AppletAttribute;
class ILibraryAppletProxy; class ILibraryAppletProxy;
class ISystemAppletProxy; class ISystemAppletProxy;
class WindowSystem;
class IAllSystemAppletProxiesService final class IAllSystemAppletProxiesService final
: public ServiceFramework<IAllSystemAppletProxiesService> { : public ServiceFramework<IAllSystemAppletProxiesService> {
public: public:
explicit IAllSystemAppletProxiesService(Core::System& system_); explicit IAllSystemAppletProxiesService(Core::System& system_, WindowSystem& window_system);
~IAllSystemAppletProxiesService() override; ~IAllSystemAppletProxiesService() override;
private: private:
@ -35,6 +36,8 @@ private:
private: private:
std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid); std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
WindowSystem& m_window_system;
}; };
} // namespace AM } // namespace AM

View File

@ -181,7 +181,8 @@ Result IApplicationFunctions::GetDesiredLanguage(Out<u64> out_language_code) {
} }
Result IApplicationFunctions::SetTerminateResult(Result terminate_result) { Result IApplicationFunctions::SetTerminateResult(Result terminate_result) {
LOG_INFO(Service_AM, "(STUBBED) called, result={:#x} ({}-{})", terminate_result.GetInnerValue(), LOG_INFO(Service_AM, "(STUBBED) called, result={:#x} ({:04}-{:04})",
terminate_result.GetInnerValue(),
static_cast<u32>(terminate_result.GetModule()) + 2000, static_cast<u32>(terminate_result.GetModule()) + 2000,
terminate_result.GetDescription()); terminate_result.GetDescription());

View File

@ -17,9 +17,9 @@
namespace Service::AM { namespace Service::AM {
IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, IApplicationProxy::IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process) Kernel::KProcess* process, WindowSystem& window_system)
: ServiceFramework{system_, "IApplicationProxy"}, m_process{process}, m_applet{ : ServiceFramework{system_, "IApplicationProxy"},
std::move(applet)} { m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, {0, D<&IApplicationProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
@ -70,7 +70,7 @@ Result IApplicationProxy::GetDebugFunctions(
Result IApplicationProxy::GetWindowController( Result IApplicationProxy::GetWindowController(
Out<SharedPointer<IWindowController>> out_window_controller) { Out<SharedPointer<IWindowController>> out_window_controller) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_window_controller = std::make_shared<IWindowController>(system, m_applet); *out_window_controller = std::make_shared<IWindowController>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }
@ -91,7 +91,8 @@ Result IApplicationProxy::GetCommonStateGetter(
Result IApplicationProxy::GetLibraryAppletCreator( Result IApplicationProxy::GetLibraryAppletCreator(
Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) { Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_library_applet_creator = std::make_shared<ILibraryAppletCreator>(system, m_applet); *out_library_applet_creator =
std::make_shared<ILibraryAppletCreator>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }

View File

@ -18,11 +18,12 @@ class ILibraryAppletCreator;
class IProcessWindingController; class IProcessWindingController;
class ISelfController; class ISelfController;
class IWindowController; class IWindowController;
class WindowSystem;
class IApplicationProxy final : public ServiceFramework<IApplicationProxy> { class IApplicationProxy final : public ServiceFramework<IApplicationProxy> {
public: public:
explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet, explicit IApplicationProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process); Kernel::KProcess* process, WindowSystem& window_system);
~IApplicationProxy(); ~IApplicationProxy();
private: private:
@ -40,6 +41,7 @@ private:
Out<SharedPointer<IApplicationFunctions>> out_application_functions); Out<SharedPointer<IApplicationFunctions>> out_application_functions);
private: private:
WindowSystem& m_window_system;
Kernel::KProcess* const m_process; Kernel::KProcess* const m_process;
const std::shared_ptr<Applet> m_applet; const std::shared_ptr<Applet> m_applet;
}; };

View File

@ -6,12 +6,14 @@
#include "core/hle/service/am/applet_manager.h" #include "core/hle/service/am/applet_manager.h"
#include "core/hle/service/am/service/application_proxy.h" #include "core/hle/service/am/service/application_proxy.h"
#include "core/hle/service/am/service/application_proxy_service.h" #include "core/hle/service/am/service/application_proxy_service.h"
#include "core/hle/service/am/window_system.h"
#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/cmif_serialization.h"
namespace Service::AM { namespace Service::AM {
IApplicationProxyService::IApplicationProxyService(Core::System& system_) IApplicationProxyService::IApplicationProxyService(Core::System& system_,
: ServiceFramework{system_, "appletOE"} { WindowSystem& window_system)
: ServiceFramework{system_, "appletOE"}, m_window_system{window_system} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"}, {0, D<&IApplicationProxyService::OpenApplicationProxy>, "OpenApplicationProxy"},
}; };
@ -26,8 +28,8 @@ Result IApplicationProxyService::OpenApplicationProxy(
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
if (const auto applet = this->GetAppletFromProcessId(pid)) { if (const auto applet = this->GetAppletFromProcessId(pid)) {
*out_application_proxy = *out_application_proxy = std::make_shared<IApplicationProxy>(
std::make_shared<IApplicationProxy>(system, applet, process_handle.Get()); system, applet, process_handle.Get(), m_window_system);
R_SUCCEED(); R_SUCCEED();
} else { } else {
UNIMPLEMENTED(); UNIMPLEMENTED();

View File

@ -12,10 +12,11 @@ namespace AM {
struct Applet; struct Applet;
class IApplicationProxy; class IApplicationProxy;
class WindowSystem;
class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> { class IApplicationProxyService final : public ServiceFramework<IApplicationProxyService> {
public: public:
explicit IApplicationProxyService(Core::System& system_); explicit IApplicationProxyService(Core::System& system_, WindowSystem& window_system);
~IApplicationProxyService() override; ~IApplicationProxyService() override;
private: private:
@ -24,6 +25,8 @@ private:
private: private:
std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid); std::shared_ptr<Applet> GetAppletFromProcessId(ProcessId pid);
WindowSystem& m_window_system;
}; };
} // namespace AM } // namespace AM

View File

@ -8,9 +8,11 @@
namespace Service::AM { namespace Service::AM {
IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet) IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet,
: ServiceFramework{system_, "IHomeMenuFunctions"}, m_applet{std::move(applet)}, WindowSystem& window_system)
m_context{system, "IHomeMenuFunctions"}, m_pop_from_general_channel_event{m_context} { : ServiceFramework{system_, "IHomeMenuFunctions"}, m_window_system{window_system},
m_applet{std::move(applet)}, m_context{system, "IHomeMenuFunctions"},
m_pop_from_general_channel_event{m_context} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"}, {10, D<&IHomeMenuFunctions::RequestToGetForeground>, "RequestToGetForeground"},

View File

@ -11,10 +11,12 @@
namespace Service::AM { namespace Service::AM {
struct Applet; struct Applet;
class WindowSystem;
class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> { class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
public: public:
explicit IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet); explicit IHomeMenuFunctions(Core::System& system_, std::shared_ptr<Applet> applet,
WindowSystem& window_system);
~IHomeMenuFunctions() override; ~IHomeMenuFunctions() override;
private: private:
@ -26,6 +28,7 @@ private:
Result IsForceTerminateApplicationDisabledForDebug( Result IsForceTerminateApplicationDisabledForDebug(
Out<bool> out_is_force_terminate_application_disabled_for_debug); Out<bool> out_is_force_terminate_application_disabled_for_debug);
WindowSystem& m_window_system;
const std::shared_ptr<Applet> m_applet; const std::shared_ptr<Applet> m_applet;
KernelHelpers::ServiceContext m_context; KernelHelpers::ServiceContext m_context;
Event m_pop_from_general_channel_event; Event m_pop_from_general_channel_event;

View File

@ -11,6 +11,7 @@
#include "core/hle/service/am/service/library_applet_accessor.h" #include "core/hle/service/am/service/library_applet_accessor.h"
#include "core/hle/service/am/service/library_applet_creator.h" #include "core/hle/service/am/service/library_applet_creator.h"
#include "core/hle/service/am/service/storage.h" #include "core/hle/service/am/service/storage.h"
#include "core/hle/service/am/window_system.h"
#include "core/hle/service/cmif_serialization.h" #include "core/hle/service/cmif_serialization.h"
#include "core/hle/service/sm/sm.h" #include "core/hle/service/sm/sm.h"
@ -94,6 +95,7 @@ AppletProgramId AppletIdToProgramId(AppletId applet_id) {
} }
std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system, std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system,
WindowSystem& window_system,
std::shared_ptr<Applet> caller_applet, std::shared_ptr<Applet> caller_applet,
AppletId applet_id, AppletId applet_id,
LibraryAppletMode mode) { LibraryAppletMode mode) {
@ -148,6 +150,7 @@ std::shared_ptr<ILibraryAppletAccessor> CreateGuestApplet(Core::System& system,
} }
std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& system, std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& system,
WindowSystem& window_system,
std::shared_ptr<Applet> caller_applet, std::shared_ptr<Applet> caller_applet,
AppletId applet_id, AppletId applet_id,
LibraryAppletMode mode) { LibraryAppletMode mode) {
@ -170,8 +173,10 @@ std::shared_ptr<ILibraryAppletAccessor> CreateFrontendApplet(Core::System& syste
} // namespace } // namespace
ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet) ILibraryAppletCreator::ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet,
: ServiceFramework{system_, "ILibraryAppletCreator"}, m_applet{std::move(applet)} { WindowSystem& window_system)
: ServiceFramework{system_, "ILibraryAppletCreator"},
m_window_system{window_system}, m_applet{std::move(applet)} {
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"}, {0, D<&ILibraryAppletCreator::CreateLibraryApplet>, "CreateLibraryApplet"},
{1, nullptr, "TerminateAllLibraryApplets"}, {1, nullptr, "TerminateAllLibraryApplets"},
@ -193,10 +198,12 @@ Result ILibraryAppletCreator::CreateLibraryApplet(
std::shared_ptr<ILibraryAppletAccessor> library_applet; std::shared_ptr<ILibraryAppletAccessor> library_applet;
if (ShouldCreateGuestApplet(applet_id)) { if (ShouldCreateGuestApplet(applet_id)) {
library_applet = CreateGuestApplet(system, m_applet, applet_id, library_applet_mode); library_applet =
CreateGuestApplet(system, m_window_system, m_applet, applet_id, library_applet_mode);
} }
if (!library_applet) { if (!library_applet) {
library_applet = CreateFrontendApplet(system, m_applet, applet_id, library_applet_mode); library_applet =
CreateFrontendApplet(system, m_window_system, m_applet, applet_id, library_applet_mode);
} }
if (!library_applet) { if (!library_applet) {
LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id); LOG_ERROR(Service_AM, "Applet doesn't exist! applet_id={}", applet_id);

View File

@ -12,10 +12,12 @@ namespace Service::AM {
struct Applet; struct Applet;
class ILibraryAppletAccessor; class ILibraryAppletAccessor;
class IStorage; class IStorage;
class WindowSystem;
class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> { class ILibraryAppletCreator final : public ServiceFramework<ILibraryAppletCreator> {
public: public:
explicit ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet); explicit ILibraryAppletCreator(Core::System& system_, std::shared_ptr<Applet> applet,
WindowSystem& window_system);
~ILibraryAppletCreator() override; ~ILibraryAppletCreator() override;
private: private:
@ -29,6 +31,7 @@ private:
Result CreateHandleStorage(Out<SharedPointer<IStorage>> out_storage, s64 size, Result CreateHandleStorage(Out<SharedPointer<IStorage>> out_storage, s64 size,
InCopyHandle<Kernel::KTransferMemory> transfer_memory_handle); InCopyHandle<Kernel::KTransferMemory> transfer_memory_handle);
WindowSystem& m_window_system;
const std::shared_ptr<Applet> m_applet; const std::shared_ptr<Applet> m_applet;
}; };

View File

@ -19,9 +19,9 @@
namespace Service::AM { namespace Service::AM {
ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, ILibraryAppletProxy::ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process) Kernel::KProcess* process, WindowSystem& window_system)
: ServiceFramework{system_, "ILibraryAppletProxy"}, m_process{process}, m_applet{ : ServiceFramework{system_, "ILibraryAppletProxy"},
std::move(applet)} { m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, {0, D<&ILibraryAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
@ -75,7 +75,7 @@ Result ILibraryAppletProxy::GetDebugFunctions(
Result ILibraryAppletProxy::GetWindowController( Result ILibraryAppletProxy::GetWindowController(
Out<SharedPointer<IWindowController>> out_window_controller) { Out<SharedPointer<IWindowController>> out_window_controller) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_window_controller = std::make_shared<IWindowController>(system, m_applet); *out_window_controller = std::make_shared<IWindowController>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }
@ -96,7 +96,8 @@ Result ILibraryAppletProxy::GetCommonStateGetter(
Result ILibraryAppletProxy::GetLibraryAppletCreator( Result ILibraryAppletProxy::GetLibraryAppletCreator(
Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) { Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_library_applet_creator = std::make_shared<ILibraryAppletCreator>(system, m_applet); *out_library_applet_creator =
std::make_shared<ILibraryAppletCreator>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }
@ -118,7 +119,8 @@ Result ILibraryAppletProxy::GetAppletCommonFunctions(
Result ILibraryAppletProxy::GetHomeMenuFunctions( Result ILibraryAppletProxy::GetHomeMenuFunctions(
Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system, m_applet); *out_home_menu_functions =
std::make_shared<IHomeMenuFunctions>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }

View File

@ -21,11 +21,12 @@ class ILibraryAppletSelfAccessor;
class IProcessWindingController; class IProcessWindingController;
class ISelfController; class ISelfController;
class IWindowController; class IWindowController;
class WindowSystem;
class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> { class ILibraryAppletProxy final : public ServiceFramework<ILibraryAppletProxy> {
public: public:
explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, explicit ILibraryAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process); Kernel::KProcess* process, WindowSystem& window_system);
~ILibraryAppletProxy(); ~ILibraryAppletProxy();
private: private:
@ -47,6 +48,7 @@ private:
Result GetGlobalStateController( Result GetGlobalStateController(
Out<SharedPointer<IGlobalStateController>> out_global_state_controller); Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
WindowSystem& m_window_system;
Kernel::KProcess* const m_process; Kernel::KProcess* const m_process;
const std::shared_ptr<Applet> m_applet; const std::shared_ptr<Applet> m_applet;
}; };

View File

@ -19,9 +19,9 @@
namespace Service::AM { namespace Service::AM {
ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet, ISystemAppletProxy::ISystemAppletProxy(Core::System& system_, std::shared_ptr<Applet> applet,
Kernel::KProcess* process) Kernel::KProcess* process, WindowSystem& window_system)
: ServiceFramework{system_, "ISystemAppletProxy"}, m_process{process}, m_applet{ : ServiceFramework{system_, "ISystemAppletProxy"},
std::move(applet)} { m_window_system{window_system}, m_process{process}, m_applet{std::move(applet)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"}, {0, D<&ISystemAppletProxy::GetCommonStateGetter>, "GetCommonStateGetter"},
@ -75,7 +75,7 @@ Result ISystemAppletProxy::GetDebugFunctions(
Result ISystemAppletProxy::GetWindowController( Result ISystemAppletProxy::GetWindowController(
Out<SharedPointer<IWindowController>> out_window_controller) { Out<SharedPointer<IWindowController>> out_window_controller) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_window_controller = std::make_shared<IWindowController>(system, m_applet); *out_window_controller = std::make_shared<IWindowController>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }
@ -96,7 +96,8 @@ Result ISystemAppletProxy::GetCommonStateGetter(
Result ISystemAppletProxy::GetLibraryAppletCreator( Result ISystemAppletProxy::GetLibraryAppletCreator(
Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) { Out<SharedPointer<ILibraryAppletCreator>> out_library_applet_creator) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_library_applet_creator = std::make_shared<ILibraryAppletCreator>(system, m_applet); *out_library_applet_creator =
std::make_shared<ILibraryAppletCreator>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }
@ -117,7 +118,8 @@ Result ISystemAppletProxy::GetAppletCommonFunctions(
Result ISystemAppletProxy::GetHomeMenuFunctions( Result ISystemAppletProxy::GetHomeMenuFunctions(
Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) { Out<SharedPointer<IHomeMenuFunctions>> out_home_menu_functions) {
LOG_DEBUG(Service_AM, "called"); LOG_DEBUG(Service_AM, "called");
*out_home_menu_functions = std::make_shared<IHomeMenuFunctions>(system, m_applet); *out_home_menu_functions =
std::make_shared<IHomeMenuFunctions>(system, m_applet, m_window_system);
R_SUCCEED(); R_SUCCEED();
} }

View File

@ -21,11 +21,12 @@ class ILibraryAppletCreator;
class IProcessWindingController; class IProcessWindingController;
class ISelfController; class ISelfController;
class IWindowController; class IWindowController;
class WindowSystem;
class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> { class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
public: public:
explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet, explicit ISystemAppletProxy(Core::System& system, std::shared_ptr<Applet> applet,
Kernel::KProcess* process); Kernel::KProcess* process, WindowSystem& window_system);
~ISystemAppletProxy(); ~ISystemAppletProxy();
private: private:
@ -46,6 +47,7 @@ private:
Result GetGlobalStateController( Result GetGlobalStateController(
Out<SharedPointer<IGlobalStateController>> out_global_state_controller); Out<SharedPointer<IGlobalStateController>> out_global_state_controller);
WindowSystem& m_window_system;
Kernel::KProcess* const m_process; Kernel::KProcess* const m_process;
const std::shared_ptr<Applet> m_applet; const std::shared_ptr<Applet> m_applet;
}; };

View File

@ -8,8 +8,10 @@
namespace Service::AM { namespace Service::AM {
IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet) IWindowController::IWindowController(Core::System& system_, std::shared_ptr<Applet> applet,
: ServiceFramework{system_, "IWindowController"}, m_applet{std::move(applet)} { WindowSystem& window_system)
: ServiceFramework{system_, "IWindowController"},
m_window_system{window_system}, m_applet{std::move(applet)} {
// clang-format off // clang-format off
static const FunctionInfo functions[] = { static const FunctionInfo functions[] = {
{0, nullptr, "CreateWindow"}, {0, nullptr, "CreateWindow"},

View File

@ -9,10 +9,12 @@
namespace Service::AM { namespace Service::AM {
struct Applet; struct Applet;
class WindowSystem;
class IWindowController final : public ServiceFramework<IWindowController> { class IWindowController final : public ServiceFramework<IWindowController> {
public: public:
explicit IWindowController(Core::System& system_, std::shared_ptr<Applet> applet); explicit IWindowController(Core::System& system_, std::shared_ptr<Applet> applet,
WindowSystem& window_system);
~IWindowController() override; ~IWindowController() override;
private: private:
@ -24,6 +26,7 @@ private:
Result SetAppletWindowVisibility(bool visible); Result SetAppletWindowVisibility(bool visible);
Result SetAppletGpuTimeSlice(s64 time_slice); Result SetAppletGpuTimeSlice(s64 time_slice);
WindowSystem& m_window_system;
const std::shared_ptr<Applet> m_applet; const std::shared_ptr<Applet> m_applet;
}; };