mount hdd by default, add hdd write protect option.

This commit is contained in:
ITotalJustice
2025-05-26 19:25:09 +01:00
parent 793b36fd59
commit 3ca82463cc
5 changed files with 45 additions and 4 deletions

View File

@@ -617,6 +617,10 @@ auto App::GetHddEnable() -> bool {
return g_app->m_hdd_enabled.Get();
}
auto App::GetWriteProtect() -> bool {
return g_app->m_hdd_write_protect.Get();
}
auto App::GetLogEnable() -> bool {
return g_app->m_log_enabled.Get();
}
@@ -688,6 +692,9 @@ void App::SetHddEnable(bool enable) {
if (App::GetHddEnable() != enable) {
g_app->m_hdd_enabled.Set(enable);
if (enable) {
if (App::GetWriteProtect()) {
usbHsFsSetFileSystemMountFlags(UsbHsFsMountFlags_ReadOnly);
}
usbHsFsInitialize(1);
} else {
usbHsFsExit();
@@ -695,6 +702,18 @@ void App::SetHddEnable(bool enable) {
}
}
void App::SetWriteProtect(bool enable) {
if (App::GetWriteProtect() != enable) {
g_app->m_hdd_write_protect.Set(enable);
if (enable) {
usbHsFsSetFileSystemMountFlags(UsbHsFsMountFlags_ReadOnly);
} else {
usbHsFsSetFileSystemMountFlags(0);
}
}
}
void App::SetLogEnable(bool enable) {
if (App::GetLogEnable() != enable) {
g_app->m_log_enabled.Set(enable);
@@ -1284,6 +1303,7 @@ App::App(const char* argv0) {
else if (app->m_mtp_enabled.LoadFrom(Key, Value)) {}
else if (app->m_ftp_enabled.LoadFrom(Key, Value)) {}
else if (app->m_hdd_enabled.LoadFrom(Key, Value)) {}
else if (app->m_hdd_write_protect.LoadFrom(Key, Value)) {}
else if (app->m_log_enabled.LoadFrom(Key, Value)) {}
else if (app->m_replace_hbmenu.LoadFrom(Key, Value)) {}
else if (app->m_theme_path.LoadFrom(Key, Value)) {}
@@ -1311,6 +1331,8 @@ App::App(const char* argv0) {
else if (app->m_convert_to_standard_crypto.LoadFrom(Key, Value)) {}
else if (app->m_lower_master_key.LoadFrom(Key, Value)) {}
else if (app->m_lower_system_version.LoadFrom(Key, Value)) {}
} else if (!std::strcmp(Section, "accessibility")) {
if (app->m_text_scroll_speed.LoadFrom(Key, Value)) {}
}
return 1;
@@ -1338,6 +1360,10 @@ App::App(const char* argv0) {
nxlinkInitialize(nxlink_callback);
}
if (App::GetWriteProtect()) {
usbHsFsSetFileSystemMountFlags(UsbHsFsMountFlags_ReadOnly);
}
if (App::GetHddEnable()) {
usbHsFsInitialize(1);
}