From b4d800a528c8ed8ebf75c22e87321f47a95e5547 Mon Sep 17 00:00:00 2001 From: KazushiM <85604869+KazushiMe@users.noreply.github.com> Date: Sat, 15 Oct 2022 22:03:05 +0800 Subject: [PATCH] system_settings cleanup --- .../atmosphere/config/system_settings_oc.ini | 170 ------------------ system_settings.md | 128 +++++++++++-- system_settings_parser.py | 46 +++++ 3 files changed, 160 insertions(+), 184 deletions(-) delete mode 100644 SdOut/atmosphere/config/system_settings_oc.ini create mode 100755 system_settings_parser.py diff --git a/SdOut/atmosphere/config/system_settings_oc.ini b/SdOut/atmosphere/config/system_settings_oc.ini deleted file mode 100644 index 66dbb5cf..00000000 --- a/SdOut/atmosphere/config/system_settings_oc.ini +++ /dev/null @@ -1,170 +0,0 @@ -[tc] -; tskin table -; https://github.com/masagrator/Status-Monitor-Overlay/blob/master/docs/modes.md#additional-info -; Hoag -; holdable_tskin = u32!0xB98C ; 47.5˚C -; touchable_tskin = u32!0xEA60 ; 60.0˚C -; tskin_pcb_coefficients_console = str!"[7338, 112161]" -; tskin_pcb_coefficients_handheld = str!"[5594, 209601]" -; tskin_rate_table_console = str!"[[-1000000, 40000, 0, 0], [36000, 43000, 51, 51], [43000, 53000, 51, 153], [53000, 58000, 153, 255], [58000, 1000000, 255, 255]]" -; tskin_rate_table_handheld = str!"[[-1000000, 40000, 0, 0], [36000, 43000, 51, 51], [43000, 48000, 51, 102], [48000, 53000, 102, 153], [53000, 1000000, 153, 153], [48000, 1000000, 153, 153]]" -; tskin_soc_coefficients_console = str!"[6728, 129810]" -; tskin_soc_coefficients_handheld = str!"[5235, 199759]" - -; IcosaMariko -; holdable_tskin = u32!0xB98C ; 47.5˚C -; touchable_tskin = u32!0xEA60 ; 60.0˚C -; tskin_pcb_coefficients_console = str!"[7338, 112161]" -; tskin_pcb_coefficients_handheld = str!"[6357, 168124]" -; tskin_rate_table_console = str!"[[-1000000, 40000, 0, 0], [36000, 43000, 51, 51], [43000, 53000, 51, 153], [53000, 58000, 153, 255], [58000, 1000000, 255, 255]]" -; tskin_rate_table_handheld = str!"[[-1000000, 40000, 0, 0], [36000, 43000, 51, 51], [43000, 48000, 51, 102], [48000, 53000, 102, 153], [53000, 1000000, 153, 153], [48000, 1000000, 153, 153]]" -; tskin_soc_coefficients_console = str!"[6728, 129810]" -; tskin_soc_coefficients_handheld = str!"[5675, 203453]" - -; Aula -; holdable_tskin = u32!0xBCB1 ; 48.3˚C -; touchable_tskin = u32!0xC350 ; 50.0˚C -; tskin_pcb_coefficients_console = str!"[8051, -45213]" -; tskin_pcb_coefficients_handheld = str!"[7176, -33954]" -; tskin_rate_table_console = str!"[[-1000000, 40000, 0, 0], [36000, 43000, 51, 51], [43000, 49000, 51, 128], [49000, 53000, 128, 255], [53000, 1000000, 255, 255]]" -; tskin_rate_table_handheld = str!"[[-1000000, 40000, 0, 0], [36000, 43000, 51, 51], [43000, 44000, 51, 76], [44000, 45000, 76, 128], [45000, 46500, 128, 255], [45500, 1000000, 255, 255]]" -; tskin_soc_coefficients_console = str!"[7831, 57590]" -; tskin_soc_coefficients_handheld = str!"[9029, 4274]" - - - -[psm] -; 5V CDP/DCP (BC1.2/QC?) Charger Current Limit -; 0x4B0 = 1200mA(Hoag Default) -; 0x5DC = 1500mA(IcosaMariko/Aula Default) -; 0x7D0 = 2000mA -; cdp_dcp_input_current_limit_in_ma = u32!0x5DC - -; Enough Power Threshold in mW -; 0x9858 = 39,000mW(Default) -; 0x4268 = 17,000mW(typical 9V/2A PD chargers) -; enough_power_threshold_mw = u32!0x9858 ;39,000mW - - - -[am.debug] -; Game Recording FPS and Bitrate -continuous_recording_fps = u32!60 ; 30 or 60 FPS -continuous_recording_video_bit_rate = u32!0x780000 ; ~7.5Mbps(0x780000 = 7,864,320), default is ~5Mbps, VBR(Variable Bitrate) - - - -; Other possibly related entries in PlatformConfig - -[apm] -; throttling_for_undock_enabled = u8!0x0 ; 1 for IcosaMariko/Aula, 0 for Hoag - -[psm] -; boost_threshold_in_milli_volt = u32!0xCF8 ; 3,320mV for IcosaMariko/Hoag, 0 for Aula -; charge_configuration_number = u32!0x0 ; 0 for IcosaMariko/Hoag, 1 for Aula - -[nvservices] -; external_display_full_dp_lanes = u8!0x0 ; 0 for IcosaMariko/Hoag, 1 for Aula - - - -; Disable Background service -; For power saving in standby mode -; Do NOT add this if online service is in use - -[bgtc] -enable_halfawake = u32!0x0 -minimum_interval_normal = u32!0x7FFFFFFF -minimum_interval_save = u32!0x7FFFFFFF -battery_threshold_save = u32!0x64 -battery_threshold_stop = u32!0x64 - -[npns] -background_processing = u8!0x0 -sleep_periodic_interval = u32!0x7FFFFFFF -sleep_processing_timeout = u32!0x0 -sleep_max_try_count = u32!0x0 - -[ns.notification] -enable_download_task_list = u8!0x0 -enable_download_ticket = u8!0x0 -enable_network_update = u8!0x0 -enable_random_wait = u8!0x0 -enable_request_on_cold_boot = u8!0x0 -enable_send_rights_usage_status_request = u8!0x0 -enable_sync_elicense_request = u8!0x0 -enable_version_list = u8!0x0 -retry_interval_min = u32!0x7FFFFFFF -retry_interval_max = u32!0x7FFFFFFF -version_list_waiting_limit_bias = u32!0x7FFFFFFF -version_list_waiting_limit_min = u32!0x7FFFFFFF - -[account] -na_required_for_network_service = u8!0x0 -na_license_verification_enabled = u8!0x0 - -[account.daemon] -background_awaking_periodicity = u32!0x7FFFFFFF -initial_schedule_delay = u32!0x7FFFFFFF -profile_sync_interval = u32!0x7FFFFFFF -na_info_refresh_interval = u32!0x7FFFFFFF - -[capsrv] -enable_album_screenshot_filedata_verification = u8!0x0 -enable_album_movie_filehash_verification = u8!0x0 -enable_album_movie_filesign_verification = u8!0x0 - -[friends] -background_processing = u8!0x0 - -[notification.presenter] -snooze_interval_in_seconds = u32!0x7FFFFFFF -connection_retry_count = u32!0x0 -alarm_pattern_total_repeat_count = u32!0x0 -alarm_pattern_with_vibration_repeat_count = u32!0x0 - -[prepo] -background_processing = u8!0x0 (shutdown directly when entering sleep mode) -transmission_interval_min = u32!0x7FFFFFFF -transmission_retry_interval_min = u32!0x7FFFFFFF -transmission_retry_interval_max = u32!0x7FFFFFFF -transmission_interval_in_sleep = u32!0x7FFFFFFF -statistics_save_interval_min = u32!0x7FFFFFFF -statistics_post_interval = u32!0x7FFFFFFF -save_system_report = u8!0x0 - -[olsc] -default_auto_upload_global_setting = u8!0x0 -default_auto_download_global_setting = u8!0x0 -autonomy_registration_interval_seconds = u32!0x7FFFFFFF -network_service_license_info_cache_expiration_seconds = u32!0x7FFFFFFF -postponed_transfer_task_processing_interval_seconds = u32!0x7FFFFFFF -retry_offset_seconds = u32!0x7FFFFFFF -network_trouble_detection_span_seconds = u32!0x7FFFFFFF -network_connection_polling_interval_seconds = u32!0x7FFFFFFF -is_save_data_backup_policy_check_required = u8!0x0 -is_global_transfer_task_autonomy_registration_enabled = u8!0x0 -is_on_event_transfer_task_registration_enabled = u8!0x0 -is_periodic_transfer_task_registration_enabled = u8!0x0 - -[ntc] -is_autonomic_correction_enabled = u8!0x0 -autonomic_correction_interval_seconds = u32!0x7FFFFFFF -autonomic_correction_failed_retry_interval_seconds = u32!0x7FFFFFFF -autonomic_correction_immediate_try_count_max = u32!0x0 -autonomic_correction_immediate_try_interval_milliseconds = u32!0x7FFFFFFF - -[systemupdate] -bgnup_retry_seconds = u32!0x7FFFFFFF - -[ns.rights] -skip_account_validation_on_rights_check = u8!0x1 -next_available_time_of_unexpected_error = u32!0x7FFFFFFF - -[pctl] -intermittent_task_interval_seconds = u32!0x7FFFFFFF - -[sprofile] -adjust_polling_interval_by_profile = u8!0x0 -polling_interval_sec_max = u32!0x7FFFFFFF -polling_interval_sec_min = u32!0x7FFFFFFF diff --git a/system_settings.md b/system_settings.md index 7285b656..94e6d103 100644 --- a/system_settings.md +++ b/system_settings.md @@ -1,18 +1,118 @@ -# `system_settings.ini` +## `/atmosphere/config/system_settings.ini` -## Cherry-pick from below and add them manually. - - - Fan Control Optimization (Mariko only) - - `[tc]` - - Set `holdable_tskin` to 52˚C (default 48˚C). - - Replacing stock thermal paste and adding thermal pad on Wi-Fi/BT module(shielded, adjacent to antennas) is recommended. - - Beware that Aula (OLED model) has worse cooling compared to all previous models. + - Default Fan Control Parameters + - [Info on tskin coefficients](https://github.com/masagrator/Status-Monitor-Overlay/blob/master/docs/modes.md#additional-info) + - If (tskin > holdable_tskin and handheld mode) or (tskin > touchable_tskin and dock mode), then fan speed is set to 100% regardlessly. + - https://switchbrew.org/wiki/System_Settings#tc - Disable background services (For power saving in standby mode) + - For power saving in standby mode - Do NOT add this if online service is in use. + ```ini + [bgtc] + enable_halfawake = u32!0x0 + minimum_interval_normal = u32!0x7FFFFFFF + minimum_interval_save = u32!0x7FFFFFFF + battery_threshold_save = u32!0x64 + battery_threshold_stop = u32!0x64 - - Game recording and SysDVR streaming @ 60fps with high video bitrate (7.5Mbps) - - `[am.debug]` + [npns] + background_processing = u8!0x0 + sleep_periodic_interval = u32!0x7FFFFFFF + sleep_processing_timeout = u32!0x0 + sleep_max_try_count = u32!0x0 + + [ns.notification] + enable_download_task_list = u8!0x0 + enable_download_ticket = u8!0x0 + enable_network_update = u8!0x0 + enable_random_wait = u8!0x0 + enable_request_on_cold_boot = u8!0x0 + enable_send_rights_usage_status_request = u8!0x0 + enable_sync_elicense_request = u8!0x0 + enable_version_list = u8!0x0 + retry_interval_min = u32!0x7FFFFFFF + retry_interval_max = u32!0x7FFFFFFF + version_list_waiting_limit_bias = u32!0x7FFFFFFF + version_list_waiting_limit_min = u32!0x7FFFFFFF + + [account] + na_required_for_network_service = u8!0x0 + na_license_verification_enabled = u8!0x0 + + [account.daemon] + background_awaking_periodicity = u32!0x7FFFFFFF + initial_schedule_delay = u32!0x7FFFFFFF + profile_sync_interval = u32!0x7FFFFFFF + na_info_refresh_interval = u32!0x7FFFFFFF + + [capsrv] + enable_album_screenshot_filedata_verification = u8!0x0 + enable_album_movie_filehash_verification = u8!0x0 + enable_album_movie_filesign_verification = u8!0x0 + + [friends] + background_processing = u8!0x0 + + [notification.presenter] + snooze_interval_in_seconds = u32!0x7FFFFFFF + connection_retry_count = u32!0x0 + alarm_pattern_total_repeat_count = u32!0x0 + alarm_pattern_with_vibration_repeat_count = u32!0x0 + + [prepo] + ;background_processing = u8!0x0 (shutdown directly when entering sleep mode) + transmission_interval_min = u32!0x7FFFFFFF + transmission_retry_interval_min = u32!0x7FFFFFFF + transmission_retry_interval_max = u32!0x7FFFFFFF + transmission_interval_in_sleep = u32!0x7FFFFFFF + statistics_save_interval_min = u32!0x7FFFFFFF + statistics_post_interval = u32!0x7FFFFFFF + save_system_report = u8!0x0 + + [olsc] + default_auto_upload_global_setting = u8!0x0 + default_auto_download_global_setting = u8!0x0 + autonomy_registration_interval_seconds = u32!0x7FFFFFFF + network_service_license_info_cache_expiration_seconds = u32!0x7FFFFFFF + postponed_transfer_task_processing_interval_seconds = u32!0x7FFFFFFF + retry_offset_seconds = u32!0x7FFFFFFF + network_trouble_detection_span_seconds = u32!0x7FFFFFFF + network_connection_polling_interval_seconds = u32!0x7FFFFFFF + is_save_data_backup_policy_check_required = u8!0x0 + is_global_transfer_task_autonomy_registration_enabled = u8!0x0 + is_on_event_transfer_task_registration_enabled = u8!0x0 + is_periodic_transfer_task_registration_enabled = u8!0x0 + + [ntc] + is_autonomic_correction_enabled = u8!0x0 + autonomic_correction_interval_seconds = u32!0x7FFFFFFF + autonomic_correction_failed_retry_interval_seconds = u32!0x7FFFFFFF + autonomic_correction_immediate_try_count_max = u32!0x0 + autonomic_correction_immediate_try_interval_milliseconds = u32!0x7FFFFFFF + + [systemupdate] + bgnup_retry_seconds = u32!0x7FFFFFFF + + [ns.rights] + skip_account_validation_on_rights_check = u8!0x1 + next_available_time_of_unexpected_error = u32!0x7FFFFFFF + + [pctl] + intermittent_task_interval_seconds = u32!0x7FFFFFFF + + [sprofile] + adjust_polling_interval_by_profile = u8!0x0 + polling_interval_sec_max = u32!0x7FFFFFFF + polling_interval_sec_min = u32!0x7FFFFFFF + ``` + + - FPS and bitrate of game recording and streaming + - ```ini + [am.debug] + continuous_recording_fps = u32!60 ; 30 or 60 FPS + continuous_recording_video_bit_rate = u32!0x780000 ; ~7.5Mbps(0x780000 = 7,864,320), default is ~5Mbps, VBR(Variable Bitrate) + ``` - Recommended: [dvr-patches](https://github.com/exelix11/dvr-patches): Allow screenshot/recording in any games and remove overlay image (copyright notice or logo). - For optimal streaming experience, SysDVR via USB interface is recommended. - Known Issues (won't fix) @@ -20,7 +120,7 @@ - It has noticeable performance impacts in demanding games. - Video duration shown in album will be doubled, while the playback speed or mp4 file itself are not affected. - - Change the threshold for chargers providing enough power - - `[psm]` - - `enough_power_threshold_mw` is be the threshold of "Official Charger" - - E.g. set it to `0x4268` (17,000 mW) and 18W power bank will be "Official Charger". + - Charging + - https://switchbrew.org/wiki/System_Settings#psm + - `enough_power_threshold_mw` + - `cdp_dcp_input_current_limit_in_ma`: 5V CDP/DCP (BC1.2/QC?) Charger Current Limit \ No newline at end of file diff --git a/system_settings_parser.py b/system_settings_parser.py new file mode 100755 index 00000000..3945971c --- /dev/null +++ b/system_settings_parser.py @@ -0,0 +1,46 @@ +#!python3 + +import os +import struct +import sys + +try: + fpath = sys.argv[1] +except IndexError: + raise SystemExit(f"Usage: {sys.argv[0]} ") + +file = open(fpath, "rb") +file.seek(0) +file_size = int.from_bytes(file.read(4), byteorder="little") + +domain_key_value = {} + +while file.tell() != file_size: + domain_key_len = int.from_bytes(file.read(4), byteorder="little") + domain_key = file.read(domain_key_len).decode().rstrip('\x00') + domain, key = domain_key.split("!") + + if not domain_key_value.get(domain): + domain_key_value[domain] = {} + + val_types = {1: "str", 2: "u8", 3: "u32"} + val_type = val_types.get(int.from_bytes(file.read(1), byteorder="little"), "unknown") + val_len = int.from_bytes(file.read(4), byteorder="little") + val = file.read(val_len) + + if val_type == "str": + value = '"' + val.decode().rstrip('\x00') + '"' + else: + val_dec = int.from_bytes(val, byteorder="little") + value = "0x" + format(val_dec, 'X') + if val_type == "u32" and val_dec >= 10: + val_dec = int.from_bytes(val, byteorder="little", signed=True) + value += f" ; {val_dec}" + + domain_key_value[domain][key] = f"{val_type}!{value}" + +for domain in sorted(domain_key_value.keys()): + print(f"[{domain}]") + for key in sorted(domain_key_value[domain].keys()): + print(f"{key} = {domain_key_value[domain][key]}") + print()