summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/file_sys/bis_factory.cpp23
-rw-r--r--src/core/file_sys/sdmc_factory.cpp4
-rw-r--r--src/core/settings.h29
-rw-r--r--src/yuzu/configuration/config.cpp29
-rw-r--r--src/yuzu/configuration/configure_filesystem.cpp27
-rw-r--r--src/yuzu/configuration/configure_filesystem.ui121
-rw-r--r--src/yuzu_cmd/config.cpp9
7 files changed, 17 insertions, 225 deletions
diff --git a/src/core/file_sys/bis_factory.cpp b/src/core/file_sys/bis_factory.cpp
index 8935a62c3..285277ef8 100644
--- a/src/core/file_sys/bis_factory.cpp
+++ b/src/core/file_sys/bis_factory.cpp
@@ -12,6 +12,10 @@
12 12
13namespace FileSys { 13namespace FileSys {
14 14
15constexpr u64 NAND_USER_SIZE = 0x680000000; // 26624 MiB
16constexpr u64 NAND_SYSTEM_SIZE = 0xA0000000; // 2560 MiB
17constexpr u64 NAND_TOTAL_SIZE = 0x747C00000; // 29820 MiB
18
15BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_) 19BISFactory::BISFactory(VirtualDir nand_root_, VirtualDir load_root_, VirtualDir dump_root_)
16 : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)), 20 : nand_root(std::move(nand_root_)), load_root(std::move(load_root_)),
17 dump_root(std::move(dump_root_)), 21 dump_root(std::move(dump_root_)),
@@ -110,30 +114,29 @@ VirtualDir BISFactory::GetImageDirectory() const {
110 114
111u64 BISFactory::GetSystemNANDFreeSpace() const { 115u64 BISFactory::GetSystemNANDFreeSpace() const {
112 const auto sys_dir = GetOrCreateDirectoryRelative(nand_root, "/system"); 116 const auto sys_dir = GetOrCreateDirectoryRelative(nand_root, "/system");
113 if (sys_dir == nullptr) 117 if (sys_dir == nullptr) {
114 return 0; 118 return GetSystemNANDTotalSpace();
119 }
115 120
116 return GetSystemNANDTotalSpace() - sys_dir->GetSize(); 121 return GetSystemNANDTotalSpace() - sys_dir->GetSize();
117} 122}
118 123
119u64 BISFactory::GetSystemNANDTotalSpace() const { 124u64 BISFactory::GetSystemNANDTotalSpace() const {
120 return static_cast<u64>(Settings::values.nand_system_size); 125 return NAND_SYSTEM_SIZE;
121} 126}
122 127
123u64 BISFactory::GetUserNANDFreeSpace() const { 128u64 BISFactory::GetUserNANDFreeSpace() const {
124 const auto usr_dir = GetOrCreateDirectoryRelative(nand_root, "/user"); 129 // For some reason games such as BioShock 1 checks whether this is exactly 0x680000000 bytes.
125 if (usr_dir == nullptr) 130 // Set the free space to be 1 MiB less than the total as a workaround to this issue.
126 return 0; 131 return GetUserNANDTotalSpace() - 0x100000;
127
128 return GetUserNANDTotalSpace() - usr_dir->GetSize();
129} 132}
130 133
131u64 BISFactory::GetUserNANDTotalSpace() const { 134u64 BISFactory::GetUserNANDTotalSpace() const {
132 return static_cast<u64>(Settings::values.nand_user_size); 135 return NAND_USER_SIZE;
133} 136}
134 137
135u64 BISFactory::GetFullNANDTotalSpace() const { 138u64 BISFactory::GetFullNANDTotalSpace() const {
136 return static_cast<u64>(Settings::values.nand_total_size); 139 return NAND_TOTAL_SIZE;
137} 140}
138 141
139VirtualDir BISFactory::GetBCATDirectory(u64 title_id) const { 142VirtualDir BISFactory::GetBCATDirectory(u64 title_id) const {
diff --git a/src/core/file_sys/sdmc_factory.cpp b/src/core/file_sys/sdmc_factory.cpp
index 5113a1ca6..6f732e4d8 100644
--- a/src/core/file_sys/sdmc_factory.cpp
+++ b/src/core/file_sys/sdmc_factory.cpp
@@ -10,6 +10,8 @@
10 10
11namespace FileSys { 11namespace FileSys {
12 12
13constexpr u64 SDMC_TOTAL_SIZE = 0x10000000000; // 1 TiB
14
13SDMCFactory::SDMCFactory(VirtualDir dir_) 15SDMCFactory::SDMCFactory(VirtualDir dir_)
14 : dir(std::move(dir_)), contents(std::make_unique<RegisteredCache>( 16 : dir(std::move(dir_)), contents(std::make_unique<RegisteredCache>(
15 GetOrCreateDirectoryRelative(dir, "/Nintendo/Contents/registered"), 17 GetOrCreateDirectoryRelative(dir, "/Nintendo/Contents/registered"),
@@ -46,7 +48,7 @@ u64 SDMCFactory::GetSDMCFreeSpace() const {
46} 48}
47 49
48u64 SDMCFactory::GetSDMCTotalSpace() const { 50u64 SDMCFactory::GetSDMCTotalSpace() const {
49 return static_cast<u64>(Settings::values.sdmc_size); 51 return SDMC_TOTAL_SIZE;
50} 52}
51 53
52} // namespace FileSys 54} // namespace FileSys
diff --git a/src/core/settings.h b/src/core/settings.h
index 850ca4072..29dc57c16 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -346,31 +346,6 @@ struct TouchscreenInput {
346 u32 rotation_angle; 346 u32 rotation_angle;
347}; 347};
348 348
349enum class NANDTotalSize : u64 {
350 S29_1GB = 0x747C00000ULL,
351};
352
353enum class NANDUserSize : u64 {
354 S26GB = 0x680000000ULL,
355};
356
357enum class NANDSystemSize : u64 {
358 S2_5GB = 0xA0000000,
359};
360
361enum class SDMCSize : u64 {
362 S1GB = 0x40000000,
363 S2GB = 0x80000000,
364 S4GB = 0x100000000ULL,
365 S8GB = 0x200000000ULL,
366 S16GB = 0x400000000ULL,
367 S32GB = 0x800000000ULL,
368 S64GB = 0x1000000000ULL,
369 S128GB = 0x2000000000ULL,
370 S256GB = 0x4000000000ULL,
371 S1TB = 0x10000000000ULL,
372};
373
374enum class RendererBackend { 349enum class RendererBackend {
375 OpenGL = 0, 350 OpenGL = 0,
376 Vulkan = 1, 351 Vulkan = 1,
@@ -491,10 +466,6 @@ struct Values {
491 bool gamecard_inserted; 466 bool gamecard_inserted;
492 bool gamecard_current_game; 467 bool gamecard_current_game;
493 std::string gamecard_path; 468 std::string gamecard_path;
494 NANDTotalSize nand_total_size;
495 NANDSystemSize nand_system_size;
496 NANDUserSize nand_user_size;
497 SDMCSize sdmc_size;
498 469
499 // Debugging 470 // Debugging
500 bool record_frame_times; 471 bool record_frame_times;
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 1b2b1b2bb..f48785697 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -505,22 +505,6 @@ void Config::ReadDataStorageValues() {
505 ReadSetting(QStringLiteral("gamecard_current_game"), false).toBool(); 505 ReadSetting(QStringLiteral("gamecard_current_game"), false).toBool();
506 Settings::values.gamecard_path = 506 Settings::values.gamecard_path =
507 ReadSetting(QStringLiteral("gamecard_path"), QStringLiteral("")).toString().toStdString(); 507 ReadSetting(QStringLiteral("gamecard_path"), QStringLiteral("")).toString().toStdString();
508 Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(
509 ReadSetting(QStringLiteral("nand_total_size"),
510 QVariant::fromValue<u64>(static_cast<u64>(Settings::NANDTotalSize::S29_1GB)))
511 .toULongLong());
512 Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(
513 ReadSetting(QStringLiteral("nand_user_size"),
514 QVariant::fromValue<u64>(static_cast<u64>(Settings::NANDUserSize::S26GB)))
515 .toULongLong());
516 Settings::values.nand_system_size = static_cast<Settings::NANDSystemSize>(
517 ReadSetting(QStringLiteral("nand_system_size"),
518 QVariant::fromValue<u64>(static_cast<u64>(Settings::NANDSystemSize::S2_5GB)))
519 .toULongLong());
520 Settings::values.sdmc_size = static_cast<Settings::SDMCSize>(
521 ReadSetting(QStringLiteral("sdmc_size"),
522 QVariant::fromValue<u64>(static_cast<u64>(Settings::SDMCSize::S16GB)))
523 .toULongLong());
524 508
525 qt_config->endGroup(); 509 qt_config->endGroup();
526} 510}
@@ -1006,18 +990,7 @@ void Config::SaveDataStorageValues() {
1006 false); 990 false);
1007 WriteSetting(QStringLiteral("gamecard_path"), 991 WriteSetting(QStringLiteral("gamecard_path"),
1008 QString::fromStdString(Settings::values.gamecard_path), QStringLiteral("")); 992 QString::fromStdString(Settings::values.gamecard_path), QStringLiteral(""));
1009 WriteSetting(QStringLiteral("nand_total_size"), 993
1010 QVariant::fromValue<u64>(static_cast<u64>(Settings::values.nand_total_size)),
1011 QVariant::fromValue<u64>(static_cast<u64>(Settings::NANDTotalSize::S29_1GB)));
1012 WriteSetting(QStringLiteral("nand_user_size"),
1013 QVariant::fromValue<u64>(static_cast<u64>(Settings::values.nand_user_size)),
1014 QVariant::fromValue<u64>(static_cast<u64>(Settings::NANDUserSize::S26GB)));
1015 WriteSetting(QStringLiteral("nand_system_size"),
1016 QVariant::fromValue<u64>(static_cast<u64>(Settings::values.nand_system_size)),
1017 QVariant::fromValue<u64>(static_cast<u64>(Settings::NANDSystemSize::S2_5GB)));
1018 WriteSetting(QStringLiteral("sdmc_size"),
1019 QVariant::fromValue<u64>(static_cast<u64>(Settings::values.sdmc_size)),
1020 QVariant::fromValue<u64>(static_cast<u64>(Settings::SDMCSize::S16GB)));
1021 qt_config->endGroup(); 994 qt_config->endGroup();
1022} 995}
1023 996
diff --git a/src/yuzu/configuration/configure_filesystem.cpp b/src/yuzu/configuration/configure_filesystem.cpp
index 835ee821c..a089f5733 100644
--- a/src/yuzu/configuration/configure_filesystem.cpp
+++ b/src/yuzu/configuration/configure_filesystem.cpp
@@ -11,19 +11,6 @@
11#include "yuzu/configuration/configure_filesystem.h" 11#include "yuzu/configuration/configure_filesystem.h"
12#include "yuzu/uisettings.h" 12#include "yuzu/uisettings.h"
13 13
14namespace {
15
16template <typename T>
17void SetComboBoxFromData(QComboBox* combo_box, T data) {
18 const auto index = combo_box->findData(QVariant::fromValue(static_cast<u64>(data)));
19 if (index >= combo_box->count() || index < 0)
20 return;
21
22 combo_box->setCurrentIndex(index);
23}
24
25} // Anonymous namespace
26
27ConfigureFilesystem::ConfigureFilesystem(QWidget* parent) 14ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
28 : QWidget(parent), ui(std::make_unique<Ui::ConfigureFilesystem>()) { 15 : QWidget(parent), ui(std::make_unique<Ui::ConfigureFilesystem>()) {
29 ui->setupUi(this); 16 ui->setupUi(this);
@@ -73,11 +60,6 @@ void ConfigureFilesystem::setConfiguration() {
73 60
74 ui->cache_game_list->setChecked(UISettings::values.cache_game_list); 61 ui->cache_game_list->setChecked(UISettings::values.cache_game_list);
75 62
76 SetComboBoxFromData(ui->nand_size, Settings::values.nand_total_size);
77 SetComboBoxFromData(ui->usrnand_size, Settings::values.nand_user_size);
78 SetComboBoxFromData(ui->sysnand_size, Settings::values.nand_system_size);
79 SetComboBoxFromData(ui->sdmc_size, Settings::values.sdmc_size);
80
81 UpdateEnabledControls(); 63 UpdateEnabledControls();
82} 64}
83 65
@@ -98,15 +80,6 @@ void ConfigureFilesystem::applyConfiguration() {
98 Settings::values.dump_nso = ui->dump_nso->isChecked(); 80 Settings::values.dump_nso = ui->dump_nso->isChecked();
99 81
100 UISettings::values.cache_game_list = ui->cache_game_list->isChecked(); 82 UISettings::values.cache_game_list = ui->cache_game_list->isChecked();
101
102 Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(
103 ui->nand_size->itemData(ui->nand_size->currentIndex()).toULongLong());
104 Settings::values.nand_system_size = static_cast<Settings::NANDSystemSize>(
105 ui->nand_size->itemData(ui->sysnand_size->currentIndex()).toULongLong());
106 Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(
107 ui->nand_size->itemData(ui->usrnand_size->currentIndex()).toULongLong());
108 Settings::values.sdmc_size = static_cast<Settings::SDMCSize>(
109 ui->nand_size->itemData(ui->sdmc_size->currentIndex()).toULongLong());
110} 83}
111 84
112void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit) { 85void ConfigureFilesystem::SetDirectory(DirectoryTarget target, QLineEdit* edit) {
diff --git a/src/yuzu/configuration/configure_filesystem.ui b/src/yuzu/configuration/configure_filesystem.ui
index 58cd07f52..84bea0600 100644
--- a/src/yuzu/configuration/configure_filesystem.ui
+++ b/src/yuzu/configuration/configure_filesystem.ui
@@ -116,127 +116,6 @@
116 </widget> 116 </widget>
117 </item> 117 </item>
118 <item> 118 <item>
119 <widget class="QGroupBox" name="groupBox_3">
120 <property name="title">
121 <string>Storage Sizes</string>
122 </property>
123 <layout class="QGridLayout" name="gridLayout_3">
124 <item row="3" column="0">
125 <widget class="QLabel" name="label_5">
126 <property name="text">
127 <string>SD Card</string>
128 </property>
129 </widget>
130 </item>
131 <item row="1" column="0">
132 <widget class="QLabel" name="label_4">
133 <property name="text">
134 <string>System NAND</string>
135 </property>
136 </widget>
137 </item>
138 <item row="1" column="1">
139 <widget class="QComboBox" name="sysnand_size">
140 <item>
141 <property name="text">
142 <string>2.5 GB</string>
143 </property>
144 </item>
145 </widget>
146 </item>
147 <item row="3" column="1">
148 <widget class="QComboBox" name="sdmc_size">
149 <property name="currentText">
150 <string>32 GB</string>
151 </property>
152 <item>
153 <property name="text">
154 <string>1 GB</string>
155 </property>
156 </item>
157 <item>
158 <property name="text">
159 <string>2 GB</string>
160 </property>
161 </item>
162 <item>
163 <property name="text">
164 <string>4 GB</string>
165 </property>
166 </item>
167 <item>
168 <property name="text">
169 <string>8 GB</string>
170 </property>
171 </item>
172 <item>
173 <property name="text">
174 <string>16 GB</string>
175 </property>
176 </item>
177 <item>
178 <property name="text">
179 <string>32 GB</string>
180 </property>
181 </item>
182 <item>
183 <property name="text">
184 <string>64 GB</string>
185 </property>
186 </item>
187 <item>
188 <property name="text">
189 <string>128 GB</string>
190 </property>
191 </item>
192 <item>
193 <property name="text">
194 <string>256 GB</string>
195 </property>
196 </item>
197 <item>
198 <property name="text">
199 <string>1 TB</string>
200 </property>
201 </item>
202 </widget>
203 </item>
204 <item row="2" column="1">
205 <widget class="QComboBox" name="usrnand_size">
206 <item>
207 <property name="text">
208 <string>26 GB</string>
209 </property>
210 </item>
211 </widget>
212 </item>
213 <item row="2" column="0">
214 <widget class="QLabel" name="label_6">
215 <property name="text">
216 <string>User NAND</string>
217 </property>
218 </widget>
219 </item>
220 <item row="0" column="0">
221 <widget class="QLabel" name="label_7">
222 <property name="text">
223 <string>NAND</string>
224 </property>
225 </widget>
226 </item>
227 <item row="0" column="1">
228 <widget class="QComboBox" name="nand_size">
229 <item>
230 <property name="text">
231 <string>29.1 GB</string>
232 </property>
233 </item>
234 </widget>
235 </item>
236 </layout>
237 </widget>
238 </item>
239 <item>
240 <widget class="QGroupBox" name="groupBox_4"> 119 <widget class="QGroupBox" name="groupBox_4">
241 <property name="title"> 120 <property name="title">
242 <string>Patch Manager</string> 121 <string>Patch Manager</string>
diff --git a/src/yuzu_cmd/config.cpp b/src/yuzu_cmd/config.cpp
index 23763144f..dce70a1e0 100644
--- a/src/yuzu_cmd/config.cpp
+++ b/src/yuzu_cmd/config.cpp
@@ -335,15 +335,6 @@ void Config::ReadValues() {
335 Settings::values.gamecard_current_game = 335 Settings::values.gamecard_current_game =
336 sdl2_config->GetBoolean("Data Storage", "gamecard_current_game", false); 336 sdl2_config->GetBoolean("Data Storage", "gamecard_current_game", false);
337 Settings::values.gamecard_path = sdl2_config->Get("Data Storage", "gamecard_path", ""); 337 Settings::values.gamecard_path = sdl2_config->Get("Data Storage", "gamecard_path", "");
338 Settings::values.nand_total_size = static_cast<Settings::NANDTotalSize>(sdl2_config->GetInteger(
339 "Data Storage", "nand_total_size", static_cast<long>(Settings::NANDTotalSize::S29_1GB)));
340 Settings::values.nand_user_size = static_cast<Settings::NANDUserSize>(sdl2_config->GetInteger(
341 "Data Storage", "nand_user_size", static_cast<long>(Settings::NANDUserSize::S26GB)));
342 Settings::values.nand_system_size = static_cast<Settings::NANDSystemSize>(
343 sdl2_config->GetInteger("Data Storage", "nand_system_size",
344 static_cast<long>(Settings::NANDSystemSize::S2_5GB)));
345 Settings::values.sdmc_size = static_cast<Settings::SDMCSize>(sdl2_config->GetInteger(
346 "Data Storage", "sdmc_size", static_cast<long>(Settings::SDMCSize::S16GB)));
347 338
348 // System 339 // System
349 Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false); 340 Settings::values.use_docked_mode = sdl2_config->GetBoolean("System", "use_docked_mode", false);