1
0
Fork 1
forked from suyu/suyu

Merge pull request #12599 from german77/settings

service: set: Use official names
This commit is contained in:
liamwhite 2024-01-07 20:40:56 -05:00 committed by GitHub
commit ab513c378a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 394 additions and 380 deletions

View file

@ -708,24 +708,24 @@ add_library(core STATIC
hle/service/server_manager.h
hle/service/service.cpp
hle/service/service.h
hle/service/set/set.cpp
hle/service/set/set.h
hle/service/set/appln_settings.cpp
hle/service/set/appln_settings.h
hle/service/set/device_settings.cpp
hle/service/set/device_settings.h
hle/service/set/factory_settings_server.cpp
hle/service/set/factory_settings_server.h
hle/service/set/firmware_debug_settings_server.cpp
hle/service/set/firmware_debug_settings_server.h
hle/service/set/private_settings.cpp
hle/service/set/private_settings.h
hle/service/set/set_cal.cpp
hle/service/set/set_cal.h
hle/service/set/set_fd.cpp
hle/service/set/set_fd.h
hle/service/set/set_sys.cpp
hle/service/set/set_sys.h
hle/service/set/settings.cpp
hle/service/set/settings.h
hle/service/set/settings_server.cpp
hle/service/set/settings_server.h
hle/service/set/system_settings.cpp
hle/service/set/system_settings.h
hle/service/set/system_settings_server.cpp
hle/service/set/system_settings_server.h
hle/service/sm/sm.cpp
hle/service/sm/sm.h
hle/service/sm/sm_controller.cpp

View file

@ -26,7 +26,7 @@
#include "core/file_sys/vfs_vector.h"
#include "core/hle/service/filesystem/filesystem.h"
#include "core/hle/service/ns/language.h"
#include "core/hle/service/set/set.h"
#include "core/hle/service/set/settings_server.h"
#include "core/loader/loader.h"
#include "core/loader/nso.h"
#include "core/memory/cheat_engine.h"

View file

@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/ns/language.h"
#include "core/hle/service/set/set.h"
#include "core/hle/service/set/settings_server.h"
namespace Service::NS {

View file

@ -16,7 +16,7 @@
#include "core/hle/service/ns/ns.h"
#include "core/hle/service/ns/pdm_qry.h"
#include "core/hle/service/server_manager.h"
#include "core/hle/service/set/set.h"
#include "core/hle/service/set/settings_server.h"
namespace Service::NS {

View file

@ -1,11 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/set/set_cal.h"
#include "core/hle/service/set/factory_settings_server.h"
namespace Service::Set {
SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} {
IFactorySettingsServer::IFactorySettingsServer(Core::System& system_)
: ServiceFramework{system_, "set:cal"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, nullptr, "GetBluetoothBdAddress"},
@ -57,6 +58,6 @@ SET_CAL::SET_CAL(Core::System& system_) : ServiceFramework{system_, "set:cal"} {
RegisterHandlers(functions);
}
SET_CAL::~SET_CAL() = default;
IFactorySettingsServer::~IFactorySettingsServer() = default;
} // namespace Service::Set

View file

@ -11,10 +11,10 @@ class System;
namespace Service::Set {
class SET_FD final : public ServiceFramework<SET_FD> {
class IFactorySettingsServer final : public ServiceFramework<IFactorySettingsServer> {
public:
explicit SET_FD(Core::System& system_);
~SET_FD() override;
explicit IFactorySettingsServer(Core::System& system_);
~IFactorySettingsServer() override;
};
} // namespace Service::Set

View file

@ -1,11 +1,12 @@
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/set/set_fd.h"
#include "core/hle/service/set/firmware_debug_settings_server.h"
namespace Service::Set {
SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} {
IFirmwareDebugSettingsServer::IFirmwareDebugSettingsServer(Core::System& system_)
: ServiceFramework{system_, "set:fd"} {
// clang-format off
static const FunctionInfo functions[] = {
{2, nullptr, "SetSettingsItemValue"},
@ -23,6 +24,6 @@ SET_FD::SET_FD(Core::System& system_) : ServiceFramework{system_, "set:fd"} {
RegisterHandlers(functions);
}
SET_FD::~SET_FD() = default;
IFirmwareDebugSettingsServer::~IFirmwareDebugSettingsServer() = default;
} // namespace Service::Set

View file

@ -11,10 +11,10 @@ class System;
namespace Service::Set {
class SET_CAL final : public ServiceFramework<SET_CAL> {
class IFirmwareDebugSettingsServer final : public ServiceFramework<IFirmwareDebugSettingsServer> {
public:
explicit SET_CAL(Core::System& system_);
~SET_CAL() override;
explicit IFirmwareDebugSettingsServer(Core::System& system_);
~IFirmwareDebugSettingsServer() override;
};
} // namespace Service::Set

View file

@ -2,21 +2,24 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "core/hle/service/server_manager.h"
#include "core/hle/service/set/set.h"
#include "core/hle/service/set/set_cal.h"
#include "core/hle/service/set/set_fd.h"
#include "core/hle/service/set/set_sys.h"
#include "core/hle/service/set/factory_settings_server.h"
#include "core/hle/service/set/firmware_debug_settings_server.h"
#include "core/hle/service/set/settings.h"
#include "core/hle/service/set/settings_server.h"
#include "core/hle/service/set/system_settings_server.h"
namespace Service::Set {
void LoopProcess(Core::System& system) {
auto server_manager = std::make_unique<ServerManager>(system);
server_manager->RegisterNamedService("set", std::make_shared<SET>(system));
server_manager->RegisterNamedService("set:cal", std::make_shared<SET_CAL>(system));
server_manager->RegisterNamedService("set:fd", std::make_shared<SET_FD>(system));
server_manager->RegisterNamedService("set:sys", std::make_shared<SET_SYS>(system));
server_manager->RegisterNamedService("set", std::make_shared<ISettingsServer>(system));
server_manager->RegisterNamedService("set:cal",
std::make_shared<IFactorySettingsServer>(system));
server_manager->RegisterNamedService("set:fd",
std::make_shared<IFirmwareDebugSettingsServer>(system));
server_manager->RegisterNamedService("set:sys",
std::make_shared<ISystemSettingsServer>(system));
ServerManager::RunServer(std::move(server_manager));
}

View file

@ -7,7 +7,7 @@
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/hle/service/ipc_helpers.h"
#include "core/hle/service/set/set.h"
#include "core/hle/service/set/settings_server.h"
namespace Service::Set {
namespace {
@ -58,13 +58,36 @@ LanguageCode GetLanguageCodeFromIndex(std::size_t index) {
return available_language_codes.at(index);
}
void SET::GetAvailableLanguageCodes(HLERequestContext& ctx) {
ISettingsServer::ISettingsServer(Core::System& system_) : ServiceFramework{system_, "set"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &ISettingsServer::GetLanguageCode, "GetLanguageCode"},
{1, &ISettingsServer::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
{2, &ISettingsServer::MakeLanguageCode, "MakeLanguageCode"},
{3, &ISettingsServer::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
{4, &ISettingsServer::GetRegionCode, "GetRegionCode"},
{5, &ISettingsServer::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
{6, &ISettingsServer::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"},
{7, &ISettingsServer::GetKeyCodeMap, "GetKeyCodeMap"},
{8, &ISettingsServer::GetQuestFlag, "GetQuestFlag"},
{9, &ISettingsServer::GetKeyCodeMap2, "GetKeyCodeMap2"},
{10, nullptr, "GetFirmwareVersionForDebug"},
{11, &ISettingsServer::GetDeviceNickName, "GetDeviceNickName"},
};
// clang-format on
RegisterHandlers(functions);
}
ISettingsServer::~ISettingsServer() = default;
void ISettingsServer::GetAvailableLanguageCodes(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
GetAvailableLanguageCodesImpl(ctx, PRE_4_0_0_MAX_ENTRIES);
}
void SET::MakeLanguageCode(HLERequestContext& ctx) {
void ISettingsServer::MakeLanguageCode(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const auto index = rp.Pop<u32>();
@ -80,25 +103,25 @@ void SET::MakeLanguageCode(HLERequestContext& ctx) {
rb.PushEnum(available_language_codes[index]);
}
void SET::GetAvailableLanguageCodes2(HLERequestContext& ctx) {
void ISettingsServer::GetAvailableLanguageCodes2(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
GetAvailableLanguageCodesImpl(ctx, POST_4_0_0_MAX_ENTRIES);
}
void SET::GetAvailableLanguageCodeCount(HLERequestContext& ctx) {
void ISettingsServer::GetAvailableLanguageCodeCount(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
PushResponseLanguageCode(ctx, PRE_4_0_0_MAX_ENTRIES);
}
void SET::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) {
void ISettingsServer::GetAvailableLanguageCodeCount2(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
PushResponseLanguageCode(ctx, POST_4_0_0_MAX_ENTRIES);
}
void SET::GetQuestFlag(HLERequestContext& ctx) {
void ISettingsServer::GetQuestFlag(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
IPC::ResponseBuilder rb{ctx, 3};
@ -106,7 +129,7 @@ void SET::GetQuestFlag(HLERequestContext& ctx) {
rb.Push(static_cast<s32>(Settings::values.quest_flag.GetValue()));
}
void SET::GetLanguageCode(HLERequestContext& ctx) {
void ISettingsServer::GetLanguageCode(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called {}", Settings::values.language_index.GetValue());
IPC::ResponseBuilder rb{ctx, 4};
@ -115,7 +138,7 @@ void SET::GetLanguageCode(HLERequestContext& ctx) {
available_language_codes[static_cast<s32>(Settings::values.language_index.GetValue())]);
}
void SET::GetRegionCode(HLERequestContext& ctx) {
void ISettingsServer::GetRegionCode(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
IPC::ResponseBuilder rb{ctx, 3};
@ -123,44 +146,21 @@ void SET::GetRegionCode(HLERequestContext& ctx) {
rb.Push(static_cast<u32>(Settings::values.region_index.GetValue()));
}
void SET::GetKeyCodeMap(HLERequestContext& ctx) {
void ISettingsServer::GetKeyCodeMap(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
GetKeyCodeMapImpl(ctx);
}
void SET::GetKeyCodeMap2(HLERequestContext& ctx) {
void ISettingsServer::GetKeyCodeMap2(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "Called {}", ctx.Description());
GetKeyCodeMapImpl(ctx);
}
void SET::GetDeviceNickName(HLERequestContext& ctx) {
void ISettingsServer::GetDeviceNickName(HLERequestContext& ctx) {
LOG_DEBUG(Service_SET, "called");
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
ctx.WriteBuffer(Settings::values.device_name.GetValue());
}
SET::SET(Core::System& system_) : ServiceFramework{system_, "set"} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &SET::GetLanguageCode, "GetLanguageCode"},
{1, &SET::GetAvailableLanguageCodes, "GetAvailableLanguageCodes"},
{2, &SET::MakeLanguageCode, "MakeLanguageCode"},
{3, &SET::GetAvailableLanguageCodeCount, "GetAvailableLanguageCodeCount"},
{4, &SET::GetRegionCode, "GetRegionCode"},
{5, &SET::GetAvailableLanguageCodes2, "GetAvailableLanguageCodes2"},
{6, &SET::GetAvailableLanguageCodeCount2, "GetAvailableLanguageCodeCount2"},
{7, &SET::GetKeyCodeMap, "GetKeyCodeMap"},
{8, &SET::GetQuestFlag, "GetQuestFlag"},
{9, &SET::GetKeyCodeMap2, "GetKeyCodeMap2"},
{10, nullptr, "GetFirmwareVersionForDebug"},
{11, &SET::GetDeviceNickName, "GetDeviceNickName"},
};
// clang-format on
RegisterHandlers(functions);
}
SET::~SET() = default;
} // namespace Service::Set

View file

@ -73,10 +73,10 @@ static constexpr std::array<std::pair<LanguageCode, KeyboardLayout>, 18> languag
LanguageCode GetLanguageCodeFromIndex(std::size_t idx);
class SET final : public ServiceFramework<SET> {
class ISettingsServer final : public ServiceFramework<ISettingsServer> {
public:
explicit SET(Core::System& system_);
~SET() override;
explicit ISettingsServer(Core::System& system_);
~ISettingsServer() override;
private:
void GetLanguageCode(HLERequestContext& ctx);

View file

@ -47,10 +47,10 @@ static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is
Result GetFirmwareVersionImpl(FirmwareVersionFormat& out_firmware, Core::System& system,
GetFirmwareVersionType type);
class SET_SYS final : public ServiceFramework<SET_SYS> {
class ISystemSettingsServer final : public ServiceFramework<ISystemSettingsServer> {
public:
explicit SET_SYS(Core::System& system_);
~SET_SYS() override;
explicit ISystemSettingsServer(Core::System& system_);
~ISystemSettingsServer() override;
Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category,
const std::string& name);

View file

@ -46,7 +46,7 @@
#include "core/hle/service/am/applet_ae.h"
#include "core/hle/service/am/applet_oe.h"
#include "core/hle/service/am/applets/applets.h"
#include "core/hle/service/set/set_sys.h"
#include "core/hle/service/set/system_settings_server.h"
#include "hid_core/frontend/emulated_controller.h"
#include "hid_core/hid_core.h"
#include "yuzu/multiplayer/state.h"