yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

service: set: Use official names

This commit is contained in:
german77 2024-01-06 15:41:22 -06:00
parent 12fd2ae86d
commit 37b0870ee3
9 changed files with 373 additions and 359 deletions

View File

@ -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

@ -5,7 +5,8 @@
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_CAL final : public ServiceFramework<SET_CAL> {
class IFactorySettingsServer final : public ServiceFramework<IFactorySettingsServer> {
public:
explicit SET_CAL(Core::System& system_);
~SET_CAL() override;
explicit IFactorySettingsServer(Core::System& system_);
~IFactorySettingsServer() override;
};
} // namespace Service::Set

View File

@ -5,7 +5,8 @@
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_FD final : public ServiceFramework<SET_FD> {
class IFirmwareDebugSettingsServer final : public ServiceFramework<IFirmwareDebugSettingsServer> {
public:
explicit SET_FD(Core::System& system_);
~SET_FD() override;
explicit IFirmwareDebugSettingsServer(Core::System& system_);
~IFirmwareDebugSettingsServer() override;
};
} // namespace Service::Set

File diff suppressed because it is too large Load Diff

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

@ -13,10 +13,13 @@ 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));
}