mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 13:21:49 +01:00
Implement post 4.0.0 language list features in ISettingsServer
This commit is contained in:
parent
d1c1fa214c
commit
4cd7502df2
@ -6,10 +6,12 @@
|
||||
|
||||
namespace skyline::service::settings {
|
||||
ISettingsServer::ISettingsServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::settings_ISettingsServer, "settings:ISettingsServer", {
|
||||
{0x1, SFUNC(ISettingsServer::GetAvailableLanguageCodes)}
|
||||
{0x1, SFUNC(ISettingsServer::GetAvailableLanguageCodes)},
|
||||
{0x2, SFUNC(ISettingsServer::MakeLanguageCode)},
|
||||
{0x5, SFUNC(ISettingsServer::GetAvailableLanguageCodes2)}
|
||||
}) {}
|
||||
|
||||
constexpr std::array<u64, 15> LanguageCodeList = {
|
||||
constexpr std::array<u64, constant::NewLanguageCodeListSize> LanguageCodeList = {
|
||||
util::MakeMagic<u64>("ja"),
|
||||
util::MakeMagic<u64>("en-US"),
|
||||
util::MakeMagic<u64>("fr"),
|
||||
@ -24,12 +26,24 @@ namespace skyline::service::settings {
|
||||
util::MakeMagic<u64>("zh-TW"),
|
||||
util::MakeMagic<u64>("en-GB"),
|
||||
util::MakeMagic<u64>("fr-CA"),
|
||||
util::MakeMagic<u64>("es-419")
|
||||
util::MakeMagic<u64>("es-419"),
|
||||
util::MakeMagic<u64>("zh-Hans"),
|
||||
util::MakeMagic<u64>("zh-Hant"),
|
||||
};
|
||||
|
||||
void ISettingsServer::GetAvailableLanguageCodes(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.process->WriteMemory(LanguageCodeList.data(), request.outputBuf.at(0).address, LanguageCodeList.size() * sizeof(u64));
|
||||
state.process->WriteMemory(LanguageCodeList.data(), request.outputBuf.at(0).address, constant::OldLanguageCodeListSize * sizeof(u64));
|
||||
|
||||
response.Push<i32>(LanguageCodeList.size());
|
||||
response.Push<i32>(constant::OldLanguageCodeListSize);
|
||||
}
|
||||
|
||||
void ISettingsServer::MakeLanguageCode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<u64>(LanguageCodeList.at(request.Pop<i32>()));
|
||||
}
|
||||
|
||||
void ISettingsServer::GetAvailableLanguageCodes2(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.process->WriteMemory(LanguageCodeList.data(), request.outputBuf.at(0).address, constant::NewLanguageCodeListSize * sizeof(u64));
|
||||
|
||||
response.Push<i32>(constant::NewLanguageCodeListSize);
|
||||
}
|
||||
}
|
||||
|
@ -6,17 +6,34 @@
|
||||
#include <services/base_service.h>
|
||||
#include <services/serviceman.h>
|
||||
|
||||
namespace skyline::service::settings {
|
||||
/**
|
||||
* @brief ISettingsServer or 'set' provides access to user settings (https://switchbrew.org/wiki/Settings_services#set)
|
||||
*/
|
||||
class ISettingsServer : public BaseService {
|
||||
public:
|
||||
ISettingsServer(const DeviceState &state, ServiceManager &manager);
|
||||
namespace skyline::service {
|
||||
namespace constant {
|
||||
constexpr size_t OldLanguageCodeListSize = 15; //!< The size of the pre 4.0.0 language code list
|
||||
constexpr size_t NewLanguageCodeListSize = 17; //!< The size of the post 4.0.0 language code list
|
||||
}
|
||||
|
||||
namespace settings {
|
||||
/**
|
||||
* @brief This reads the available language codes that an application can use
|
||||
* @brief ISettingsServer or 'set' provides access to user settings (https://switchbrew.org/wiki/Settings_services#set)
|
||||
*/
|
||||
void GetAvailableLanguageCodes(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
class ISettingsServer : public BaseService {
|
||||
public:
|
||||
ISettingsServer(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @brief This reads the available language codes that an application can use (pre 4.0.0)
|
||||
*/
|
||||
void GetAvailableLanguageCodes(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This converts a language code list index to it's corresponding language code
|
||||
*/
|
||||
void MakeLanguageCode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This reads the available language codes that an application can use (post 4.0.0)
|
||||
*/
|
||||
void GetAvailableLanguageCodes2(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user