add ini option to disable cal0 write protection

This commit is contained in:
Nick Hu 2020-04-19 13:20:25 +01:00
parent dcfb3bc9b5
commit b3af31a6d8
No known key found for this signature in database
GPG key ID: 9E35DDA3DF631330
3 changed files with 12 additions and 1 deletions

View file

@ -26,6 +26,9 @@
; Enable reading the CAL0 partition for HBL.
; This is probably undesirable for normal usage.
; enable_hbl_cal_read = u8!0x0
; Disable CAL0 write-protection
; This is almost certainly undesirable and dangerous for normal usage
; disable_cal_write = u8!0x0 WARRANTY VOID IF CHANGED - YOU HAVE BEEN WARNED
; Controls whether fs.mitm should redirect save files
; to directories on the sd card.
; 0 = Do not redirect, 1 = Redirect.

View file

@ -251,6 +251,7 @@ namespace ams::mitm::fs {
const bool is_sysmodule = ncm::IsSystemProgramId(this->client_info.program_id);
const bool is_hbl = this->client_info.override_status.IsHbl();
const bool cal_write_protect = !GetSettingsItemBooleanValue("atmosphere", "disable_cal_write");
const bool can_write_bis = is_sysmodule || (is_hbl && GetSettingsItemBooleanValue("atmosphere", "enable_hbl_bis_write"));
const bool can_read_cal = is_sysmodule || (is_hbl && GetSettingsItemBooleanValue("atmosphere", "enable_hbl_cal_read"));
@ -266,8 +267,11 @@ namespace ams::mitm::fs {
out.SetValue(std::make_shared<IStorageInterface>(new Boot0Storage(bis_storage, this->client_info)), target_object_id);
} else if (bis_partition_id == FsBisPartitionId_CalibrationBinary) {
/* PRODINFO should *never* be writable. */
if (!cal_write_protect) {
/* unless the user explicitly disabled write-protection */
out.SetValue(std::make_shared<IStorageInterface>(new RemoteStorage(bis_storage)), target_object_id);
/* If we have permissions, create a read only storage. */
if (can_read_cal) {
} else if (can_read_cal) {
out.SetValue(std::make_shared<IStorageInterface>(new ReadOnlyStorageAdapter(new RemoteStorage(bis_storage))), target_object_id);
} else {
/* If we can't read cal, return permission denied. */

View file

@ -332,6 +332,10 @@ namespace ams::settings::fwdbg {
/* This is probably undesirable for normal usage. */
R_ABORT_UNLESS(ParseSettingsItemValue("atmosphere", "enable_hbl_cal_read", "u8!0x0"));
/* Disable CAL0 write-protection */
/* This is almost certainly undesirable and dangerous for normal usage. */
R_ABORT_UNLESS(ParseSettingsItemValue("atmosphere", "disable_cal_write", "u8!0x0"));
/* Controls whether dmnt cheats should be toggled on or off by */
/* default. 1 = toggled on by default, 0 = toggled off by default. */
R_ABORT_UNLESS(ParseSettingsItemValue("atmosphere", "dmnt_cheats_enabled_by_default", "u8!0x1"));