mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-23 07:10:09 +00:00
Added check in the backend to see if write is disabled
This commit is contained in:
parent
2ca12e7f38
commit
42e8cc75d6
@ -63,6 +63,7 @@ void Config::ReadCore() {
|
||||
|
||||
void Config::ReadData() {
|
||||
Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
|
||||
Settings::values.virtual_sd_writable = glfw_config->GetBoolean("Data Storage", "virtual_sd_writable", true);
|
||||
}
|
||||
|
||||
void Config::Reload() {
|
||||
|
@ -82,12 +82,14 @@ void Config::SaveCore() {
|
||||
void Config::ReadData() {
|
||||
qt_config->beginGroup("Data Storage");
|
||||
Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
|
||||
Settings::values.virtual_sd_writable = qt_config->value("virtual_sd_writable", true).toBool();
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
void Config::SaveData() {
|
||||
qt_config->beginGroup("Data Storage");
|
||||
qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
|
||||
qt_config->setValue("virtual_sd_writable", Settings::values.virtual_sd_writable);
|
||||
qt_config->endGroup();
|
||||
}
|
||||
|
||||
|
@ -50,6 +50,11 @@ bool Archive_SDMC::Initialize() {
|
||||
* @return Opened file, or nullptr
|
||||
*/
|
||||
std::unique_ptr<File> Archive_SDMC::OpenFile(const std::string& path, const Mode mode) const {
|
||||
if((mode.write_flag || mode.create_flag) && !Settings::values.virtual_sd_writable) {
|
||||
ERROR_LOG(KERNEL, "Cannot open archive %s in write or create mode while the SD card is set to read-only.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DEBUG_LOG(FILESYS, "called path=%s mode=%d", path.c_str(), mode);
|
||||
File_SDMC* file = new File_SDMC(this, path, mode);
|
||||
if (!file->Open())
|
||||
|
@ -3,6 +3,7 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <core/settings.h>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "common/file_util.h"
|
||||
@ -37,6 +38,11 @@ bool File_SDMC::Open() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if((mode.write_flag || mode.create_flag) && !Settings::values.virtual_sd_writable) {
|
||||
ERROR_LOG(KERNEL, "Cannot open file %s in write or create mode while the SD card is set to read-only.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string mode_string;
|
||||
if (mode.read_flag && mode.write_flag)
|
||||
mode_string = "w+";
|
||||
|
@ -32,6 +32,7 @@ struct Values {
|
||||
|
||||
// Data Storage
|
||||
bool use_virtual_sd;
|
||||
bool virtual_sd_writable;
|
||||
} extern values;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user