am: rewrite IProcessWindingController
This commit is contained in:
parent
c7e94e2175
commit
79f225bd59
|
@ -437,8 +437,6 @@ add_library(core STATIC
|
||||||
hle/service/am/managed_layer_holder.h
|
hle/service/am/managed_layer_holder.h
|
||||||
hle/service/am/omm.cpp
|
hle/service/am/omm.cpp
|
||||||
hle/service/am/omm.h
|
hle/service/am/omm.h
|
||||||
hle/service/am/process_winding_controller.cpp
|
|
||||||
hle/service/am/process_winding_controller.h
|
|
||||||
hle/service/am/process.cpp
|
hle/service/am/process.cpp
|
||||||
hle/service/am/process.h
|
hle/service/am/process.h
|
||||||
hle/service/am/self_controller.cpp
|
hle/service/am/self_controller.cpp
|
||||||
|
@ -475,6 +473,8 @@ add_library(core STATIC
|
||||||
hle/service/am/service/library_applet_proxy.h
|
hle/service/am/service/library_applet_proxy.h
|
||||||
hle/service/am/service/library_applet_self_accessor.cpp
|
hle/service/am/service/library_applet_self_accessor.cpp
|
||||||
hle/service/am/service/library_applet_self_accessor.h
|
hle/service/am/service/library_applet_self_accessor.h
|
||||||
|
hle/service/am/service/process_winding_controller.cpp
|
||||||
|
hle/service/am/service/process_winding_controller.h
|
||||||
hle/service/am/service/system_applet_proxy.cpp
|
hle/service/am/service/system_applet_proxy.cpp
|
||||||
hle/service/am/service/system_applet_proxy.h
|
hle/service/am/service/system_applet_proxy.h
|
||||||
hle/service/am/system_buffer_manager.cpp
|
hle/service/am/system_buffer_manager.cpp
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
||||||
|
|
||||||
#include "core/hle/service/am/frontend/applets.h"
|
|
||||||
#include "core/hle/service/am/process_winding_controller.h"
|
|
||||||
#include "core/hle/service/am/service/library_applet_accessor.h"
|
|
||||||
#include "core/hle/service/ipc_helpers.h"
|
|
||||||
|
|
||||||
namespace Service::AM {
|
|
||||||
|
|
||||||
IProcessWindingController::IProcessWindingController(Core::System& system_,
|
|
||||||
std::shared_ptr<Applet> applet_)
|
|
||||||
: ServiceFramework{system_, "IProcessWindingController"}, applet{std::move(applet_)} {
|
|
||||||
// clang-format off
|
|
||||||
static const FunctionInfo functions[] = {
|
|
||||||
{0, &IProcessWindingController::GetLaunchReason, "GetLaunchReason"},
|
|
||||||
{11, &IProcessWindingController::OpenCallingLibraryApplet, "OpenCallingLibraryApplet"},
|
|
||||||
{21, nullptr, "PushContext"},
|
|
||||||
{22, nullptr, "PopContext"},
|
|
||||||
{23, nullptr, "CancelWindingReservation"},
|
|
||||||
{30, nullptr, "WindAndDoReserved"},
|
|
||||||
{40, nullptr, "ReserveToStartAndWaitAndUnwindThis"},
|
|
||||||
{41, nullptr, "ReserveToStartAndWait"},
|
|
||||||
};
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
RegisterHandlers(functions);
|
|
||||||
}
|
|
||||||
|
|
||||||
IProcessWindingController::~IProcessWindingController() = default;
|
|
||||||
|
|
||||||
void IProcessWindingController::GetLaunchReason(HLERequestContext& ctx) {
|
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushRaw(applet->launch_reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IProcessWindingController::OpenCallingLibraryApplet(HLERequestContext& ctx) {
|
|
||||||
const auto caller_applet = applet->caller_applet.lock();
|
|
||||||
if (caller_applet == nullptr) {
|
|
||||||
LOG_ERROR(Service_AM, "No calling applet available");
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2};
|
|
||||||
rb.Push(ResultUnknown);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 2, 0, 1};
|
|
||||||
rb.Push(ResultSuccess);
|
|
||||||
rb.PushIpcInterface<ILibraryAppletAccessor>(system, applet->caller_applet_broker,
|
|
||||||
caller_applet);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Service::AM
|
|
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/am/process_winding_controller.h"
|
|
||||||
#include "core/hle/service/am/self_controller.h"
|
#include "core/hle/service/am/self_controller.h"
|
||||||
#include "core/hle/service/am/service/applet_common_functions.h"
|
#include "core/hle/service/am/service/applet_common_functions.h"
|
||||||
#include "core/hle/service/am/service/application_functions.h"
|
#include "core/hle/service/am/service/application_functions.h"
|
||||||
|
@ -11,6 +10,7 @@
|
||||||
#include "core/hle/service/am/service/debug_functions.h"
|
#include "core/hle/service/am/service/debug_functions.h"
|
||||||
#include "core/hle/service/am/service/display_controller.h"
|
#include "core/hle/service/am/service/display_controller.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/process_winding_controller.h"
|
||||||
#include "core/hle/service/am/window_controller.h"
|
#include "core/hle/service/am/window_controller.h"
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/am/process_winding_controller.h"
|
|
||||||
#include "core/hle/service/am/self_controller.h"
|
#include "core/hle/service/am/self_controller.h"
|
||||||
#include "core/hle/service/am/service/applet_common_functions.h"
|
#include "core/hle/service/am/service/applet_common_functions.h"
|
||||||
#include "core/hle/service/am/service/audio_controller.h"
|
#include "core/hle/service/am/service/audio_controller.h"
|
||||||
|
@ -13,6 +12,7 @@
|
||||||
#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/library_applet_proxy.h"
|
#include "core/hle/service/am/service/library_applet_proxy.h"
|
||||||
#include "core/hle/service/am/service/library_applet_self_accessor.h"
|
#include "core/hle/service/am/service/library_applet_self_accessor.h"
|
||||||
|
#include "core/hle/service/am/service/process_winding_controller.h"
|
||||||
#include "core/hle/service/am/window_controller.h"
|
#include "core/hle/service/am/window_controller.h"
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
// SPDX-FileCopyrightText: Copyright 2024 yuzu Emulator Project
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include "core/hle/service/am/frontend/applets.h"
|
||||||
|
#include "core/hle/service/am/service/library_applet_accessor.h"
|
||||||
|
#include "core/hle/service/am/service/process_winding_controller.h"
|
||||||
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
|
||||||
|
namespace Service::AM {
|
||||||
|
|
||||||
|
IProcessWindingController::IProcessWindingController(Core::System& system_,
|
||||||
|
std::shared_ptr<Applet> applet)
|
||||||
|
: ServiceFramework{system_, "IProcessWindingController"}, m_applet{std::move(applet)} {
|
||||||
|
// clang-format off
|
||||||
|
static const FunctionInfo functions[] = {
|
||||||
|
{0, D<&IProcessWindingController::GetLaunchReason>, "GetLaunchReason"},
|
||||||
|
{11, D<&IProcessWindingController::OpenCallingLibraryApplet>, "OpenCallingLibraryApplet"},
|
||||||
|
{21, nullptr, "PushContext"},
|
||||||
|
{22, nullptr, "PopContext"},
|
||||||
|
{23, nullptr, "CancelWindingReservation"},
|
||||||
|
{30, nullptr, "WindAndDoReserved"},
|
||||||
|
{40, nullptr, "ReserveToStartAndWaitAndUnwindThis"},
|
||||||
|
{41, nullptr, "ReserveToStartAndWait"},
|
||||||
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
RegisterHandlers(functions);
|
||||||
|
}
|
||||||
|
|
||||||
|
IProcessWindingController::~IProcessWindingController() = default;
|
||||||
|
|
||||||
|
Result IProcessWindingController::GetLaunchReason(
|
||||||
|
Out<AppletProcessLaunchReason> out_launch_reason) {
|
||||||
|
LOG_INFO(Service_AM, "called");
|
||||||
|
*out_launch_reason = m_applet->launch_reason;
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result IProcessWindingController::OpenCallingLibraryApplet(
|
||||||
|
Out<SharedPointer<ILibraryAppletAccessor>> out_calling_library_applet) {
|
||||||
|
LOG_INFO(Service_AM, "called");
|
||||||
|
|
||||||
|
const auto caller_applet = m_applet->caller_applet.lock();
|
||||||
|
if (caller_applet == nullptr) {
|
||||||
|
LOG_ERROR(Service_AM, "No caller applet available");
|
||||||
|
R_THROW(ResultUnknown);
|
||||||
|
}
|
||||||
|
|
||||||
|
*out_calling_library_applet = std::make_shared<ILibraryAppletAccessor>(
|
||||||
|
system, m_applet->caller_applet_broker, caller_applet);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Service::AM
|
|
@ -3,11 +3,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/hle/service/am/am_types.h"
|
||||||
|
#include "core/hle/service/cmif_types.h"
|
||||||
#include "core/hle/service/service.h"
|
#include "core/hle/service/service.h"
|
||||||
|
|
||||||
namespace Service::AM {
|
namespace Service::AM {
|
||||||
|
|
||||||
struct Applet;
|
struct Applet;
|
||||||
|
class ILibraryAppletAccessor;
|
||||||
|
|
||||||
class IProcessWindingController final : public ServiceFramework<IProcessWindingController> {
|
class IProcessWindingController final : public ServiceFramework<IProcessWindingController> {
|
||||||
public:
|
public:
|
||||||
|
@ -15,10 +18,11 @@ public:
|
||||||
~IProcessWindingController() override;
|
~IProcessWindingController() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void GetLaunchReason(HLERequestContext& ctx);
|
Result GetLaunchReason(Out<AppletProcessLaunchReason> out_launch_reason);
|
||||||
void OpenCallingLibraryApplet(HLERequestContext& ctx);
|
Result OpenCallingLibraryApplet(
|
||||||
|
Out<SharedPointer<ILibraryAppletAccessor>> out_calling_library_applet);
|
||||||
|
|
||||||
const std::shared_ptr<Applet> applet;
|
const std::shared_ptr<Applet> m_applet;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Service::AM
|
} // namespace Service::AM
|
|
@ -2,7 +2,6 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include "core/hle/service/am/application_creator.h"
|
#include "core/hle/service/am/application_creator.h"
|
||||||
#include "core/hle/service/am/process_winding_controller.h"
|
|
||||||
#include "core/hle/service/am/self_controller.h"
|
#include "core/hle/service/am/self_controller.h"
|
||||||
#include "core/hle/service/am/service/applet_common_functions.h"
|
#include "core/hle/service/am/service/applet_common_functions.h"
|
||||||
#include "core/hle/service/am/service/audio_controller.h"
|
#include "core/hle/service/am/service/audio_controller.h"
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
#include "core/hle/service/am/service/global_state_controller.h"
|
#include "core/hle/service/am/service/global_state_controller.h"
|
||||||
#include "core/hle/service/am/service/home_menu_functions.h"
|
#include "core/hle/service/am/service/home_menu_functions.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/process_winding_controller.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_controller.h"
|
#include "core/hle/service/am/window_controller.h"
|
||||||
#include "core/hle/service/cmif_serialization.h"
|
#include "core/hle/service/cmif_serialization.h"
|
||||||
|
|
Reference in New Issue