mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-03 15:00:02 +00:00
Separate UserNand and Sdmc directories
This commit is contained in:
parent
dfec9c9a43
commit
5aaafa6a56
5 changed files with 59 additions and 32 deletions
|
@ -535,10 +535,12 @@ void Config::ReadPathValues() {
|
||||||
// also carries over old game list settings if present
|
// also carries over old game list settings if present
|
||||||
if (UISettings::values.game_dirs.isEmpty()) {
|
if (UISettings::values.game_dirs.isEmpty()) {
|
||||||
UISettings::GameDir game_dir;
|
UISettings::GameDir game_dir;
|
||||||
game_dir.path = QStringLiteral("INSTALLED");
|
game_dir.path = QStringLiteral("SDMC");
|
||||||
game_dir.expanded = true;
|
game_dir.expanded = true;
|
||||||
UISettings::values.game_dirs.append(game_dir);
|
UISettings::values.game_dirs.append(game_dir);
|
||||||
game_dir.path = QStringLiteral("SYSTEM");
|
game_dir.path = QStringLiteral("UserNAND");
|
||||||
|
UISettings::values.game_dirs.append(game_dir);
|
||||||
|
game_dir.path = QStringLiteral("SysNAND");
|
||||||
UISettings::values.game_dirs.append(game_dir);
|
UISettings::values.game_dirs.append(game_dir);
|
||||||
if (UISettings::values.game_dir_deprecated != QStringLiteral(".")) {
|
if (UISettings::values.game_dir_deprecated != QStringLiteral(".")) {
|
||||||
game_dir.path = UISettings::values.game_dir_deprecated;
|
game_dir.path = UISettings::values.game_dir_deprecated;
|
||||||
|
|
|
@ -161,8 +161,8 @@ static bool ContainsAllWords(const QString& haystack, const QString& userinput)
|
||||||
// Syncs the expanded state of Game Directories with settings to persist across sessions
|
// Syncs the expanded state of Game Directories with settings to persist across sessions
|
||||||
void GameList::onItemExpanded(const QModelIndex& item) {
|
void GameList::onItemExpanded(const QModelIndex& item) {
|
||||||
const auto type = item.data(GameListItem::TypeRole).value<GameListItemType>();
|
const auto type = item.data(GameListItem::TypeRole).value<GameListItemType>();
|
||||||
if (type == GameListItemType::CustomDir || type == GameListItemType::InstalledDir ||
|
if (type == GameListItemType::CustomDir || type == GameListItemType::SdmcDir ||
|
||||||
type == GameListItemType::SystemDir)
|
type == GameListItemType::UserNandDir || type == GameListItemType::SysNandDir)
|
||||||
item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded =
|
item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded =
|
||||||
tree_view->isExpanded(item);
|
tree_view->isExpanded(item);
|
||||||
}
|
}
|
||||||
|
@ -232,14 +232,21 @@ void GameList::onUpdateThemedIcons() {
|
||||||
|
|
||||||
const int icon_size = UISettings::values.icon_size;
|
const int icon_size = UISettings::values.icon_size;
|
||||||
switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) {
|
switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) {
|
||||||
case GameListItemType::InstalledDir:
|
case GameListItemType::SdmcDir:
|
||||||
child->setData(
|
child->setData(
|
||||||
QIcon::fromTheme(QStringLiteral("sd_card"))
|
QIcon::fromTheme(QStringLiteral("sd_card"))
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
break;
|
break;
|
||||||
case GameListItemType::SystemDir:
|
case GameListItemType::UserNandDir:
|
||||||
|
child->setData(
|
||||||
|
QIcon::fromTheme(QStringLiteral("chip"))
|
||||||
|
.pixmap(icon_size)
|
||||||
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
|
Qt::DecorationRole);
|
||||||
|
break;
|
||||||
|
case GameListItemType::SysNandDir:
|
||||||
child->setData(
|
child->setData(
|
||||||
QIcon::fromTheme(QStringLiteral("chip"))
|
QIcon::fromTheme(QStringLiteral("chip"))
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
|
@ -394,7 +401,8 @@ bool GameList::isEmpty() const {
|
||||||
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
const QStandardItem* child = item_model->invisibleRootItem()->child(i);
|
||||||
const auto type = static_cast<GameListItemType>(child->type());
|
const auto type = static_cast<GameListItemType>(child->type());
|
||||||
if (!child->hasChildren() &&
|
if (!child->hasChildren() &&
|
||||||
(type == GameListItemType::InstalledDir || type == GameListItemType::SystemDir)) {
|
(type == GameListItemType::SdmcDir || type == GameListItemType::UserNandDir ||
|
||||||
|
type == GameListItemType::SysNandDir)) {
|
||||||
item_model->invisibleRootItem()->removeRow(child->row());
|
item_model->invisibleRootItem()->removeRow(child->row());
|
||||||
i--;
|
i--;
|
||||||
};
|
};
|
||||||
|
@ -450,8 +458,9 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
|
||||||
AddPermDirPopup(context_menu, selected);
|
AddPermDirPopup(context_menu, selected);
|
||||||
AddCustomDirPopup(context_menu, selected);
|
AddCustomDirPopup(context_menu, selected);
|
||||||
break;
|
break;
|
||||||
case GameListItemType::InstalledDir:
|
case GameListItemType::SdmcDir:
|
||||||
case GameListItemType::SystemDir:
|
case GameListItemType::UserNandDir:
|
||||||
|
case GameListItemType::SysNandDir:
|
||||||
AddPermDirPopup(context_menu, selected);
|
AddPermDirPopup(context_menu, selected);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,10 @@
|
||||||
enum class GameListItemType {
|
enum class GameListItemType {
|
||||||
Game = QStandardItem::UserType + 1,
|
Game = QStandardItem::UserType + 1,
|
||||||
CustomDir = QStandardItem::UserType + 2,
|
CustomDir = QStandardItem::UserType + 2,
|
||||||
InstalledDir = QStandardItem::UserType + 3,
|
SdmcDir = QStandardItem::UserType + 3,
|
||||||
SystemDir = QStandardItem::UserType + 4,
|
UserNandDir = QStandardItem::UserType + 4,
|
||||||
AddDir = QStandardItem::UserType + 5
|
SysNandDir = QStandardItem::UserType + 5,
|
||||||
|
AddDir = QStandardItem::UserType + 6
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(GameListItemType);
|
Q_DECLARE_METATYPE(GameListItemType);
|
||||||
|
@ -222,17 +223,27 @@ public:
|
||||||
|
|
||||||
const int icon_size = UISettings::values.icon_size;
|
const int icon_size = UISettings::values.icon_size;
|
||||||
switch (dir_type) {
|
switch (dir_type) {
|
||||||
case GameListItemType::InstalledDir:
|
case GameListItemType::SdmcDir:
|
||||||
setData(
|
setData(
|
||||||
QIcon::fromTheme(QStringLiteral("sd_card"))
|
QIcon::fromTheme(QStringLiteral("sd_card"))
|
||||||
.pixmap(icon_size)
|
.pixmap(icon_size)
|
||||||
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
setData(QObject::tr("Installed Titles"), Qt::DisplayRole);
|
setData(QObject::tr("Installed SD Titles"), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
case GameListItemType::SystemDir:
|
case GameListItemType::UserNandDir:
|
||||||
setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled(
|
setData(
|
||||||
icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
QIcon::fromTheme(QStringLiteral("chip"))
|
||||||
|
.pixmap(icon_size)
|
||||||
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
|
Qt::DecorationRole);
|
||||||
|
setData(QObject::tr("Installed NAND Titles"), Qt::DisplayRole);
|
||||||
|
break;
|
||||||
|
case GameListItemType::SysNandDir:
|
||||||
|
setData(
|
||||||
|
QIcon::fromTheme(QStringLiteral("chip"))
|
||||||
|
.pixmap(icon_size)
|
||||||
|
.scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
|
||||||
Qt::DecorationRole);
|
Qt::DecorationRole);
|
||||||
setData(QObject::tr("System Titles"), Qt::DisplayRole);
|
setData(QObject::tr("System Titles"), Qt::DisplayRole);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -240,15 +240,14 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
|
||||||
std::vector<std::pair<ContentProviderUnionSlot, ContentProviderEntry>> installed_games;
|
std::vector<std::pair<ContentProviderUnionSlot, ContentProviderEntry>> installed_games;
|
||||||
installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
|
installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
|
||||||
ContentRecordType::Program);
|
ContentRecordType::Program);
|
||||||
if (parent_dir->type() == static_cast<int>(GameListItemType::InstalledDir)) {
|
|
||||||
|
if (parent_dir->type() == static_cast<int>(GameListItemType::SdmcDir)) {
|
||||||
|
installed_games = cache.ListEntriesFilterOrigin(
|
||||||
|
ContentProviderUnionSlot::SDMC, TitleType::Application, ContentRecordType::Program);
|
||||||
|
} else if (parent_dir->type() == static_cast<int>(GameListItemType::UserNandDir)) {
|
||||||
installed_games = cache.ListEntriesFilterOrigin(
|
installed_games = cache.ListEntriesFilterOrigin(
|
||||||
ContentProviderUnionSlot::UserNAND, TitleType::Application, ContentRecordType::Program);
|
ContentProviderUnionSlot::UserNAND, TitleType::Application, ContentRecordType::Program);
|
||||||
auto installed_sdmc_games = cache.ListEntriesFilterOrigin(
|
} else if (parent_dir->type() == static_cast<int>(GameListItemType::SysNandDir)) {
|
||||||
ContentProviderUnionSlot::SDMC, TitleType::Application, ContentRecordType::Program);
|
|
||||||
|
|
||||||
installed_games.insert(installed_games.end(), installed_sdmc_games.begin(),
|
|
||||||
installed_sdmc_games.end());
|
|
||||||
} else if (parent_dir->type() == static_cast<int>(GameListItemType::SystemDir)) {
|
|
||||||
installed_games = cache.ListEntriesFilterOrigin(
|
installed_games = cache.ListEntriesFilterOrigin(
|
||||||
ContentProviderUnionSlot::SysNAND, TitleType::Application, ContentRecordType::Program);
|
ContentProviderUnionSlot::SysNAND, TitleType::Application, ContentRecordType::Program);
|
||||||
}
|
}
|
||||||
|
@ -353,12 +352,16 @@ void GameListWorker::run() {
|
||||||
stop_processing = false;
|
stop_processing = false;
|
||||||
|
|
||||||
for (UISettings::GameDir& game_dir : game_dirs) {
|
for (UISettings::GameDir& game_dir : game_dirs) {
|
||||||
if (game_dir.path == "INSTALLED") {
|
if (game_dir.path == QStringLiteral("SDMC")) {
|
||||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::InstalledDir);
|
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SdmcDir);
|
||||||
emit DirEntryReady({game_list_dir});
|
emit DirEntryReady({game_list_dir});
|
||||||
AddTitlesToGameList(game_list_dir);
|
AddTitlesToGameList(game_list_dir);
|
||||||
} else if (game_dir.path == "SYSTEM") {
|
} else if (game_dir.path == QStringLiteral("UserNAND")) {
|
||||||
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir);
|
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::UserNandDir);
|
||||||
|
emit DirEntryReady({game_list_dir});
|
||||||
|
AddTitlesToGameList(game_list_dir);
|
||||||
|
} else if (game_dir.path == QStringLiteral("SysNAND")) {
|
||||||
|
auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SysNandDir);
|
||||||
emit DirEntryReady({game_list_dir});
|
emit DirEntryReady({game_list_dir});
|
||||||
AddTitlesToGameList(game_list_dir);
|
AddTitlesToGameList(game_list_dir);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1311,11 +1311,13 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
|
||||||
|
|
||||||
void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
|
void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
|
||||||
QString path;
|
QString path;
|
||||||
if (directory == QStringLiteral("INSTALLED")) {
|
if (directory == QStringLiteral("SDMC")) {
|
||||||
// TODO: Find a better solution when installing files to the SD card gets implemented
|
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir) +
|
||||||
|
"Nintendo/Contents/registered");
|
||||||
|
} else if (directory == QStringLiteral("UserNAND")) {
|
||||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||||
"user/Contents/registered");
|
"user/Contents/registered");
|
||||||
} else if (directory == QStringLiteral("SYSTEM")) {
|
} else if (directory == QStringLiteral("SysNAND")) {
|
||||||
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
|
||||||
"system/Contents/registered");
|
"system/Contents/registered");
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue