From f4620dd99294f9dacbca447ddc2326dbe79fcd6b Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 16 Feb 2020 19:25:18 +0000 Subject: [PATCH] Refactor settings services Use the new service naming convention. --- app/CMakeLists.txt | 2 +- app/src/main/cpp/skyline/services/base_service.h | 4 ++-- app/src/main/cpp/skyline/services/serviceman.cpp | 6 +++--- app/src/main/cpp/skyline/services/set/sys.cpp | 12 ------------ .../services/settings/ISystemSettingsServer.cpp | 12 ++++++++++++ .../{set/sys.h => settings/ISystemSettingsServer.h} | 12 ++++++------ 6 files changed, 24 insertions(+), 24 deletions(-) delete mode 100644 app/src/main/cpp/skyline/services/set/sys.cpp create mode 100644 app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp rename app/src/main/cpp/skyline/services/{set/sys.h => settings/ISystemSettingsServer.h} (78%) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 1e656849..9cedf61b 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -57,7 +57,7 @@ add_library(skyline SHARED ${source_DIR}/skyline/services/audren/IAudioRenderer.cpp ${source_DIR}/skyline/services/audren/voice.cpp ${source_DIR}/skyline/services/audren/memoryPool.cpp - ${source_DIR}/skyline/services/set/sys.cpp + ${source_DIR}/skyline/services/settings/ISystemSettingsServer.cpp ${source_DIR}/skyline/services/apm/apm.cpp ${source_DIR}/skyline/services/am/applet.cpp ${source_DIR}/skyline/services/am/appletController.cpp diff --git a/app/src/main/cpp/skyline/services/base_service.h b/app/src/main/cpp/skyline/services/base_service.h index 5b66a089..2ad173e8 100644 --- a/app/src/main/cpp/skyline/services/base_service.h +++ b/app/src/main/cpp/skyline/services/base_service.h @@ -20,7 +20,7 @@ namespace skyline::service { enum class Service { sm_IUserInterface, fatal_u, - set_sys, + settings_ISystemSettingsServer, apm, apm_ISession, am_appletOE, @@ -62,7 +62,7 @@ namespace skyline::service { */ const static std::unordered_map ServiceString{ {"fatal:u", Service::fatal_u}, - {"set:sys", Service::set_sys}, + {"set:sys", Service::settings_ISystemSettingsServer}, {"apm", Service::apm}, {"appletOE", Service::am_appletOE}, {"appletAE", Service::am_appletAE}, diff --git a/app/src/main/cpp/skyline/services/serviceman.cpp b/app/src/main/cpp/skyline/services/serviceman.cpp index 25b4c548..46bc6d0a 100644 --- a/app/src/main/cpp/skyline/services/serviceman.cpp +++ b/app/src/main/cpp/skyline/services/serviceman.cpp @@ -1,7 +1,7 @@ #include #include #include "sm/IUserInterface.h" -#include "set/sys.h" +#include "settings/ISystemSettingsServer.h" #include "apm/apm.h" #include "am/applet.h" #include "am/appletController.h" @@ -29,8 +29,8 @@ namespace skyline::service { case Service::fatal_u: serviceObj = std::make_shared(state, *this); break; - case Service::set_sys: - serviceObj = std::make_shared(state, *this); + case Service::settings_ISystemSettingsServer: + serviceObj = std::make_shared(state, *this); break; case Service::apm: serviceObj = std::make_shared(state, *this); diff --git a/app/src/main/cpp/skyline/services/set/sys.cpp b/app/src/main/cpp/skyline/services/set/sys.cpp deleted file mode 100644 index 7f376127..00000000 --- a/app/src/main/cpp/skyline/services/set/sys.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "sys.h" -#include - -namespace skyline::service::set { - sys::sys(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::set_sys, "set:sys", { - {0x3, SFUNC(sys::GetFirmwareVersion)}}) {} - - void sys::GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { - SysVerTitle title{.minor=9, .major=0, .micro=0, .revMajor=4, .platform="NX", .verHash="4de65c071fd0869695b7629f75eb97b2551dbf2f", .dispVer="9.0.0", .dispTitle="NintendoSDK Firmware for NX 9.0.0-4.0"}; - state.process->WriteMemory(title, request.outputBuf.at(0).address); - } -} diff --git a/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp new file mode 100644 index 00000000..30d6e123 --- /dev/null +++ b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.cpp @@ -0,0 +1,12 @@ +#include +#include "ISystemSettingsServer.h" + +namespace skyline::service::settings { + ISystemSettingsServer::ISystemSettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::settings_ISystemSettingsServer, "settings:ISystemSettingsServer", { + {0x3, SFUNC(ISystemSettingsServer::GetFirmwareVersion)}}) {} + + void ISystemSettingsServer::GetFirmwareVersion(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) { + SysVerTitle title{.minor=9, .major=0, .micro=0, .revMajor=4, .platform="NX", .verHash="4de65c071fd0869695b7629f75eb97b2551dbf2f", .dispVer="9.0.0", .dispTitle="NintendoSDK Firmware for NX 9.0.0-4.0"}; + state.process->WriteMemory(title, request.outputBuf.at(0).address); + } +} diff --git a/app/src/main/cpp/skyline/services/set/sys.h b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h similarity index 78% rename from app/src/main/cpp/skyline/services/set/sys.h rename to app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h index bc184419..3dee248c 100644 --- a/app/src/main/cpp/skyline/services/set/sys.h +++ b/app/src/main/cpp/skyline/services/settings/ISystemSettingsServer.h @@ -3,11 +3,11 @@ #include #include -namespace skyline::service::set { +namespace skyline::service::settings { /** - * @brief set:sys or System Settings service provides access to system settings + * @brief ISystemSettingsServer or set:sys service provides access to system settings */ - class sys : public BaseService { + class ISystemSettingsServer : public BaseService { private: /** * @brief Encapsulates the system version, this is sent to the application in GetFirmwareVersion (https://switchbrew.org/wiki/System_Version_Title) @@ -16,10 +16,10 @@ namespace skyline::service::set { u8 major; //!< The major version u8 minor; //!< The minor vision u8 micro; //!< The micro vision - u8 : 8; + u8 _pad0_; u8 revMajor; //!< The major revision u8 revMinor; //!< The major revision - u16 : 16; + u16 _pad1_; u8 platform[0x20]; //!< "NX" u8 verHash[0x40]; //!< This is the hash of the version string u8 dispVer[0x18]; //!< The version number string @@ -28,7 +28,7 @@ namespace skyline::service::set { static_assert(sizeof(SysVerTitle) == 0x100); public: - sys(const DeviceState &state, ServiceManager &manager); + ISystemSettingsServer(const DeviceState &state, ServiceManager &manager); /** * @brief Writes the Firmware version to a 0xA buffer (https://switchbrew.org/wiki/Settings_services#GetFirmwareVersion)