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