am: rewrite IAppletCommonFunctions

This commit is contained in:
Liam 2024-02-11 19:23:26 -05:00
parent 590e86792c
commit af35057212
6 changed files with 27 additions and 25 deletions

View file

@ -421,8 +421,6 @@ add_library(core STATIC
hle/service/am/applet_data_broker.cpp hle/service/am/applet_data_broker.cpp
hle/service/am/applet_data_broker.h hle/service/am/applet_data_broker.h
hle/service/am/applet_manager.h hle/service/am/applet_manager.h
hle/service/am/applet_common_functions.cpp
hle/service/am/applet_common_functions.h
hle/service/am/applet_message_queue.cpp hle/service/am/applet_message_queue.cpp
hle/service/am/applet_message_queue.h hle/service/am/applet_message_queue.h
hle/service/am/application_creator.cpp hle/service/am/application_creator.cpp
@ -465,6 +463,8 @@ add_library(core STATIC
hle/service/am/self_controller.h hle/service/am/self_controller.h
hle/service/am/service/all_system_applet_proxies_service.cpp hle/service/am/service/all_system_applet_proxies_service.cpp
hle/service/am/service/all_system_applet_proxies_service.h hle/service/am/service/all_system_applet_proxies_service.h
hle/service/am/service/applet_common_functions.cpp
hle/service/am/service/applet_common_functions.h
hle/service/am/service/application_proxy_service.cpp hle/service/am/service/application_proxy_service.cpp
hle/service/am/service/application_proxy_service.h hle/service/am/service/application_proxy_service.h
hle/service/am/service/application_proxy.cpp hle/service/am/service/application_proxy.cpp

View file

@ -2,8 +2,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/am/applet.h" #include "core/hle/service/am/applet.h"
#include "core/hle/service/am/applet_common_functions.h" #include "core/hle/service/am/service/applet_common_functions.h"
#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/cmif_serialization.h"
namespace Service::AM { namespace Service::AM {
@ -20,18 +20,18 @@ IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_,
{40, nullptr, "GetDisplayLogicalResolution"}, {40, nullptr, "GetDisplayLogicalResolution"},
{42, nullptr, "SetDisplayMagnification"}, {42, nullptr, "SetDisplayMagnification"},
{50, nullptr, "SetHomeButtonDoubleClickEnabled"}, {50, nullptr, "SetHomeButtonDoubleClickEnabled"},
{51, nullptr, "GetHomeButtonDoubleClickEnabled"}, {51, D<&IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled>, "GetHomeButtonDoubleClickEnabled"},
{52, nullptr, "IsHomeButtonShortPressedBlocked"}, {52, nullptr, "IsHomeButtonShortPressedBlocked"},
{60, nullptr, "IsVrModeCurtainRequired"}, {60, nullptr, "IsVrModeCurtainRequired"},
{61, nullptr, "IsSleepRequiredByHighTemperature"}, {61, nullptr, "IsSleepRequiredByHighTemperature"},
{62, nullptr, "IsSleepRequiredByLowBattery"}, {62, nullptr, "IsSleepRequiredByLowBattery"},
{70, &IAppletCommonFunctions::SetCpuBoostRequestPriority, "SetCpuBoostRequestPriority"}, {70, D<&IAppletCommonFunctions::SetCpuBoostRequestPriority>, "SetCpuBoostRequestPriority"},
{80, nullptr, "SetHandlingCaptureButtonShortPressedMessageEnabledForApplet"}, {80, nullptr, "SetHandlingCaptureButtonShortPressedMessageEnabledForApplet"},
{81, nullptr, "SetHandlingCaptureButtonLongPressedMessageEnabledForApplet"}, {81, nullptr, "SetHandlingCaptureButtonLongPressedMessageEnabledForApplet"},
{90, nullptr, "OpenNamedChannelAsParent"}, {90, nullptr, "OpenNamedChannelAsParent"},
{91, nullptr, "OpenNamedChannelAsChild"}, {91, nullptr, "OpenNamedChannelAsChild"},
{100, nullptr, "SetApplicationCoreUsageMode"}, {100, nullptr, "SetApplicationCoreUsageMode"},
{300, &IAppletCommonFunctions::GetCurrentApplicationId, "GetCurrentApplicationId"}, {300, D<&IAppletCommonFunctions::GetCurrentApplicationId>, "GetCurrentApplicationId"},
}; };
// clang-format on // clang-format on
@ -40,24 +40,24 @@ IAppletCommonFunctions::IAppletCommonFunctions(Core::System& system_,
IAppletCommonFunctions::~IAppletCommonFunctions() = default; IAppletCommonFunctions::~IAppletCommonFunctions() = default;
void IAppletCommonFunctions::SetCpuBoostRequestPriority(HLERequestContext& ctx) { Result IAppletCommonFunctions::GetHomeButtonDoubleClickEnabled(
Out<bool> out_home_button_double_click_enabled) {
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
*out_home_button_double_click_enabled = false;
IPC::RequestParser rp{ctx}; R_SUCCEED();
std::scoped_lock lk{applet->lock};
applet->cpu_boost_request_priority = rp.Pop<s32>();
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
} }
void IAppletCommonFunctions::GetCurrentApplicationId(HLERequestContext& ctx) { Result IAppletCommonFunctions::SetCpuBoostRequestPriority(s32 priority) {
LOG_WARNING(Service_AM, "(STUBBED) called"); LOG_WARNING(Service_AM, "(STUBBED) called");
std::scoped_lock lk{applet->lock};
applet->cpu_boost_request_priority = priority;
R_SUCCEED();
}
IPC::ResponseBuilder rb{ctx, 4}; Result IAppletCommonFunctions::GetCurrentApplicationId(Out<u64> out_application_id) {
rb.Push(ResultSuccess); LOG_WARNING(Service_AM, "(STUBBED) called");
rb.Push<u64>(system.GetApplicationProcessProgramID() & ~0xFFFULL); *out_application_id = system.GetApplicationProcessProgramID() & ~0xFFFULL;
R_SUCCEED();
} }
} // namespace Service::AM } // namespace Service::AM

View file

@ -3,6 +3,7 @@
#pragma once #pragma once
#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 {
@ -15,8 +16,9 @@ public:
~IAppletCommonFunctions() override; ~IAppletCommonFunctions() override;
private: private:
void SetCpuBoostRequestPriority(HLERequestContext& ctx); Result GetHomeButtonDoubleClickEnabled(Out<bool> out_home_button_double_click_enabled);
void GetCurrentApplicationId(HLERequestContext& ctx); Result SetCpuBoostRequestPriority(s32 priority);
Result GetCurrentApplicationId(Out<u64> out_application_id);
const std::shared_ptr<Applet> applet; const std::shared_ptr<Applet> applet;
}; };

View file

@ -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/applet_common_functions.h"
#include "core/hle/service/am/application_functions.h" #include "core/hle/service/am/application_functions.h"
#include "core/hle/service/am/common_state_getter.h" #include "core/hle/service/am/common_state_getter.h"
#include "core/hle/service/am/debug_functions.h" #include "core/hle/service/am/debug_functions.h"
@ -10,6 +9,7 @@
#include "core/hle/service/am/library_applet_self_accessor.h" #include "core/hle/service/am/library_applet_self_accessor.h"
#include "core/hle/service/am/process_winding_controller.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/application_proxy.h" #include "core/hle/service/am/service/application_proxy.h"
#include "core/hle/service/am/service/audio_controller.h" #include "core/hle/service/am/service/audio_controller.h"
#include "core/hle/service/am/window_controller.h" #include "core/hle/service/am/window_controller.h"

View file

@ -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/applet_common_functions.h"
#include "core/hle/service/am/common_state_getter.h" #include "core/hle/service/am/common_state_getter.h"
#include "core/hle/service/am/debug_functions.h" #include "core/hle/service/am/debug_functions.h"
#include "core/hle/service/am/display_controller.h" #include "core/hle/service/am/display_controller.h"
@ -11,6 +10,7 @@
#include "core/hle/service/am/library_applet_self_accessor.h" #include "core/hle/service/am/library_applet_self_accessor.h"
#include "core/hle/service/am/process_winding_controller.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/audio_controller.h" #include "core/hle/service/am/service/audio_controller.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/window_controller.h" #include "core/hle/service/am/window_controller.h"

View file

@ -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/applet_common_functions.h"
#include "core/hle/service/am/application_creator.h" #include "core/hle/service/am/application_creator.h"
#include "core/hle/service/am/common_state_getter.h" #include "core/hle/service/am/common_state_getter.h"
#include "core/hle/service/am/debug_functions.h" #include "core/hle/service/am/debug_functions.h"
@ -12,6 +11,7 @@
#include "core/hle/service/am/library_applet_self_accessor.h" #include "core/hle/service/am/library_applet_self_accessor.h"
#include "core/hle/service/am/process_winding_controller.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/audio_controller.h" #include "core/hle/service/am/service/audio_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"