early-access version 4140

This commit is contained in:
pineappleEA 2024-02-14 23:38:12 +01:00
parent 9cc5d38fdf
commit 436a842335
13 changed files with 710 additions and 1073 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 4139. This is the source code for early-access 4140.
## Legal Notice ## Legal Notice

View File

@ -106,7 +106,7 @@ void AudCtl::GetAudioOutputMode(HLERequestContext& ctx) {
const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()}; const auto target{rp.PopEnum<Set::AudioOutputModeTarget>()};
Set::AudioOutputMode output_mode{}; Set::AudioOutputMode output_mode{};
const auto result = m_set_sys->GetAudioOutputMode(output_mode, target); const auto result = m_set_sys->GetAudioOutputMode(&output_mode, target);
LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode); LOG_INFO(Service_SET, "called, target={}, output_mode={}", target, output_mode);
@ -188,7 +188,7 @@ void AudCtl::SetSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) { void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) {
bool is_speaker_auto_mute_enabled{}; bool is_speaker_auto_mute_enabled{};
const auto result = m_set_sys->GetSpeakerAutoMuteFlag(is_speaker_auto_mute_enabled); const auto result = m_set_sys->GetSpeakerAutoMuteFlag(&is_speaker_auto_mute_enabled);
LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}", LOG_WARNING(Audio, "(STUBBED) called, is_speaker_auto_mute_enabled={}",
is_speaker_auto_mute_enabled); is_speaker_auto_mute_enabled);

View File

@ -21,19 +21,6 @@
namespace Service::Glue::Time { namespace Service::Glue::Time {
namespace { namespace {
template <typename T>
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
const char* category, const char* name) {
std::vector<u8> interval_buf;
auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
ASSERT(res == ResultSuccess);
T v{};
std::memcpy(&v, interval_buf.data(), sizeof(T));
return v;
}
s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) { s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
constexpr auto is_leap = [](s32 year) -> bool { constexpr auto is_leap = [](s32 year) -> bool {
return (((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0)); return (((year) % 4) == 0 && (((year) % 100) != 0 || ((year) % 400) == 0));
@ -65,13 +52,15 @@ s64 CalendarTimeToEpoch(Service::PSC::Time::CalendarTime calendar) {
s64 GetEpochTimeFromInitialYear(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys) { s64 GetEpochTimeFromInitialYear(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys) {
Service::PSC::Time::CalendarTime calendar{ Service::PSC::Time::CalendarTime calendar{
.year = GetSettingsItemValue<s16>(set_sys, "time", "standard_user_clock_initial_year"), .year = 2000,
.month = 1, .month = 1,
.day = 1, .day = 1,
.hour = 0, .hour = 0,
.minute = 0, .minute = 0,
.second = 0, .second = 0,
}; };
set_sys->GetSettingsItemValueImpl<s16>(calendar.year, "time",
"standard_user_clock_initial_year");
return CalendarTimeToEpoch(calendar); return CalendarTimeToEpoch(calendar);
} }
@ -124,7 +113,7 @@ TimeManager::TimeManager(Core::System& system)
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
Service::PSC::Time::SystemClockContext user_clock_context{}; Service::PSC::Time::SystemClockContext user_clock_context{};
res = m_set_sys->GetUserSystemClockContext(user_clock_context); res = m_set_sys->GetUserSystemClockContext(&user_clock_context);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
// TODO the local clock should initialise with this epoch time, and be updated somewhere else on // TODO the local clock should initialise with this epoch time, and be updated somewhere else on
@ -140,11 +129,12 @@ TimeManager::TimeManager(Core::System& system)
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
Service::PSC::Time::SystemClockContext network_clock_context{}; Service::PSC::Time::SystemClockContext network_clock_context{};
res = m_set_sys->GetNetworkSystemClockContext(network_clock_context); res = m_set_sys->GetNetworkSystemClockContext(&network_clock_context);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
auto network_accuracy_m{GetSettingsItemValue<s32>( s32 network_accuracy_m{};
m_set_sys, "time", "standard_network_clock_sufficient_accuracy_minutes")}; m_set_sys->GetSettingsItemValueImpl<s32>(network_accuracy_m, "time",
"standard_network_clock_sufficient_accuracy_minutes");
auto one_minute_ns{ auto one_minute_ns{
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()}; std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
s64 network_accuracy_ns{network_accuracy_m * one_minute_ns}; s64 network_accuracy_ns{network_accuracy_m * one_minute_ns};
@ -153,12 +143,12 @@ TimeManager::TimeManager(Core::System& system)
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
bool is_automatic_correction_enabled{}; bool is_automatic_correction_enabled{};
res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(is_automatic_correction_enabled); res = m_set_sys->IsUserSystemClockAutomaticCorrectionEnabled(&is_automatic_correction_enabled);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
Service::PSC::Time::SteadyClockTimePoint automatic_correction_time_point{}; Service::PSC::Time::SteadyClockTimePoint automatic_correction_time_point{};
res = m_set_sys->GetUserSystemClockAutomaticCorrectionUpdatedTime( res = m_set_sys->GetUserSystemClockAutomaticCorrectionUpdatedTime(
automatic_correction_time_point); &automatic_correction_time_point);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
res = m_time_m->SetupStandardUserSystemClockCore(is_automatic_correction_enabled, res = m_time_m->SetupStandardUserSystemClockCore(is_automatic_correction_enabled,
@ -198,11 +188,11 @@ TimeManager::TimeManager(Core::System& system)
Result TimeManager::SetupStandardSteadyClockCore() { Result TimeManager::SetupStandardSteadyClockCore() {
Common::UUID external_clock_source_id{}; Common::UUID external_clock_source_id{};
auto res = m_set_sys->GetExternalSteadyClockSourceId(external_clock_source_id); auto res = m_set_sys->GetExternalSteadyClockSourceId(&external_clock_source_id);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
s64 external_steady_clock_internal_offset_s{}; s64 external_steady_clock_internal_offset_s{};
res = m_set_sys->GetExternalSteadyClockInternalOffset(external_steady_clock_internal_offset_s); res = m_set_sys->GetExternalSteadyClockInternalOffset(&external_steady_clock_internal_offset_s);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
auto one_second_ns{ auto one_second_ns{
@ -210,8 +200,9 @@ Result TimeManager::SetupStandardSteadyClockCore() {
s64 external_steady_clock_internal_offset_ns{external_steady_clock_internal_offset_s * s64 external_steady_clock_internal_offset_ns{external_steady_clock_internal_offset_s *
one_second_ns}; one_second_ns};
s32 standard_steady_clock_test_offset_m{ s32 standard_steady_clock_test_offset_m{};
GetSettingsItemValue<s32>(m_set_sys, "time", "standard_steady_clock_test_offset_minutes")}; m_set_sys->GetSettingsItemValueImpl<s32>(standard_steady_clock_test_offset_m, "time",
"standard_steady_clock_test_offset_minutes");
auto one_minute_ns{ auto one_minute_ns{
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()}; std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::minutes(1)).count()};
s64 standard_steady_clock_test_offset_ns{standard_steady_clock_test_offset_m * one_minute_ns}; s64 standard_steady_clock_test_offset_ns{standard_steady_clock_test_offset_m * one_minute_ns};
@ -237,7 +228,7 @@ Result TimeManager::SetupStandardSteadyClockCore() {
Result TimeManager::SetupTimeZoneServiceCore() { Result TimeManager::SetupTimeZoneServiceCore() {
Service::PSC::Time::LocationName name{}; Service::PSC::Time::LocationName name{};
auto res = m_set_sys->GetDeviceTimeZoneLocationName(name); auto res = m_set_sys->GetDeviceTimeZoneLocationName(&name);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
auto configured_zone = GetTimeZoneString(name); auto configured_zone = GetTimeZoneString(name);
@ -255,7 +246,7 @@ Result TimeManager::SetupTimeZoneServiceCore() {
} }
Service::PSC::Time::SteadyClockTimePoint time_point{}; Service::PSC::Time::SteadyClockTimePoint time_point{};
res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(time_point); res = m_set_sys->GetDeviceTimeZoneLocationUpdatedTime(&time_point);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
auto location_count = GetTimeZoneCount(); auto location_count = GetTimeZoneCount();

View File

@ -20,19 +20,6 @@
#include "core/hle/service/sm/sm.h" #include "core/hle/service/sm/sm.h"
namespace Service::Glue::Time { namespace Service::Glue::Time {
namespace {
template <typename T>
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
const char* category, const char* name) {
std::vector<u8> interval_buf;
auto res = set_sys->GetSettingsItemValue(interval_buf, category, name);
ASSERT(res == ResultSuccess);
T v{};
std::memcpy(&v, interval_buf.data(), sizeof(T));
return v;
}
} // namespace
StaticService::StaticService(Core::System& system_, StaticService::StaticService(Core::System& system_,
Service::PSC::Time::StaticServiceSetupInfo setup_info, Service::PSC::Time::StaticServiceSetupInfo setup_info,
@ -181,8 +168,8 @@ Result StaticService::SetStandardUserSystemClockAutomaticCorrectionEnabled(
Result StaticService::GetStandardUserSystemClockInitialYear(Out<s32> out_year) { Result StaticService::GetStandardUserSystemClockInitialYear(Out<s32> out_year) {
SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. out_year={}", *out_year); }); SCOPE_EXIT({ LOG_DEBUG(Service_Time, "called. out_year={}", *out_year); });
*out_year = GetSettingsItemValue<s32>(m_set_sys, "time", "standard_user_clock_initial_year"); R_RETURN(m_set_sys->GetSettingsItemValueImpl<s32>(*out_year, "time",
R_SUCCEED(); "standard_user_clock_initial_year"));
} }
Result StaticService::IsStandardNetworkSystemClockAccuracySufficient(Out<bool> out_is_sufficient) { Result StaticService::IsStandardNetworkSystemClockAccuracySufficient(Out<bool> out_is_sufficient) {

View File

@ -27,7 +27,7 @@ template <typename T>
T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys, T GetSettingsItemValue(std::shared_ptr<Service::Set::ISystemSettingsServer>& set_sys,
const char* category, const char* name) { const char* category, const char* name) {
std::vector<u8> interval_buf; std::vector<u8> interval_buf;
auto res = set_sys->GetSettingsItemValue(interval_buf, category, name); auto res = set_sys->GetSettingsItemValueImpl(interval_buf, category, name);
ASSERT(res == ResultSuccess); ASSERT(res == ResultSuccess);
T v{}; T v{};

View File

@ -207,7 +207,8 @@ private:
Result DestroyFile() { Result DestroyFile() {
bool is_db_test_mode_enabled{}; bool is_db_test_mode_enabled{};
m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled"); m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
"is_db_test_mode_enabled");
LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled); LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly); R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
@ -217,7 +218,8 @@ private:
Result DeleteFile() { Result DeleteFile() {
bool is_db_test_mode_enabled{}; bool is_db_test_mode_enabled{};
m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled"); m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
"is_db_test_mode_enabled");
LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled); LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly); R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);
@ -227,7 +229,8 @@ private:
Result Format() { Result Format() {
bool is_db_test_mode_enabled{}; bool is_db_test_mode_enabled{};
m_set_sys->GetSettingsItemValue(is_db_test_mode_enabled, "mii", "is_db_test_mode_enabled"); m_set_sys->GetSettingsItemValueImpl(is_db_test_mode_enabled, "mii",
"is_db_test_mode_enabled");
LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled); LOG_INFO(Service_Mii, "called is_db_test_mode_enabled={}", is_db_test_mode_enabled);
R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly); R_UNLESS(is_db_test_mode_enabled, ResultTestModeOnly);

View File

@ -244,7 +244,7 @@ struct SystemSettings {
INSERT_PADDING_BYTES(0x60); // Reserved INSERT_PADDING_BYTES(0x60); // Reserved
// nn::settings::system::AccountNotificationSettings // nn::settings::system::AccountNotificationSettings
u32 account_notification_settings_count; s32 account_notification_settings_count;
INSERT_PADDING_BYTES(0xC); // Reserved INSERT_PADDING_BYTES(0xC); // Reserved
std::array<AccountNotificationSettings, 8> account_notification_settings; std::array<AccountNotificationSettings, 8> account_notification_settings;
INSERT_PADDING_BYTES(0x140); // Reserved INSERT_PADDING_BYTES(0x140); // Reserved
@ -308,7 +308,7 @@ struct SystemSettings {
INSERT_PADDING_BYTES(0x34); // Reserved INSERT_PADDING_BYTES(0x34); // Reserved
// nn::settings::system::EulaVersion // nn::settings::system::EulaVersion
u32 eula_version_count; s32 eula_version_count;
INSERT_PADDING_BYTES(0xC); // Reserved INSERT_PADDING_BYTES(0xC); // Reserved
std::array<EulaVersion, 32> eula_versions; std::array<EulaVersion, 32> eula_versions;
INSERT_PADDING_BYTES(0x200); // Reserved INSERT_PADDING_BYTES(0x200); // Reserved

View File

@ -12,6 +12,7 @@
#include "core/hle/service/psc/time/common.h" #include "core/hle/service/psc/time/common.h"
namespace Service::Set { namespace Service::Set {
using SettingItemName = std::array<u8, 0x48>;
/// This is nn::settings::system::AudioOutputMode /// This is nn::settings::system::AudioOutputMode
enum class AudioOutputMode : u32 { enum class AudioOutputMode : u32 {
@ -413,16 +414,18 @@ struct FirmwareVersionFormat {
u8 major; u8 major;
u8 minor; u8 minor;
u8 micro; u8 micro;
INSERT_PADDING_BYTES(1); INSERT_PADDING_BYTES_NOINIT(1);
u8 revision_major; u8 revision_major;
u8 revision_minor; u8 revision_minor;
INSERT_PADDING_BYTES(2); INSERT_PADDING_BYTES_NOINIT(2);
std::array<char, 0x20> platform; std::array<char, 0x20> platform;
std::array<u8, 0x40> version_hash; std::array<u8, 0x40> version_hash;
std::array<char, 0x18> display_version; std::array<char, 0x18> display_version;
std::array<char, 0x80> display_title; std::array<char, 0x80> display_title;
}; };
static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size"); static_assert(sizeof(FirmwareVersionFormat) == 0x100, "FirmwareVersionFormat is an invalid size");
static_assert(std::is_trivial_v<FirmwareVersionFormat>,
"FirmwareVersionFormat type must be trivially copyable.");
/// This is nn::settings::system::HomeMenuScheme /// This is nn::settings::system::HomeMenuScheme
struct HomeMenuScheme { struct HomeMenuScheme {

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,7 @@
#include "common/polyfill_thread.h" #include "common/polyfill_thread.h"
#include "common/uuid.h" #include "common/uuid.h"
#include "core/hle/result.h" #include "core/hle/result.h"
#include "core/hle/service/cmif_types.h"
#include "core/hle/service/psc/time/common.h" #include "core/hle/service/psc/time/common.h"
#include "core/hle/service/service.h" #include "core/hle/service/service.h"
#include "core/hle/service/set/setting_formats/appln_settings.h" #include "core/hle/service/set/setting_formats/appln_settings.h"
@ -33,13 +34,14 @@ public:
explicit ISystemSettingsServer(Core::System& system_); explicit ISystemSettingsServer(Core::System& system_);
~ISystemSettingsServer() override; ~ISystemSettingsServer() override;
Result GetSettingsItemValue(std::vector<u8>& out_value, const std::string& category, Result GetSettingsItemValueImpl(std::vector<u8>& out_value, const std::string& category,
const std::string& name); const std::string& name);
template <typename T> template <typename T>
Result GetSettingsItemValue(T& value, const std::string& category, const std::string& name) { Result GetSettingsItemValueImpl(T& value, const std::string& category,
const std::string& name) {
std::vector<u8> data; std::vector<u8> data;
const auto result = GetSettingsItemValue(data, category, name); const auto result = GetSettingsItemValueImpl(data, category, name);
if (result.IsError()) { if (result.IsError()) {
return result; return result;
} }
@ -48,120 +50,114 @@ public:
return result; return result;
} }
Result GetVibrationMasterVolume(f32& out_volume) const; public:
Result SetVibrationMasterVolume(f32 volume); Result SetLanguageCode(LanguageCode language_code);
Result GetAudioOutputMode(AudioOutputMode& out_output_mode, AudioOutputModeTarget target) const; Result GetFirmwareVersion(
OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data);
Result GetFirmwareVersion2(
OutLargeData<FirmwareVersionFormat, BufferAttr_HipcPointer> out_firmware_data);
Result GetLockScreenFlag(Out<bool> out_lock_screen_flag);
Result SetLockScreenFlag(bool lock_screen_flag);
Result GetExternalSteadyClockSourceId(Out<Common::UUID> out_clock_source_id);
Result SetExternalSteadyClockSourceId(const Common::UUID& clock_source_id);
Result GetUserSystemClockContext(Out<Service::PSC::Time::SystemClockContext> out_clock_context);
Result SetUserSystemClockContext(const Service::PSC::Time::SystemClockContext& clock_context);
Result GetAccountSettings(Out<AccountSettings> out_account_settings);
Result SetAccountSettings(AccountSettings account_settings);
Result GetEulaVersions(Out<s32> out_count,
OutArray<EulaVersion, BufferAttr_HipcMapAlias> out_eula_versions);
Result SetEulaVersions(InArray<EulaVersion, BufferAttr_HipcMapAlias> eula_versions);
Result GetColorSetId(Out<ColorSet> out_color_set_id);
Result SetColorSetId(ColorSet color_set_id);
Result GetNotificationSettings(Out<NotificationSettings> out_notification_settings);
Result SetNotificationSettings(const NotificationSettings& notification_settings);
Result GetAccountNotificationSettings(
Out<s32> out_count, OutArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
out_account_notification_settings);
Result SetAccountNotificationSettings(
InArray<AccountNotificationSettings, BufferAttr_HipcMapAlias>
account_notification_settings);
Result GetVibrationMasterVolume(Out<f32> vibration_master_volume);
Result SetVibrationMasterVolume(f32 vibration_master_volume);
Result GetSettingsItemValueSize(
Out<u64> out_size,
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buf);
Result GetSettingsItemValue(
OutBuffer<BufferAttr_HipcMapAlias> out_data,
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_category_buffer,
InLargeData<SettingItemName, BufferAttr_HipcPointer> setting_name_buffer);
Result GetTvSettings(Out<TvSettings> out_tv_settings);
Result SetTvSettings(TvSettings tv_settings);
Result GetAudioOutputMode(Out<AudioOutputMode> out_output_mode, AudioOutputModeTarget target);
Result SetAudioOutputMode(AudioOutputModeTarget target, AudioOutputMode output_mode); Result SetAudioOutputMode(AudioOutputModeTarget target, AudioOutputMode output_mode);
Result GetSpeakerAutoMuteFlag(bool& is_auto_mute) const; Result GetSpeakerAutoMuteFlag(Out<bool> out_force_mute_on_headphone_removed);
Result SetSpeakerAutoMuteFlag(bool auto_mute); Result SetSpeakerAutoMuteFlag(bool force_mute_on_headphone_removed);
Result GetExternalSteadyClockSourceId(Common::UUID& out_id) const; Result GetQuestFlag(Out<QuestFlag> out_quest_flag);
Result SetExternalSteadyClockSourceId(const Common::UUID& id); Result SetQuestFlag(QuestFlag quest_flag);
Result GetUserSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const; Result GetDeviceTimeZoneLocationName(Out<Service::PSC::Time::LocationName> out_name);
Result SetUserSystemClockContext(const Service::PSC::Time::SystemClockContext& context);
Result GetDeviceTimeZoneLocationName(Service::PSC::Time::LocationName& out_name) const;
Result SetDeviceTimeZoneLocationName(const Service::PSC::Time::LocationName& name); Result SetDeviceTimeZoneLocationName(const Service::PSC::Time::LocationName& name);
Result GetNetworkSystemClockContext(Service::PSC::Time::SystemClockContext& out_context) const; Result SetRegionCode(SystemRegionCode region_code);
Result GetNetworkSystemClockContext(Out<Service::PSC::Time::SystemClockContext> out_context);
Result SetNetworkSystemClockContext(const Service::PSC::Time::SystemClockContext& context); Result SetNetworkSystemClockContext(const Service::PSC::Time::SystemClockContext& context);
Result IsUserSystemClockAutomaticCorrectionEnabled(bool& out_enabled) const; Result IsUserSystemClockAutomaticCorrectionEnabled(Out<bool> out_automatic_correction_enabled);
Result SetUserSystemClockAutomaticCorrectionEnabled(bool enabled); Result SetUserSystemClockAutomaticCorrectionEnabled(bool automatic_correction_enabled);
Result GetDebugModeFlag(Out<bool> is_debug_mode_enabled);
Result GetPrimaryAlbumStorage(Out<PrimaryAlbumStorage> out_primary_album_storage);
Result SetPrimaryAlbumStorage(PrimaryAlbumStorage primary_album_storage);
Result GetBatteryLot(Out<BatteryLot> out_battery_lot);
Result GetSerialNumber(Out<SerialNumber> out_console_serial);
Result GetNfcEnableFlag(Out<bool> out_nfc_enable_flag);
Result SetNfcEnableFlag(bool nfc_enable_flag);
Result GetSleepSettings(Out<SleepSettings> out_sleep_settings);
Result SetSleepSettings(SleepSettings sleep_settings);
Result GetWirelessLanEnableFlag(Out<bool> out_wireless_lan_enable_flag);
Result SetWirelessLanEnableFlag(bool wireless_lan_enable_flag);
Result GetInitialLaunchSettings(Out<InitialLaunchSettings> out_initial_launch_settings);
Result SetInitialLaunchSettings(InitialLaunchSettings initial_launch_settings);
Result GetDeviceNickName(
OutLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> out_device_name);
Result SetDeviceNickName(
InLargeData<std::array<u8, 0x80>, BufferAttr_HipcMapAlias> device_name_buffer);
Result GetProductModel(Out<u32> out_product_model);
Result GetBluetoothEnableFlag(Out<bool> out_bluetooth_enable_flag);
Result SetBluetoothEnableFlag(bool bluetooth_enable_flag);
Result GetMiiAuthorId(Out<Common::UUID> out_mii_author_id);
Result GetAutoUpdateEnableFlag(Out<bool> out_auto_update_enable_flag);
Result SetAutoUpdateEnableFlag(bool auto_update_enable_flag);
Result GetBatteryPercentageFlag(Out<bool> out_battery_percentage_flag);
Result SetBatteryPercentageFlag(bool battery_percentage_flag);
Result SetExternalSteadyClockInternalOffset(s64 offset); Result SetExternalSteadyClockInternalOffset(s64 offset);
Result GetExternalSteadyClockInternalOffset(s64& out_offset) const; Result GetExternalSteadyClockInternalOffset(Out<s64> out_offset);
Result GetPushNotificationActivityModeOnSleep(
Out<s32> out_push_notification_activity_mode_on_sleep);
Result SetPushNotificationActivityModeOnSleep(s32 push_notification_activity_mode_on_sleep);
Result GetErrorReportSharePermission(
Out<ErrorReportSharePermission> out_error_report_share_permission);
Result SetErrorReportSharePermission(ErrorReportSharePermission error_report_share_permission);
Result GetAppletLaunchFlags(Out<u32> out_applet_launch_flag);
Result SetAppletLaunchFlags(u32 applet_launch_flag);
Result GetKeyboardLayout(Out<KeyboardLayout> out_keyboard_layout);
Result SetKeyboardLayout(KeyboardLayout keyboard_layout);
Result GetDeviceTimeZoneLocationUpdatedTime( Result GetDeviceTimeZoneLocationUpdatedTime(
Service::PSC::Time::SteadyClockTimePoint& out_time_point) const; Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
Result SetDeviceTimeZoneLocationUpdatedTime( Result SetDeviceTimeZoneLocationUpdatedTime(
const Service::PSC::Time::SteadyClockTimePoint& time_point); const Service::PSC::Time::SteadyClockTimePoint& time_point);
Result GetUserSystemClockAutomaticCorrectionUpdatedTime( Result GetUserSystemClockAutomaticCorrectionUpdatedTime(
Service::PSC::Time::SteadyClockTimePoint& out_time_point) const; Out<Service::PSC::Time::SteadyClockTimePoint> out_time_point);
Result SetUserSystemClockAutomaticCorrectionUpdatedTime( Result SetUserSystemClockAutomaticCorrectionUpdatedTime(
const Service::PSC::Time::SteadyClockTimePoint& time_point); const Service::PSC::Time::SteadyClockTimePoint& out_time_point);
Result GetTouchScreenMode(TouchScreenMode& touch_screen_mode) const; Result GetChineseTraditionalInputMethod(
Out<ChineseTraditionalInputMethod> out_chinese_traditional_input_method);
Result GetHomeMenuScheme(Out<HomeMenuScheme> out_home_menu_scheme);
Result GetHomeMenuSchemeModel(Out<u32> out_home_menu_scheme_model);
Result GetTouchScreenMode(Out<TouchScreenMode> out_touch_screen_mode);
Result SetTouchScreenMode(TouchScreenMode touch_screen_mode); Result SetTouchScreenMode(TouchScreenMode touch_screen_mode);
Result GetFieldTestingFlag(Out<bool> out_field_testing_flag);
Result GetPanelCrcMode(Out<s32> out_panel_crc_mode);
Result SetPanelCrcMode(s32 panel_crc_mode);
private: private:
void SetLanguageCode(HLERequestContext& ctx);
void GetFirmwareVersion(HLERequestContext& ctx);
void GetFirmwareVersion2(HLERequestContext& ctx);
void GetLockScreenFlag(HLERequestContext& ctx);
void SetLockScreenFlag(HLERequestContext& ctx);
void GetExternalSteadyClockSourceId(HLERequestContext& ctx);
void SetExternalSteadyClockSourceId(HLERequestContext& ctx);
void GetUserSystemClockContext(HLERequestContext& ctx);
void SetUserSystemClockContext(HLERequestContext& ctx);
void GetAccountSettings(HLERequestContext& ctx);
void SetAccountSettings(HLERequestContext& ctx);
void GetEulaVersions(HLERequestContext& ctx);
void SetEulaVersions(HLERequestContext& ctx);
void GetColorSetId(HLERequestContext& ctx);
void SetColorSetId(HLERequestContext& ctx);
void GetNotificationSettings(HLERequestContext& ctx);
void SetNotificationSettings(HLERequestContext& ctx);
void GetAccountNotificationSettings(HLERequestContext& ctx);
void SetAccountNotificationSettings(HLERequestContext& ctx);
void GetVibrationMasterVolume(HLERequestContext& ctx);
void SetVibrationMasterVolume(HLERequestContext& ctx);
void GetSettingsItemValueSize(HLERequestContext& ctx);
void GetSettingsItemValue(HLERequestContext& ctx);
void GetTvSettings(HLERequestContext& ctx);
void SetTvSettings(HLERequestContext& ctx);
void GetAudioOutputMode(HLERequestContext& ctx);
void SetAudioOutputMode(HLERequestContext& ctx);
void GetSpeakerAutoMuteFlag(HLERequestContext& ctx);
void SetSpeakerAutoMuteFlag(HLERequestContext& ctx);
void GetDebugModeFlag(HLERequestContext& ctx);
void GetQuestFlag(HLERequestContext& ctx);
void SetQuestFlag(HLERequestContext& ctx);
void GetDeviceTimeZoneLocationName(HLERequestContext& ctx);
void SetDeviceTimeZoneLocationName(HLERequestContext& ctx);
void SetRegionCode(HLERequestContext& ctx);
void GetNetworkSystemClockContext(HLERequestContext& ctx);
void SetNetworkSystemClockContext(HLERequestContext& ctx);
void IsUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
void SetUserSystemClockAutomaticCorrectionEnabled(HLERequestContext& ctx);
void GetPrimaryAlbumStorage(HLERequestContext& ctx);
void SetPrimaryAlbumStorage(HLERequestContext& ctx);
void GetBatteryLot(HLERequestContext& ctx);
void GetSerialNumber(HLERequestContext& ctx);
void GetNfcEnableFlag(HLERequestContext& ctx);
void SetNfcEnableFlag(HLERequestContext& ctx);
void GetSleepSettings(HLERequestContext& ctx);
void SetSleepSettings(HLERequestContext& ctx);
void GetWirelessLanEnableFlag(HLERequestContext& ctx);
void SetWirelessLanEnableFlag(HLERequestContext& ctx);
void GetInitialLaunchSettings(HLERequestContext& ctx);
void SetInitialLaunchSettings(HLERequestContext& ctx);
void GetDeviceNickName(HLERequestContext& ctx);
void SetDeviceNickName(HLERequestContext& ctx);
void GetProductModel(HLERequestContext& ctx);
void GetBluetoothEnableFlag(HLERequestContext& ctx);
void SetBluetoothEnableFlag(HLERequestContext& ctx);
void GetMiiAuthorId(HLERequestContext& ctx);
void GetAutoUpdateEnableFlag(HLERequestContext& ctx);
void SetAutoUpdateEnableFlag(HLERequestContext& ctx);
void GetBatteryPercentageFlag(HLERequestContext& ctx);
void SetBatteryPercentageFlag(HLERequestContext& ctx);
void SetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
void GetExternalSteadyClockInternalOffset(HLERequestContext& ctx);
void GetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
void SetPushNotificationActivityModeOnSleep(HLERequestContext& ctx);
void GetErrorReportSharePermission(HLERequestContext& ctx);
void SetErrorReportSharePermission(HLERequestContext& ctx);
void GetAppletLaunchFlags(HLERequestContext& ctx);
void SetAppletLaunchFlags(HLERequestContext& ctx);
void GetKeyboardLayout(HLERequestContext& ctx);
void SetKeyboardLayout(HLERequestContext& ctx);
void GetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
void SetDeviceTimeZoneLocationUpdatedTime(HLERequestContext& ctx);
void GetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
void SetUserSystemClockAutomaticCorrectionUpdatedTime(HLERequestContext& ctx);
void GetChineseTraditionalInputMethod(HLERequestContext& ctx);
void GetHomeMenuScheme(HLERequestContext& ctx);
void GetHomeMenuSchemeModel(HLERequestContext& ctx);
void GetTouchScreenMode(HLERequestContext& ctx);
void SetTouchScreenMode(HLERequestContext& ctx);
void GetFieldTestingFlag(HLERequestContext& ctx);
void GetPanelCrcMode(HLERequestContext& ctx);
void SetPanelCrcMode(HLERequestContext& ctx);
bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func); bool LoadSettingsFile(std::filesystem::path& path, auto&& default_func);
bool StoreSettingsFile(std::filesystem::path& path, auto& settings); bool StoreSettingsFile(std::filesystem::path& path, auto& settings);
void SetupSettings(); void SetupSettings();

View File

@ -22,29 +22,30 @@ void HidFirmwareSettings::LoadSettings(bool reload_config) {
return; return;
} }
m_set_sys->GetSettingsItemValue<bool>(is_debug_pad_enabled, "hid_debug", "enables_debugpad"); m_set_sys->GetSettingsItemValueImpl<bool>(is_debug_pad_enabled, "hid_debug",
m_set_sys->GetSettingsItemValue<bool>(is_device_managed, "hid_debug", "manages_devices"); "enables_debugpad");
m_set_sys->GetSettingsItemValue<bool>(is_touch_i2c_managed, "hid_debug", m_set_sys->GetSettingsItemValueImpl<bool>(is_device_managed, "hid_debug", "manages_devices");
"manages_touch_ic_i2c"); m_set_sys->GetSettingsItemValueImpl<bool>(is_touch_i2c_managed, "hid_debug",
m_set_sys->GetSettingsItemValue<bool>(is_future_devices_emulated, "hid_debug", "manages_touch_ic_i2c");
"emulate_future_device"); m_set_sys->GetSettingsItemValueImpl<bool>(is_future_devices_emulated, "hid_debug",
m_set_sys->GetSettingsItemValue<bool>(is_mcu_hardware_error_emulated, "hid_debug", "emulate_future_device");
"emulate_mcu_hardware_error"); m_set_sys->GetSettingsItemValueImpl<bool>(is_mcu_hardware_error_emulated, "hid_debug",
m_set_sys->GetSettingsItemValue<bool>(is_rail_enabled, "hid_debug", "enables_rail"); "emulate_mcu_hardware_error");
m_set_sys->GetSettingsItemValue<bool>(is_firmware_update_failure_emulated, "hid_debug", m_set_sys->GetSettingsItemValueImpl<bool>(is_rail_enabled, "hid_debug", "enables_rail");
"emulate_firmware_update_failure"); m_set_sys->GetSettingsItemValueImpl<bool>(is_firmware_update_failure_emulated, "hid_debug",
"emulate_firmware_update_failure");
is_firmware_update_failure = {}; is_firmware_update_failure = {};
m_set_sys->GetSettingsItemValue<bool>(is_ble_disabled, "hid_debug", "ble_disabled"); m_set_sys->GetSettingsItemValueImpl<bool>(is_ble_disabled, "hid_debug", "ble_disabled");
m_set_sys->GetSettingsItemValue<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled"); m_set_sys->GetSettingsItemValueImpl<bool>(is_dscale_disabled, "hid_debug", "dscale_disabled");
m_set_sys->GetSettingsItemValue<bool>(is_handheld_forced, "hid_debug", "force_handheld"); m_set_sys->GetSettingsItemValueImpl<bool>(is_handheld_forced, "hid_debug", "force_handheld");
features_per_id_disabled = {}; features_per_id_disabled = {};
m_set_sys->GetSettingsItemValue<bool>(is_touch_firmware_auto_update_disabled, "hid_debug", m_set_sys->GetSettingsItemValueImpl<bool>(is_touch_firmware_auto_update_disabled, "hid_debug",
"touch_firmware_auto_update_disabled"); "touch_firmware_auto_update_disabled");
bool has_rail_interface{}; bool has_rail_interface{};
bool has_sio_mcu{}; bool has_sio_mcu{};
m_set_sys->GetSettingsItemValue<bool>(has_rail_interface, "hid", "has_rail_interface"); m_set_sys->GetSettingsItemValueImpl<bool>(has_rail_interface, "hid", "has_rail_interface");
m_set_sys->GetSettingsItemValue<bool>(has_sio_mcu, "hid", "has_sio_mcu"); m_set_sys->GetSettingsItemValueImpl<bool>(has_sio_mcu, "hid", "has_sio_mcu");
platform_config.has_rail_interface.Assign(has_rail_interface); platform_config.has_rail_interface.Assign(has_rail_interface);
platform_config.has_sio_mcu.Assign(has_sio_mcu); platform_config.has_sio_mcu.Assign(has_sio_mcu);

View File

@ -15,7 +15,7 @@ Result NpadVibration::Activate() {
std::scoped_lock lock{mutex}; std::scoped_lock lock{mutex};
f32 master_volume = 1.0f; f32 master_volume = 1.0f;
m_set_sys->GetVibrationMasterVolume(master_volume); m_set_sys->GetVibrationMasterVolume(&master_volume);
if (master_volume < 0.0f || master_volume > 1.0f) { if (master_volume < 0.0f || master_volume > 1.0f) {
return ResultVibrationStrengthOutOfRange; return ResultVibrationStrengthOutOfRange;
} }
@ -57,7 +57,7 @@ Result NpadVibration::GetVibrationMasterVolume(f32& out_volume) const {
std::scoped_lock lock{mutex}; std::scoped_lock lock{mutex};
f32 master_volume = 1.0f; f32 master_volume = 1.0f;
m_set_sys->GetVibrationMasterVolume(master_volume); m_set_sys->GetVibrationMasterVolume(&master_volume);
if (master_volume < 0.0f || master_volume > 1.0f) { if (master_volume < 0.0f || master_volume > 1.0f) {
return ResultVibrationStrengthOutOfRange; return ResultVibrationStrengthOutOfRange;
} }
@ -77,7 +77,7 @@ Result NpadVibration::EndPermitVibrationSession() {
std::scoped_lock lock{mutex}; std::scoped_lock lock{mutex};
f32 master_volume = 1.0f; f32 master_volume = 1.0f;
m_set_sys->GetVibrationMasterVolume(master_volume); m_set_sys->GetVibrationMasterVolume(&master_volume);
if (master_volume < 0.0f || master_volume > 1.0f) { if (master_volume < 0.0f || master_volume > 1.0f) {
return ResultVibrationStrengthOutOfRange; return ResultVibrationStrengthOutOfRange;
} }

View File

@ -48,7 +48,7 @@ Result TouchResource::ActivateTouch() {
} }
Set::TouchScreenMode touch_mode{Set::TouchScreenMode::Standard}; Set::TouchScreenMode touch_mode{Set::TouchScreenMode::Standard};
m_set_sys->GetTouchScreenMode(touch_mode); m_set_sys->GetTouchScreenMode(&touch_mode);
default_touch_screen_mode = static_cast<Core::HID::TouchScreenModeForNx>(touch_mode); default_touch_screen_mode = static_cast<Core::HID::TouchScreenModeForNx>(touch_mode);
global_ref_counter++; global_ref_counter++;