Merge pull request #8824 from Techjar/sd-read-only
Add option to disallow SD card writes
This commit is contained in:
commit
9f7c72b7eb
|
@ -105,6 +105,7 @@ const Info<bool> MAIN_CUSTOM_RTC_ENABLE{{System::Main, "Core", "EnableCustomRTC"
|
|||
// Default to seconds between 1.1.1970 and 1.1.2000
|
||||
const Info<u32> MAIN_CUSTOM_RTC_VALUE{{System::Main, "Core", "CustomRTCValue"}, 946684800};
|
||||
const Info<bool> MAIN_AUTO_DISC_CHANGE{{System::Main, "Core", "AutoDiscChange"}, false};
|
||||
const Info<bool> MAIN_ALLOW_SD_WRITES{{System::Main, "Core", "WiiSDCardAllowWrites"}, true};
|
||||
|
||||
// Main.Display
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ extern const Info<std::string> MAIN_PERF_MAP_DIR;
|
|||
extern const Info<bool> MAIN_CUSTOM_RTC_ENABLE;
|
||||
extern const Info<u32> MAIN_CUSTOM_RTC_VALUE;
|
||||
extern const Info<bool> MAIN_AUTO_DISC_CHANGE;
|
||||
extern const Info<bool> MAIN_ALLOW_SD_WRITES;
|
||||
|
||||
// Main.DSP
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ bool IsSettingSaveable(const Config::Location& config_location)
|
|||
&Config::MAIN_MEMCARD_A_PATH.location,
|
||||
&Config::MAIN_MEMCARD_B_PATH.location,
|
||||
&Config::MAIN_AUTO_DISC_CHANGE.location,
|
||||
&Config::MAIN_ALLOW_SD_WRITES.location,
|
||||
&Config::MAIN_DPL2_DECODER.location,
|
||||
&Config::MAIN_DPL2_QUALITY.location,
|
||||
&Config::MAIN_RAM_OVERRIDE_ENABLE.location,
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "Common/FileUtil.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/SDCardUtil.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/HW/Memmap.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
|
@ -25,6 +26,8 @@ namespace IOS::HLE::Device
|
|||
SDIOSlot0::SDIOSlot0(Kernel& ios, const std::string& device_name)
|
||||
: Device(ios, device_name), m_sdhc_supported(HasFeature(ios.GetVersion(), Feature::SDv2))
|
||||
{
|
||||
if (!Config::Get(Config::MAIN_ALLOW_SD_WRITES))
|
||||
INFO_LOG(IOS_SD, "Writes to SD card disabled by user");
|
||||
}
|
||||
|
||||
void SDIOSlot0::DoState(PointerWrap& p)
|
||||
|
@ -274,7 +277,8 @@ s32 SDIOSlot0::ExecuteCommand(const Request& request, u32 buffer_in, u32 buffer_
|
|||
INFO_LOG(IOS_SD, "%sWrite %i Block(s) from 0x%08x bsize %i to offset 0x%08x!",
|
||||
req.isDMA ? "DMA " : "", req.blocks, req.addr, req.bsize, req.arg);
|
||||
|
||||
if (m_card && SConfig::GetInstance().bEnableMemcardSdWriting)
|
||||
if (m_card && SConfig::GetInstance().bEnableMemcardSdWriting &&
|
||||
Config::Get(Config::MAIN_ALLOW_SD_WRITES))
|
||||
{
|
||||
u32 size = req.bsize * req.blocks;
|
||||
u64 address = GetAddressFromRequest(req.arg);
|
||||
|
|
|
@ -105,6 +105,8 @@ void NetPlayDialog::CreateMainLayout()
|
|||
m_data_menu = m_menu_bar->addMenu(tr("Data"));
|
||||
m_data_menu->setToolTipsVisible(true);
|
||||
m_save_sd_action = m_data_menu->addAction(tr("Write Save/SD Data"));
|
||||
m_save_sd_action->setToolTip(
|
||||
tr("If \"Allow Writes to SD Card\" is disabled this does not override it."));
|
||||
m_save_sd_action->setCheckable(true);
|
||||
m_load_wii_action = m_data_menu->addAction(tr("Load Wii Save"));
|
||||
m_load_wii_action->setCheckable(true);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "Common/Config/Config.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/Config/SYSCONFSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
|
@ -71,6 +72,7 @@ void WiiPane::ConnectLayout()
|
|||
connect(m_screensaver_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(m_allow_sd_writes_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(m_connect_keyboard_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(&Settings::Instance(), &Settings::SDCardInsertionChanged, m_sd_card_checkbox,
|
||||
&QCheckBox::setChecked);
|
||||
|
@ -105,6 +107,7 @@ void WiiPane::CreateMisc()
|
|||
m_pal60_mode_checkbox = new QCheckBox(tr("Use PAL60 Mode (EuRGB60)"));
|
||||
m_screensaver_checkbox = new QCheckBox(tr("Enable Screen Saver"));
|
||||
m_sd_card_checkbox = new QCheckBox(tr("Insert SD Card"));
|
||||
m_allow_sd_writes_checkbox = new QCheckBox(tr("Allow Writes to SD Card"));
|
||||
m_connect_keyboard_checkbox = new QCheckBox(tr("Connect USB Keyboard"));
|
||||
m_aspect_ratio_choice_label = new QLabel(tr("Aspect Ratio:"));
|
||||
m_aspect_ratio_choice = new QComboBox();
|
||||
|
@ -133,11 +136,12 @@ void WiiPane::CreateMisc()
|
|||
misc_settings_group_layout->addWidget(m_pal60_mode_checkbox, 0, 0, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_sd_card_checkbox, 0, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_screensaver_checkbox, 1, 0, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_connect_keyboard_checkbox, 1, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_aspect_ratio_choice_label, 2, 0, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_aspect_ratio_choice, 2, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_system_language_choice_label, 3, 0, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_system_language_choice, 3, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_allow_sd_writes_checkbox, 1, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_connect_keyboard_checkbox, 2, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_aspect_ratio_choice_label, 3, 0, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_aspect_ratio_choice, 3, 1, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_system_language_choice_label, 4, 0, 1, 1);
|
||||
misc_settings_group_layout->addWidget(m_system_language_choice, 4, 1, 1, 1);
|
||||
}
|
||||
|
||||
void WiiPane::CreateWhitelistedUSBPassthroughDevices()
|
||||
|
@ -210,6 +214,7 @@ void WiiPane::LoadConfig()
|
|||
m_screensaver_checkbox->setChecked(Config::Get(Config::SYSCONF_SCREENSAVER));
|
||||
m_pal60_mode_checkbox->setChecked(Config::Get(Config::SYSCONF_PAL60));
|
||||
m_sd_card_checkbox->setChecked(Settings::Instance().IsSDCardInserted());
|
||||
m_allow_sd_writes_checkbox->setChecked(Config::Get(Config::MAIN_ALLOW_SD_WRITES));
|
||||
m_connect_keyboard_checkbox->setChecked(Settings::Instance().IsUSBKeyboardConnected());
|
||||
m_aspect_ratio_choice->setCurrentIndex(Config::Get(Config::SYSCONF_WIDESCREEN));
|
||||
m_system_language_choice->setCurrentIndex(Config::Get(Config::SYSCONF_LANGUAGE));
|
||||
|
@ -230,6 +235,7 @@ void WiiPane::OnSaveConfig()
|
|||
Config::SetBase(Config::SYSCONF_SCREENSAVER, m_screensaver_checkbox->isChecked());
|
||||
Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->isChecked());
|
||||
Settings::Instance().SetSDCardInserted(m_sd_card_checkbox->isChecked());
|
||||
Config::SetBase(Config::MAIN_ALLOW_SD_WRITES, m_allow_sd_writes_checkbox->isChecked());
|
||||
Settings::Instance().SetUSBKeyboardConnected(m_connect_keyboard_checkbox->isChecked());
|
||||
|
||||
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_POSITION,
|
||||
|
|
|
@ -44,6 +44,7 @@ private:
|
|||
QCheckBox* m_screensaver_checkbox;
|
||||
QCheckBox* m_pal60_mode_checkbox;
|
||||
QCheckBox* m_sd_card_checkbox;
|
||||
QCheckBox* m_allow_sd_writes_checkbox;
|
||||
QCheckBox* m_connect_keyboard_checkbox;
|
||||
QComboBox* m_system_language_choice;
|
||||
QLabel* m_system_language_choice_label;
|
||||
|
|
Loading…
Reference in New Issue