summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar archshift2014-10-09 19:43:40 -0700
committerGravatar archshift2014-10-22 15:24:25 -0700
commita59f57d50467bd5dba1f28b8020278d6298babf7 (patch)
tree62f1528fcb2815bcb382ea8c606b6fa8fc18ba95
parentMerge pull request #145 from yuriks/shader-log-crash (diff)
downloadyuzu-a59f57d50467bd5dba1f28b8020278d6298babf7.tar.gz
yuzu-a59f57d50467bd5dba1f28b8020278d6298babf7.tar.xz
yuzu-a59f57d50467bd5dba1f28b8020278d6298babf7.zip
Use config files to store whether SDMC is enabled or not
Before, it used to use whether the directory actually existed. As a result, .citra-emu/sdmc was never auto-created (something quite confusing to me until I read through the logs).
Diffstat (limited to '')
-rw-r--r--src/citra/config.cpp5
-rw-r--r--src/citra/config.h1
-rw-r--r--src/citra/default_ini.h3
-rw-r--r--src/citra_qt/config.cpp14
-rw-r--r--src/citra_qt/config.h3
-rw-r--r--src/core/file_sys/archive_sdmc.cpp10
-rw-r--r--src/core/settings.h2
7 files changed, 36 insertions, 2 deletions
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 1d5e9c717..03a0ce606 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -55,9 +55,14 @@ void Config::ReadControls() {
55 Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT); 55 Settings::values.pad_sright_key = glfw_config->GetInteger("Controls", "pad_sright", GLFW_KEY_RIGHT);
56} 56}
57 57
58void Config::ReadData() {
59 Settings::values.use_virtual_sd = glfw_config->GetBoolean("Data Storage", "use_virtual_sd", true);
60}
61
58void Config::Reload() { 62void Config::Reload() {
59 LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file); 63 LoadINI(glfw_config, glfw_config_loc.c_str(), DefaultINI::glfw_config_file);
60 ReadControls(); 64 ReadControls();
65 ReadData();
61} 66}
62 67
63Config::~Config() { 68Config::~Config() {
diff --git a/src/citra/config.h b/src/citra/config.h
index de0570b42..c4fac2459 100644
--- a/src/citra/config.h
+++ b/src/citra/config.h
@@ -16,6 +16,7 @@ class Config {
16 16
17 bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true); 17 bool LoadINI(INIReader* config, const char* location, const std::string& default_contents="", bool retry=true);
18 void ReadControls(); 18 void ReadControls();
19 void ReadData();
19public: 20public:
20 Config(); 21 Config();
21 ~Config(); 22 ~Config();
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index 11b985e1b..e7e45f4a9 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -25,6 +25,9 @@ pad_sup =
25pad_sdown = 25pad_sdown =
26pad_sleft = 26pad_sleft =
27pad_sright = 27pad_sright =
28
29[Data Storage]
30use_virtual_sd =
28)"; 31)";
29 32
30} 33}
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 1b116edc5..0c4f75a96 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -64,12 +64,26 @@ void Config::SaveControls() {
64 qt_config->endGroup(); 64 qt_config->endGroup();
65} 65}
66 66
67void Config::ReadData() {
68 qt_config->beginGroup("Data Storage");
69 Settings::values.use_virtual_sd = qt_config->value("use_virtual_sd", true).toBool();
70 qt_config->endGroup();
71}
72
73void Config::SaveData() {
74 qt_config->beginGroup("Data Storage");
75 qt_config->setValue("use_virtual_sd", Settings::values.use_virtual_sd);
76 qt_config->endGroup();
77}
78
67void Config::Reload() { 79void Config::Reload() {
68 ReadControls(); 80 ReadControls();
81 ReadData();
69} 82}
70 83
71void Config::Save() { 84void Config::Save() {
72 SaveControls(); 85 SaveControls();
86 SaveData();
73} 87}
74 88
75Config::~Config() { 89Config::~Config() {
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h
index ae390be6b..74c9ff11d 100644
--- a/src/citra_qt/config.h
+++ b/src/citra_qt/config.h
@@ -14,6 +14,9 @@ class Config {
14 14
15 void ReadControls(); 15 void ReadControls();
16 void SaveControls(); 16 void SaveControls();
17
18 void ReadData();
19 void SaveData();
17public: 20public:
18 Config(); 21 Config();
19 ~Config(); 22 ~Config();
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index 213923c02..0b647f7d0 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -10,6 +10,7 @@
10#include "core/file_sys/archive_sdmc.h" 10#include "core/file_sys/archive_sdmc.h"
11#include "core/file_sys/directory_sdmc.h" 11#include "core/file_sys/directory_sdmc.h"
12#include "core/file_sys/file_sdmc.h" 12#include "core/file_sys/file_sdmc.h"
13#include "core/settings.h"
13 14
14//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
15// FileSys namespace 16// FileSys namespace
@@ -29,8 +30,13 @@ Archive_SDMC::~Archive_SDMC() {
29 * @return true if it initialized successfully 30 * @return true if it initialized successfully
30 */ 31 */
31bool Archive_SDMC::Initialize() { 32bool Archive_SDMC::Initialize() {
32 if (!FileUtil::IsDirectory(mount_point)) { 33 if (!Settings::values.use_virtual_sd) {
33 WARN_LOG(FILESYS, "Directory %s not found, disabling SDMC.", mount_point.c_str()); 34 WARN_LOG(FILESYS, "SDMC disabled by config.");
35 return false;
36 }
37
38 if (!FileUtil::CreateFullPath(mount_point)) {
39 WARN_LOG(FILESYS, "Unable to create SDMC path.");
34 return false; 40 return false;
35 } 41 }
36 42
diff --git a/src/core/settings.h b/src/core/settings.h
index a84c3d4b6..d586e2ef4 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -24,6 +24,8 @@ struct Values {
24 int pad_sdown_key; 24 int pad_sdown_key;
25 int pad_sleft_key; 25 int pad_sleft_key;
26 int pad_sright_key; 26 int pad_sright_key;
27
28 bool use_virtual_sd;
27} extern values; 29} extern values;
28 30
29} 31}