From c6d7da88c7ab125279ea4ccad0e3e839632b2f7a Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 14 Jul 2021 00:52:17 -0400 Subject: service: Append service name prefix to common filenames --- src/core/hle/service/apm/apm.cpp | 2 +- src/core/hle/service/apm/apm_controller.cpp | 89 ++++++++++++++++++ src/core/hle/service/apm/apm_controller.h | 70 ++++++++++++++ src/core/hle/service/apm/apm_interface.cpp | 138 ++++++++++++++++++++++++++++ src/core/hle/service/apm/apm_interface.h | 43 +++++++++ src/core/hle/service/apm/controller.cpp | 89 ------------------ src/core/hle/service/apm/controller.h | 70 -------------- src/core/hle/service/apm/interface.cpp | 138 ---------------------------- src/core/hle/service/apm/interface.h | 43 --------- 9 files changed, 341 insertions(+), 341 deletions(-) create mode 100644 src/core/hle/service/apm/apm_controller.cpp create mode 100644 src/core/hle/service/apm/apm_controller.h create mode 100644 src/core/hle/service/apm/apm_interface.cpp create mode 100644 src/core/hle/service/apm/apm_interface.h delete mode 100644 src/core/hle/service/apm/controller.cpp delete mode 100644 src/core/hle/service/apm/controller.h delete mode 100644 src/core/hle/service/apm/interface.cpp delete mode 100644 src/core/hle/service/apm/interface.h (limited to 'src/core/hle/service/apm') diff --git a/src/core/hle/service/apm/apm.cpp b/src/core/hle/service/apm/apm.cpp index 97d6619dd..f5ebfe8d6 100644 --- a/src/core/hle/service/apm/apm.cpp +++ b/src/core/hle/service/apm/apm.cpp @@ -5,7 +5,7 @@ #include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/service/apm/apm.h" -#include "core/hle/service/apm/interface.h" +#include "core/hle/service/apm/apm_interface.h" namespace Service::APM { diff --git a/src/core/hle/service/apm/apm_controller.cpp b/src/core/hle/service/apm/apm_controller.cpp new file mode 100644 index 000000000..98839fe97 --- /dev/null +++ b/src/core/hle/service/apm/apm_controller.cpp @@ -0,0 +1,89 @@ +// Copyright 2019 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include +#include +#include + +#include "common/logging/log.h" +#include "common/settings.h" +#include "core/core_timing.h" +#include "core/hle/service/apm/apm_controller.h" + +namespace Service::APM { + +constexpr auto DEFAULT_PERFORMANCE_CONFIGURATION = PerformanceConfiguration::Config7; + +Controller::Controller(Core::Timing::CoreTiming& core_timing_) + : core_timing{core_timing_}, configs{ + {PerformanceMode::Handheld, DEFAULT_PERFORMANCE_CONFIGURATION}, + {PerformanceMode::Docked, DEFAULT_PERFORMANCE_CONFIGURATION}, + } {} + +Controller::~Controller() = default; + +void Controller::SetPerformanceConfiguration(PerformanceMode mode, + PerformanceConfiguration config) { + static constexpr std::array, 16> config_to_speed{{ + {PerformanceConfiguration::Config1, 1020}, + {PerformanceConfiguration::Config2, 1020}, + {PerformanceConfiguration::Config3, 1224}, + {PerformanceConfiguration::Config4, 1020}, + {PerformanceConfiguration::Config5, 1020}, + {PerformanceConfiguration::Config6, 1224}, + {PerformanceConfiguration::Config7, 1020}, + {PerformanceConfiguration::Config8, 1020}, + {PerformanceConfiguration::Config9, 1020}, + {PerformanceConfiguration::Config10, 1020}, + {PerformanceConfiguration::Config11, 1020}, + {PerformanceConfiguration::Config12, 1020}, + {PerformanceConfiguration::Config13, 1785}, + {PerformanceConfiguration::Config14, 1785}, + {PerformanceConfiguration::Config15, 1020}, + {PerformanceConfiguration::Config16, 1020}, + }}; + + const auto iter = std::find_if(config_to_speed.cbegin(), config_to_speed.cend(), + [config](const auto& entry) { return entry.first == config; }); + + if (iter == config_to_speed.cend()) { + LOG_ERROR(Service_APM, "Invalid performance configuration value provided: {}", config); + return; + } + + SetClockSpeed(iter->second); + configs.insert_or_assign(mode, config); +} + +void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { + constexpr std::array BOOST_MODE_TO_CONFIG_MAP{{ + PerformanceConfiguration::Config7, + PerformanceConfiguration::Config13, + PerformanceConfiguration::Config15, + }}; + + SetPerformanceConfiguration(PerformanceMode::Docked, + BOOST_MODE_TO_CONFIG_MAP.at(static_cast(mode))); +} + +PerformanceMode Controller::GetCurrentPerformanceMode() const { + return Settings::values.use_docked_mode.GetValue() ? PerformanceMode::Docked + : PerformanceMode::Handheld; +} + +PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { + if (configs.find(mode) == configs.end()) { + configs.insert_or_assign(mode, DEFAULT_PERFORMANCE_CONFIGURATION); + } + + return configs[mode]; +} + +void Controller::SetClockSpeed(u32 mhz) { + LOG_INFO(Service_APM, "called, mhz={:08X}", mhz); + // TODO(DarkLordZach): Actually signal core_timing to change clock speed. + // TODO(Rodrigo): Remove [[maybe_unused]] when core_timing is used. +} + +} // namespace Service::APM diff --git a/src/core/hle/service/apm/apm_controller.h b/src/core/hle/service/apm/apm_controller.h new file mode 100644 index 000000000..8d48e0104 --- /dev/null +++ b/src/core/hle/service/apm/apm_controller.h @@ -0,0 +1,70 @@ +// Copyright 2019 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include "common/common_types.h" + +namespace Core::Timing { +class CoreTiming; +} + +namespace Service::APM { + +enum class PerformanceConfiguration : u32 { + Config1 = 0x00010000, + Config2 = 0x00010001, + Config3 = 0x00010002, + Config4 = 0x00020000, + Config5 = 0x00020001, + Config6 = 0x00020002, + Config7 = 0x00020003, + Config8 = 0x00020004, + Config9 = 0x00020005, + Config10 = 0x00020006, + Config11 = 0x92220007, + Config12 = 0x92220008, + Config13 = 0x92220009, + Config14 = 0x9222000A, + Config15 = 0x9222000B, + Config16 = 0x9222000C, +}; + +enum class CpuBoostMode : u32 { + Disabled = 0, + Full = 1, // CPU + GPU -> Config 13, 14, 15, or 16 + Partial = 2, // GPU Only -> Config 15 or 16 +}; + +enum class PerformanceMode : u8 { + Handheld = 0, + Docked = 1, +}; + +// Class to manage the state and change of the emulated system performance. +// Specifically, this deals with PerformanceMode, which corresponds to the system being docked or +// undocked, and PerformanceConfig which specifies the exact CPU, GPU, and Memory clocks to operate +// at. Additionally, this manages 'Boost Mode', which allows games to temporarily overclock the +// system during times of high load -- this simply maps to different PerformanceConfigs to use. +class Controller { +public: + explicit Controller(Core::Timing::CoreTiming& core_timing_); + ~Controller(); + + void SetPerformanceConfiguration(PerformanceMode mode, PerformanceConfiguration config); + void SetFromCpuBoostMode(CpuBoostMode mode); + + PerformanceMode GetCurrentPerformanceMode() const; + PerformanceConfiguration GetCurrentPerformanceConfiguration(PerformanceMode mode); + +private: + void SetClockSpeed(u32 mhz); + + [[maybe_unused]] Core::Timing::CoreTiming& core_timing; + + std::map configs; +}; + +} // namespace Service::APM diff --git a/src/core/hle/service/apm/apm_interface.cpp b/src/core/hle/service/apm/apm_interface.cpp new file mode 100644 index 000000000..e58bad083 --- /dev/null +++ b/src/core/hle/service/apm/apm_interface.cpp @@ -0,0 +1,138 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "common/logging/log.h" +#include "core/hle/ipc_helpers.h" +#include "core/hle/service/apm/apm.h" +#include "core/hle/service/apm/apm_controller.h" +#include "core/hle/service/apm/apm_interface.h" + +namespace Service::APM { + +class ISession final : public ServiceFramework { +public: + explicit ISession(Core::System& system_, Controller& controller_) + : ServiceFramework{system_, "ISession"}, controller{controller_} { + static const FunctionInfo functions[] = { + {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, + {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, + {2, nullptr, "SetCpuOverclockEnabled"}, + }; + RegisterHandlers(functions); + } + +private: + void SetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + const auto mode = rp.PopEnum(); + const auto config = rp.PopEnum(); + LOG_DEBUG(Service_APM, "called mode={} config={}", mode, config); + + controller.SetPerformanceConfiguration(mode, config); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + + const auto mode = rp.PopEnum(); + LOG_DEBUG(Service_APM, "called mode={}", mode); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.PushEnum(controller.GetCurrentPerformanceConfiguration(mode)); + } + + Controller& controller; +}; + +APM::APM(Core::System& system_, std::shared_ptr apm_, Controller& controller_, + const char* name) + : ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} { + static const FunctionInfo functions[] = { + {0, &APM::OpenSession, "OpenSession"}, + {1, &APM::GetPerformanceMode, "GetPerformanceMode"}, + {6, &APM::IsCpuOverclockEnabled, "IsCpuOverclockEnabled"}, + }; + RegisterHandlers(functions); +} + +APM::~APM() = default; + +void APM::OpenSession(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_APM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system, controller); +} + +void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_APM, "called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.PushEnum(controller.GetCurrentPerformanceMode()); +} + +void APM::IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_APM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(false); +} + +APM_Sys::APM_Sys(Core::System& system_, Controller& controller_) + : ServiceFramework{system_, "apm:sys"}, controller{controller_} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "RequestPerformanceMode"}, + {1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, + {2, nullptr, "GetThrottlingState"}, + {3, nullptr, "GetLastThrottlingState"}, + {4, nullptr, "ClearLastThrottlingState"}, + {5, nullptr, "LoadAndApplySettings"}, + {6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, + {7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +APM_Sys::~APM_Sys() = default; + +void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_APM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system, controller); +} + +void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto mode = rp.PopEnum(); + + LOG_DEBUG(Service_APM, "called, mode={:08X}", mode); + + controller.SetFromCpuBoostMode(mode); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void APM_Sys::GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_APM, "called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.PushEnum( + controller.GetCurrentPerformanceConfiguration(controller.GetCurrentPerformanceMode())); +} + +} // namespace Service::APM diff --git a/src/core/hle/service/apm/apm_interface.h b/src/core/hle/service/apm/apm_interface.h new file mode 100644 index 000000000..063ad5308 --- /dev/null +++ b/src/core/hle/service/apm/apm_interface.h @@ -0,0 +1,43 @@ +// Copyright 2018 yuzu emulator team +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include "core/hle/service/service.h" + +namespace Service::APM { + +class Controller; +class Module; + +class APM final : public ServiceFramework { +public: + explicit APM(Core::System& system_, std::shared_ptr apm_, Controller& controller_, + const char* name); + ~APM() override; + +private: + void OpenSession(Kernel::HLERequestContext& ctx); + void GetPerformanceMode(Kernel::HLERequestContext& ctx); + void IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx); + + std::shared_ptr apm; + Controller& controller; +}; + +class APM_Sys final : public ServiceFramework { +public: + explicit APM_Sys(Core::System& system_, Controller& controller); + ~APM_Sys() override; + + void SetCpuBoostMode(Kernel::HLERequestContext& ctx); + +private: + void GetPerformanceEvent(Kernel::HLERequestContext& ctx); + void GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx); + + Controller& controller; +}; + +} // namespace Service::APM diff --git a/src/core/hle/service/apm/controller.cpp b/src/core/hle/service/apm/controller.cpp deleted file mode 100644 index 8bfa7c0e4..000000000 --- a/src/core/hle/service/apm/controller.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2019 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include -#include -#include - -#include "common/logging/log.h" -#include "common/settings.h" -#include "core/core_timing.h" -#include "core/hle/service/apm/controller.h" - -namespace Service::APM { - -constexpr auto DEFAULT_PERFORMANCE_CONFIGURATION = PerformanceConfiguration::Config7; - -Controller::Controller(Core::Timing::CoreTiming& core_timing_) - : core_timing{core_timing_}, configs{ - {PerformanceMode::Handheld, DEFAULT_PERFORMANCE_CONFIGURATION}, - {PerformanceMode::Docked, DEFAULT_PERFORMANCE_CONFIGURATION}, - } {} - -Controller::~Controller() = default; - -void Controller::SetPerformanceConfiguration(PerformanceMode mode, - PerformanceConfiguration config) { - static constexpr std::array, 16> config_to_speed{{ - {PerformanceConfiguration::Config1, 1020}, - {PerformanceConfiguration::Config2, 1020}, - {PerformanceConfiguration::Config3, 1224}, - {PerformanceConfiguration::Config4, 1020}, - {PerformanceConfiguration::Config5, 1020}, - {PerformanceConfiguration::Config6, 1224}, - {PerformanceConfiguration::Config7, 1020}, - {PerformanceConfiguration::Config8, 1020}, - {PerformanceConfiguration::Config9, 1020}, - {PerformanceConfiguration::Config10, 1020}, - {PerformanceConfiguration::Config11, 1020}, - {PerformanceConfiguration::Config12, 1020}, - {PerformanceConfiguration::Config13, 1785}, - {PerformanceConfiguration::Config14, 1785}, - {PerformanceConfiguration::Config15, 1020}, - {PerformanceConfiguration::Config16, 1020}, - }}; - - const auto iter = std::find_if(config_to_speed.cbegin(), config_to_speed.cend(), - [config](const auto& entry) { return entry.first == config; }); - - if (iter == config_to_speed.cend()) { - LOG_ERROR(Service_APM, "Invalid performance configuration value provided: {}", config); - return; - } - - SetClockSpeed(iter->second); - configs.insert_or_assign(mode, config); -} - -void Controller::SetFromCpuBoostMode(CpuBoostMode mode) { - constexpr std::array BOOST_MODE_TO_CONFIG_MAP{{ - PerformanceConfiguration::Config7, - PerformanceConfiguration::Config13, - PerformanceConfiguration::Config15, - }}; - - SetPerformanceConfiguration(PerformanceMode::Docked, - BOOST_MODE_TO_CONFIG_MAP.at(static_cast(mode))); -} - -PerformanceMode Controller::GetCurrentPerformanceMode() const { - return Settings::values.use_docked_mode.GetValue() ? PerformanceMode::Docked - : PerformanceMode::Handheld; -} - -PerformanceConfiguration Controller::GetCurrentPerformanceConfiguration(PerformanceMode mode) { - if (configs.find(mode) == configs.end()) { - configs.insert_or_assign(mode, DEFAULT_PERFORMANCE_CONFIGURATION); - } - - return configs[mode]; -} - -void Controller::SetClockSpeed(u32 mhz) { - LOG_INFO(Service_APM, "called, mhz={:08X}", mhz); - // TODO(DarkLordZach): Actually signal core_timing to change clock speed. - // TODO(Rodrigo): Remove [[maybe_unused]] when core_timing is used. -} - -} // namespace Service::APM diff --git a/src/core/hle/service/apm/controller.h b/src/core/hle/service/apm/controller.h deleted file mode 100644 index 8d48e0104..000000000 --- a/src/core/hle/service/apm/controller.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2019 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include -#include "common/common_types.h" - -namespace Core::Timing { -class CoreTiming; -} - -namespace Service::APM { - -enum class PerformanceConfiguration : u32 { - Config1 = 0x00010000, - Config2 = 0x00010001, - Config3 = 0x00010002, - Config4 = 0x00020000, - Config5 = 0x00020001, - Config6 = 0x00020002, - Config7 = 0x00020003, - Config8 = 0x00020004, - Config9 = 0x00020005, - Config10 = 0x00020006, - Config11 = 0x92220007, - Config12 = 0x92220008, - Config13 = 0x92220009, - Config14 = 0x9222000A, - Config15 = 0x9222000B, - Config16 = 0x9222000C, -}; - -enum class CpuBoostMode : u32 { - Disabled = 0, - Full = 1, // CPU + GPU -> Config 13, 14, 15, or 16 - Partial = 2, // GPU Only -> Config 15 or 16 -}; - -enum class PerformanceMode : u8 { - Handheld = 0, - Docked = 1, -}; - -// Class to manage the state and change of the emulated system performance. -// Specifically, this deals with PerformanceMode, which corresponds to the system being docked or -// undocked, and PerformanceConfig which specifies the exact CPU, GPU, and Memory clocks to operate -// at. Additionally, this manages 'Boost Mode', which allows games to temporarily overclock the -// system during times of high load -- this simply maps to different PerformanceConfigs to use. -class Controller { -public: - explicit Controller(Core::Timing::CoreTiming& core_timing_); - ~Controller(); - - void SetPerformanceConfiguration(PerformanceMode mode, PerformanceConfiguration config); - void SetFromCpuBoostMode(CpuBoostMode mode); - - PerformanceMode GetCurrentPerformanceMode() const; - PerformanceConfiguration GetCurrentPerformanceConfiguration(PerformanceMode mode); - -private: - void SetClockSpeed(u32 mhz); - - [[maybe_unused]] Core::Timing::CoreTiming& core_timing; - - std::map configs; -}; - -} // namespace Service::APM diff --git a/src/core/hle/service/apm/interface.cpp b/src/core/hle/service/apm/interface.cpp deleted file mode 100644 index d69ddd135..000000000 --- a/src/core/hle/service/apm/interface.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright 2018 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#include "common/logging/log.h" -#include "core/hle/ipc_helpers.h" -#include "core/hle/service/apm/apm.h" -#include "core/hle/service/apm/controller.h" -#include "core/hle/service/apm/interface.h" - -namespace Service::APM { - -class ISession final : public ServiceFramework { -public: - explicit ISession(Core::System& system_, Controller& controller_) - : ServiceFramework{system_, "ISession"}, controller{controller_} { - static const FunctionInfo functions[] = { - {0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"}, - {1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"}, - {2, nullptr, "SetCpuOverclockEnabled"}, - }; - RegisterHandlers(functions); - } - -private: - void SetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - - const auto mode = rp.PopEnum(); - const auto config = rp.PopEnum(); - LOG_DEBUG(Service_APM, "called mode={} config={}", mode, config); - - controller.SetPerformanceConfiguration(mode, config); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); - } - - void GetPerformanceConfiguration(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - - const auto mode = rp.PopEnum(); - LOG_DEBUG(Service_APM, "called mode={}", mode); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.PushEnum(controller.GetCurrentPerformanceConfiguration(mode)); - } - - Controller& controller; -}; - -APM::APM(Core::System& system_, std::shared_ptr apm_, Controller& controller_, - const char* name) - : ServiceFramework{system_, name}, apm(std::move(apm_)), controller{controller_} { - static const FunctionInfo functions[] = { - {0, &APM::OpenSession, "OpenSession"}, - {1, &APM::GetPerformanceMode, "GetPerformanceMode"}, - {6, &APM::IsCpuOverclockEnabled, "IsCpuOverclockEnabled"}, - }; - RegisterHandlers(functions); -} - -APM::~APM() = default; - -void APM::OpenSession(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_APM, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(system, controller); -} - -void APM::GetPerformanceMode(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_APM, "called"); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.PushEnum(controller.GetCurrentPerformanceMode()); -} - -void APM::IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx) { - LOG_WARNING(Service_APM, "(STUBBED) called"); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(false); -} - -APM_Sys::APM_Sys(Core::System& system_, Controller& controller_) - : ServiceFramework{system_, "apm:sys"}, controller{controller_} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "RequestPerformanceMode"}, - {1, &APM_Sys::GetPerformanceEvent, "GetPerformanceEvent"}, - {2, nullptr, "GetThrottlingState"}, - {3, nullptr, "GetLastThrottlingState"}, - {4, nullptr, "ClearLastThrottlingState"}, - {5, nullptr, "LoadAndApplySettings"}, - {6, &APM_Sys::SetCpuBoostMode, "SetCpuBoostMode"}, - {7, &APM_Sys::GetCurrentPerformanceConfiguration, "GetCurrentPerformanceConfiguration"}, - }; - // clang-format on - - RegisterHandlers(functions); -} - -APM_Sys::~APM_Sys() = default; - -void APM_Sys::GetPerformanceEvent(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_APM, "called"); - - IPC::ResponseBuilder rb{ctx, 2, 0, 1}; - rb.Push(ResultSuccess); - rb.PushIpcInterface(system, controller); -} - -void APM_Sys::SetCpuBoostMode(Kernel::HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto mode = rp.PopEnum(); - - LOG_DEBUG(Service_APM, "called, mode={:08X}", mode); - - controller.SetFromCpuBoostMode(mode); - - IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); -} - -void APM_Sys::GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx) { - LOG_DEBUG(Service_APM, "called"); - - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.PushEnum( - controller.GetCurrentPerformanceConfiguration(controller.GetCurrentPerformanceMode())); -} - -} // namespace Service::APM diff --git a/src/core/hle/service/apm/interface.h b/src/core/hle/service/apm/interface.h deleted file mode 100644 index 063ad5308..000000000 --- a/src/core/hle/service/apm/interface.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 yuzu emulator team -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#pragma once - -#include "core/hle/service/service.h" - -namespace Service::APM { - -class Controller; -class Module; - -class APM final : public ServiceFramework { -public: - explicit APM(Core::System& system_, std::shared_ptr apm_, Controller& controller_, - const char* name); - ~APM() override; - -private: - void OpenSession(Kernel::HLERequestContext& ctx); - void GetPerformanceMode(Kernel::HLERequestContext& ctx); - void IsCpuOverclockEnabled(Kernel::HLERequestContext& ctx); - - std::shared_ptr apm; - Controller& controller; -}; - -class APM_Sys final : public ServiceFramework { -public: - explicit APM_Sys(Core::System& system_, Controller& controller); - ~APM_Sys() override; - - void SetCpuBoostMode(Kernel::HLERequestContext& ctx); - -private: - void GetPerformanceEvent(Kernel::HLERequestContext& ctx); - void GetCurrentPerformanceConfiguration(Kernel::HLERequestContext& ctx); - - Controller& controller; -}; - -} // namespace Service::APM -- cgit v1.2.3