strat: use m_ for member variables
This commit is contained in:
@@ -30,13 +30,13 @@ namespace ams::mitm::settings {
|
||||
}
|
||||
|
||||
SetMitmService::SetMitmService(std::shared_ptr<::Service> &&s, const sm::MitmProcessInfo &c) : sf::MitmServiceImplBase(std::forward<std::shared_ptr<::Service>>(s), c) {
|
||||
if (this->client_info.program_id == ncm::SystemProgramId::Ns) {
|
||||
if (m_client_info.program_id == ncm::SystemProgramId::Ns) {
|
||||
os::ProcessId application_process_id;
|
||||
if (R_SUCCEEDED(pm::dmnt::GetApplicationProcessId(std::addressof(application_process_id))) && g_application_process_id == application_process_id) {
|
||||
this->locale = g_application_locale;
|
||||
this->is_valid_language = g_valid_language;
|
||||
this->is_valid_region = g_valid_region;
|
||||
this->got_locale = true;
|
||||
m_locale = g_application_locale;
|
||||
m_is_valid_language = g_valid_language;
|
||||
m_is_valid_region = g_valid_region;
|
||||
m_got_locale = true;
|
||||
} else {
|
||||
this->InvalidateLocale();
|
||||
}
|
||||
@@ -47,16 +47,16 @@ namespace ams::mitm::settings {
|
||||
|
||||
Result SetMitmService::EnsureLocale() {
|
||||
/* Optimization: if locale has already been gotten, we can stop. */
|
||||
if (AMS_LIKELY(this->got_locale)) {
|
||||
if (AMS_LIKELY(m_got_locale)) {
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
std::scoped_lock lk(this->lock);
|
||||
std::scoped_lock lk(m_lock);
|
||||
|
||||
const bool is_ns = this->client_info.program_id == ncm::SystemProgramId::Ns;
|
||||
const bool is_ns = m_client_info.program_id == ncm::SystemProgramId::Ns;
|
||||
|
||||
if (!this->got_locale) {
|
||||
ncm::ProgramId program_id = this->client_info.program_id;
|
||||
if (!m_got_locale) {
|
||||
ncm::ProgramId program_id = m_client_info.program_id;
|
||||
os::ProcessId application_process_id = os::InvalidProcessId;
|
||||
|
||||
if (is_ns) {
|
||||
@@ -64,15 +64,15 @@ namespace ams::mitm::settings {
|
||||
R_TRY(pm::dmnt::GetApplicationProcessId(std::addressof(application_process_id)));
|
||||
R_TRY(pm::info::GetProgramId(std::addressof(program_id), application_process_id));
|
||||
}
|
||||
this->locale = cfg::GetOverrideLocale(program_id);
|
||||
this->is_valid_language = settings::IsValidLanguageCode(this->locale.language_code);
|
||||
this->is_valid_region = settings::IsValidRegionCode(this->locale.region_code);
|
||||
this->got_locale = true;
|
||||
m_locale = cfg::GetOverrideLocale(program_id);
|
||||
m_is_valid_language = settings::IsValidLanguageCode(m_locale.language_code);
|
||||
m_is_valid_region = settings::IsValidRegionCode(m_locale.region_code);
|
||||
m_got_locale = true;
|
||||
|
||||
if (is_ns) {
|
||||
g_application_locale = this->locale;
|
||||
g_valid_language = this->is_valid_language;
|
||||
g_valid_region = this->is_valid_region;
|
||||
g_application_locale = m_locale;
|
||||
g_valid_language = m_is_valid_language;
|
||||
g_valid_region = m_is_valid_region;
|
||||
g_application_process_id = application_process_id;
|
||||
}
|
||||
}
|
||||
@@ -81,30 +81,30 @@ namespace ams::mitm::settings {
|
||||
}
|
||||
|
||||
void SetMitmService::InvalidateLocale() {
|
||||
std::scoped_lock lk(this->lock);
|
||||
std::scoped_lock lk(m_lock);
|
||||
|
||||
std::memset(std::addressof(this->locale), 0xCC, sizeof(this->locale));
|
||||
this->is_valid_language = false;
|
||||
this->is_valid_region = false;
|
||||
this->got_locale = false;
|
||||
std::memset(std::addressof(m_locale), 0xCC, sizeof(m_locale));
|
||||
m_is_valid_language = false;
|
||||
m_is_valid_region = false;
|
||||
m_got_locale = false;
|
||||
}
|
||||
|
||||
Result SetMitmService::GetLanguageCode(sf::Out<settings::LanguageCode> out) {
|
||||
this->EnsureLocale();
|
||||
|
||||
/* If there's no override locale, just use the actual one. */
|
||||
if (AMS_UNLIKELY(!this->is_valid_language)) {
|
||||
if (AMS_UNLIKELY(!m_is_valid_language)) {
|
||||
static_assert(sizeof(u64) == sizeof(settings::LanguageCode));
|
||||
R_TRY(setGetLanguageCodeFwd(this->forward_service.get(), reinterpret_cast<u64 *>(std::addressof(this->locale.language_code))));
|
||||
R_TRY(setGetLanguageCodeFwd(m_forward_service.get(), reinterpret_cast<u64 *>(std::addressof(m_locale.language_code))));
|
||||
|
||||
this->is_valid_language = true;
|
||||
if (this->client_info.program_id == ncm::SystemProgramId::Ns) {
|
||||
g_application_locale.language_code = this->locale.language_code;
|
||||
m_is_valid_language = true;
|
||||
if (m_client_info.program_id == ncm::SystemProgramId::Ns) {
|
||||
g_application_locale.language_code = m_locale.language_code;
|
||||
g_valid_language = true;
|
||||
}
|
||||
}
|
||||
|
||||
out.SetValue(this->locale.language_code);
|
||||
out.SetValue(m_locale.language_code);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
@@ -112,18 +112,18 @@ namespace ams::mitm::settings {
|
||||
this->EnsureLocale();
|
||||
|
||||
/* If there's no override locale, just use the actual one. */
|
||||
if (AMS_UNLIKELY(!this->is_valid_region)) {
|
||||
if (AMS_UNLIKELY(!m_is_valid_region)) {
|
||||
static_assert(sizeof(::SetRegion) == sizeof(settings::RegionCode));
|
||||
R_TRY(setGetRegionCodeFwd(this->forward_service.get(), reinterpret_cast<::SetRegion *>(std::addressof(this->locale.region_code))));
|
||||
R_TRY(setGetRegionCodeFwd(m_forward_service.get(), reinterpret_cast<::SetRegion *>(std::addressof(m_locale.region_code))));
|
||||
|
||||
this->is_valid_region = true;
|
||||
if (this->client_info.program_id == ncm::SystemProgramId::Ns) {
|
||||
g_application_locale.region_code = this->locale.region_code;
|
||||
m_is_valid_region = true;
|
||||
if (m_client_info.program_id == ncm::SystemProgramId::Ns) {
|
||||
g_application_locale.region_code = m_locale.region_code;
|
||||
g_valid_region = true;
|
||||
}
|
||||
}
|
||||
|
||||
out.SetValue(this->locale.region_code);
|
||||
out.SetValue(m_locale.region_code);
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user