[fs/core] Load external content without NAND install (#2862)

Adds the capability to add DLC and Updates without installing them to NAND. This was tested on Windows only and needs Android integration.

Co-authored-by: crueter <crueter@eden-emu.dev>
Co-authored-by: wildcard <wildcard@eden-emu.dev>
Co-authored-by: nekle <nekle@protonmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2862
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: crueter <crueter@eden-emu.dev>
Co-authored-by: Maufeat <sahyno1996@gmail.com>
Co-committed-by: Maufeat <sahyno1996@gmail.com>
This commit is contained in:
Maufeat 2026-02-06 14:05:44 +01:00 committed by crueter
parent e07e269bd7
commit 69aff83ef4
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
40 changed files with 1790 additions and 126 deletions

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
@ -99,6 +99,8 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
}
});
connect(ui_tab.get(), &ConfigureUi::LanguageChanged, this, &ConfigureDialog::OnLanguageChanged);
connect(general_tab.get(), &ConfigureGeneral::ExternalContentDirsChanged, this,
&ConfigureDialog::ExternalContentDirsChanged);
connect(ui->selectorList, &QListWidget::itemSelectionChanged, this,
&ConfigureDialog::UpdateVisibleTabs);

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
@ -62,6 +62,7 @@ private slots:
signals:
void LanguageChanged(const QString& locale);
void ExternalContentDirsChanged();
private:
void changeEvent(QEvent* event) override;

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
@ -38,9 +38,9 @@ ConfigureFilesystem::ConfigureFilesystem(QWidget* parent)
connect(ui->reset_game_list_cache, &QPushButton::pressed, this,
&ConfigureFilesystem::ResetMetadata);
connect(ui->gamecard_inserted, &QCheckBox::STATE_CHANGED, this,
connect(ui->gamecard_inserted, &QCheckBox::stateChanged, this,
&ConfigureFilesystem::UpdateEnabledControls);
connect(ui->gamecard_current_game, &QCheckBox::STATE_CHANGED, this,
connect(ui->gamecard_current_game, &QCheckBox::stateChanged, this,
&ConfigureFilesystem::UpdateEnabledControls);
}
@ -278,6 +278,7 @@ void ConfigureFilesystem::UpdateEnabledControls() {
!ui->gamecard_current_game->isChecked());
}
void ConfigureFilesystem::RetranslateUI() {
ui->retranslateUi(this);
}

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project

View file

@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
@ -7,6 +7,9 @@
#include <functional>
#include <utility>
#include <vector>
#include <QDir>
#include <QFileDialog>
#include <QListWidget>
#include <QMessageBox>
#include "common/settings.h"
#include "core/core.h"
@ -29,6 +32,15 @@ ConfigureGeneral::ConfigureGeneral(const Core::System& system_,
connect(ui->button_reset_defaults, &QPushButton::clicked, this,
&ConfigureGeneral::ResetDefaults);
connect(ui->add_external_dir_button, &QPushButton::pressed, this,
&ConfigureGeneral::AddExternalContentDirectory);
connect(ui->remove_external_dir_button, &QPushButton::pressed, this,
&ConfigureGeneral::RemoveSelectedExternalContentDirectory);
connect(ui->external_content_list, &QListWidget::itemSelectionChanged, this, [this] {
ui->remove_external_dir_button->setEnabled(
!ui->external_content_list->selectedItems().isEmpty());
});
if (!Settings::IsConfiguringGlobal()) {
ui->button_reset_defaults->setVisible(false);
}
@ -36,7 +48,9 @@ ConfigureGeneral::ConfigureGeneral(const Core::System& system_,
ConfigureGeneral::~ConfigureGeneral() = default;
void ConfigureGeneral::SetConfiguration() {}
void ConfigureGeneral::SetConfiguration() {
UpdateExternalContentList();
}
void ConfigureGeneral::Setup(const ConfigurationShared::Builder& builder) {
QLayout& general_layout = *ui->general_widget->layout();
@ -101,6 +115,55 @@ void ConfigureGeneral::ApplyConfiguration() {
for (const auto& func : apply_funcs) {
func(powered_on);
}
std::vector<std::string> new_dirs;
new_dirs.reserve(ui->external_content_list->count());
for (int i = 0; i < ui->external_content_list->count(); ++i) {
new_dirs.push_back(ui->external_content_list->item(i)->text().toStdString());
}
if (new_dirs != Settings::values.external_content_dirs) {
Settings::values.external_content_dirs = std::move(new_dirs);
emit ExternalContentDirsChanged();
}
}
void ConfigureGeneral::UpdateExternalContentList() {
ui->external_content_list->clear();
for (const auto& dir : Settings::values.external_content_dirs) {
ui->external_content_list->addItem(QString::fromStdString(dir));
}
}
void ConfigureGeneral::AddExternalContentDirectory() {
const QString dir_path = QFileDialog::getExistingDirectory(
this, tr("Select External Content Directory..."), QString());
if (dir_path.isEmpty()) {
return;
}
QString normalized_path = QDir::toNativeSeparators(dir_path);
if (normalized_path.back() != QDir::separator()) {
normalized_path.append(QDir::separator());
}
for (int i = 0; i < ui->external_content_list->count(); ++i) {
if (ui->external_content_list->item(i)->text() == normalized_path) {
QMessageBox::information(this, tr("Directory Already Added"),
tr("This directory is already in the list."));
return;
}
}
ui->external_content_list->addItem(normalized_path);
}
void ConfigureGeneral::RemoveSelectedExternalContentDirectory() {
auto selected = ui->external_content_list->selectedItems();
if (!selected.isEmpty()) {
qDeleteAll(ui->external_content_list->selectedItems());
}
}
void ConfigureGeneral::changeEvent(QEvent* event) {

View file

@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2016 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@ -39,12 +42,19 @@ public:
void ApplyConfiguration() override;
void SetConfiguration() override;
signals:
void ExternalContentDirsChanged();
private:
void Setup(const ConfigurationShared::Builder& builder);
void changeEvent(QEvent* event) override;
void RetranslateUI();
void UpdateExternalContentList();
void AddExternalContentDirectory();
void RemoveSelectedExternalContentDirectory();
std::function<void()> reset_callback;
std::unique_ptr<Ui::ConfigureGeneral> ui;

View file

@ -46,6 +46,66 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_external">
<property name="title">
<string>External Content</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_external">
<item>
<widget class="QLabel" name="label_external_desc">
<property name="text">
<string>Add directories to scan for DLCs and Updates without installing to NAND</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="external_content_list">
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_external_buttons">
<item>
<widget class="QPushButton" name="add_external_dir_button">
<property name="text">
<string>Add Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="remove_external_dir_button">
<property name="text">
<string>Remove Selected</string>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_external">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

View file

@ -8,6 +8,8 @@
#include <memory>
#include <utility>
#include <fmt/format.h>
#include <QHeaderView>
#include <QMenu>
#include <QStandardItemModel>
@ -16,6 +18,7 @@
#include <QTreeView>
#include <qstandardpaths.h>
#include "common/common_types.h"
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
#include "configuration/addon/mod_select_dialog.h"
@ -68,6 +71,8 @@ ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* p
ui->scrollArea->setEnabled(!system.IsPoweredOn());
connect(item_model, &QStandardItemModel::itemChanged, this,
&ConfigurePerGameAddons::OnItemChanged);
connect(item_model, &QStandardItemModel::itemChanged,
[] { UISettings::values.is_game_list_reload_pending.exchange(true); });
@ -77,13 +82,37 @@ ConfigurePerGameAddons::ConfigurePerGameAddons(Core::System& system_, QWidget* p
ConfigurePerGameAddons::~ConfigurePerGameAddons() = default;
void ConfigurePerGameAddons::OnItemChanged(QStandardItem* item) {
if (update_items.size() > 1 && item->checkState() == Qt::Checked) {
auto it = std::find(update_items.begin(), update_items.end(), item);
if (it != update_items.end()) {
for (auto* update_item : update_items) {
if (update_item != item && update_item->checkState() == Qt::Checked) {
disconnect(item_model, &QStandardItemModel::itemChanged, this,
&ConfigurePerGameAddons::OnItemChanged);
update_item->setCheckState(Qt::Unchecked);
connect(item_model, &QStandardItemModel::itemChanged, this,
&ConfigurePerGameAddons::OnItemChanged);
}
}
}
}
}
void ConfigurePerGameAddons::ApplyConfiguration() {
std::vector<std::string> disabled_addons;
for (const auto& item : list_items) {
const auto disabled = item.front()->checkState() == Qt::Unchecked;
if (disabled)
disabled_addons.push_back(item.front()->text().toStdString());
if (disabled) {
QVariant userData = item.front()->data(Qt::UserRole);
if (userData.isValid() && userData.canConvert<quint32>() && item.front()->text() == QStringLiteral("Update")) {
quint32 numeric_version = userData.toUInt();
disabled_addons.push_back(fmt::format("Update@{}", numeric_version));
} else {
disabled_addons.push_back(item.front()->text().toStdString());
}
}
}
auto current = Settings::values.disabled_addons[title_id];
@ -194,17 +223,51 @@ void ConfigurePerGameAddons::LoadConfiguration() {
const auto& disabled = Settings::values.disabled_addons[title_id];
for (const auto& patch : pm.GetPatches(update_raw)) {
update_items.clear();
list_items.clear();
item_model->removeRows(0, item_model->rowCount());
std::vector<FileSys::Patch> patches = pm.GetPatches(update_raw);
bool has_enabled_update = false;
for (const auto& patch : patches) {
const auto name = QString::fromStdString(patch.name);
auto* const first_item = new QStandardItem;
first_item->setText(name);
first_item->setCheckable(true);
const auto patch_disabled =
std::find(disabled.begin(), disabled.end(), name.toStdString()) != disabled.end();
const bool is_external_update = patch.type == FileSys::PatchType::Update &&
patch.source == FileSys::PatchSource::External &&
patch.numeric_version != 0;
first_item->setCheckState(patch_disabled ? Qt::Unchecked : Qt::Checked);
if (is_external_update) {
first_item->setData(static_cast<quint32>(patch.numeric_version), Qt::UserRole);
}
bool patch_disabled = false;
if (is_external_update) {
std::string disabled_key = fmt::format("Update@{}", patch.numeric_version);
patch_disabled = std::find(disabled.begin(), disabled.end(), disabled_key) != disabled.end();
} else {
patch_disabled = std::find(disabled.begin(), disabled.end(), name.toStdString()) != disabled.end();
}
bool should_enable = !patch_disabled;
if (patch.type == FileSys::PatchType::Update) {
if (should_enable) {
if (has_enabled_update) {
should_enable = false;
} else {
has_enabled_update = true;
}
}
update_items.push_back(first_item);
}
first_item->setCheckState(should_enable ? Qt::Checked : Qt::Unchecked);
list_items.push_back(QList<QStandardItem*>{
first_item, new QStandardItem{QString::fromStdString(patch.version)}});

View file

@ -54,6 +54,7 @@ private:
void RetranslateUI();
void LoadConfiguration();
void OnItemChanged(QStandardItem* item);
std::unique_ptr<Ui::ConfigurePerGameAddons> ui;
FileSys::VirtualFile file;
@ -64,6 +65,7 @@ private:
QStandardItemModel* item_model;
std::vector<QList<QStandardItem*>> list_items;
std::vector<QStandardItem*> update_items;
Core::System& system;
};

View file

@ -16,11 +16,13 @@
#include <QToolButton>
#include <QVariantAnimation>
#include <fmt/ranges.h>
#include <qfilesystemwatcher.h>
#include <qnamespace.h>
#include <qscroller.h>
#include <qscrollerproperties.h>
#include "common/common_types.h"
#include "common/logging/log.h"
#include "common/settings.h"
#include "core/core.h"
#include "core/file_sys/patch_manager.h"
#include "core/file_sys/registered_cache.h"
@ -32,6 +34,7 @@
#include "yuzu/game_list_worker.h"
#include "yuzu/main_window.h"
#include "yuzu/util/controller_navigation.h"
#include "qt_common/qt_common.h"
GameListSearchField::KeyReleaseEater::KeyReleaseEater(GameList* gamelist_, QObject* parent)
: QObject(parent), gamelist{gamelist_} {}
@ -325,6 +328,10 @@ GameList::GameList(FileSys::VirtualFilesystem vfs_, FileSys::ManualContentProvid
watcher = new QFileSystemWatcher(this);
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
external_watcher = new QFileSystemWatcher(this);
ResetExternalWatcher();
connect(external_watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshExternalContent);
this->main_window = parent;
layout = new QVBoxLayout;
tree_view = new QTreeView;
@ -919,12 +926,38 @@ const QStringList GameList::supported_file_extensions = {
void GameList::RefreshGameDirectory()
{
// Reset the externals watcher whenever the game list is reloaded,
// primarily ensures that new titles and external dirs are caught.
ResetExternalWatcher();
if (!UISettings::values.game_dirs.empty() && current_worker != nullptr) {
LOG_INFO(Frontend, "Change detected in the games directory. Reloading game list.");
QtCommon::system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
PopulateAsync(UISettings::values.game_dirs);
}
}
void GameList::RefreshExternalContent() {
// TODO: Explore the possibility of only resetting the metadata cache for that specific game.
if (!UISettings::values.game_dirs.empty() && current_worker != nullptr) {
LOG_INFO(Frontend, "External content directory changed. Clearing metadata cache.");
QtCommon::Game::ResetMetadata(false);
QtCommon::system->GetFileSystemController().CreateFactories(*QtCommon::vfs);
PopulateAsync(UISettings::values.game_dirs);
}
}
void GameList::ResetExternalWatcher() {
auto watch_dirs = external_watcher->directories();
if (!watch_dirs.isEmpty()) {
external_watcher->removePaths(watch_dirs);
}
for (const std::string &dir : Settings::values.external_content_dirs) {
external_watcher->addPath(QString::fromStdString(dir));
}
}
void GameList::ToggleFavorite(u64 program_id) {
if (!UISettings::values.favorited_ids.contains(program_id)) {
tree_view->setRowHidden(0, item_model->invisibleRootItem()->index(),

View file

@ -94,6 +94,8 @@ public:
public slots:
void RefreshGameDirectory();
void RefreshExternalContent();
void ResetExternalWatcher();
signals:
void BootGame(const QString& game_path, StartGameType type);
@ -160,6 +162,7 @@ private:
QStandardItemModel* item_model = nullptr;
std::unique_ptr<GameListWorker> current_worker;
QFileSystemWatcher* watcher = nullptr;
QFileSystemWatcher* external_watcher = nullptr;
ControllerNavigation* controller_navigation = nullptr;
CompatibilityList compatibility_list;

View file

@ -3388,6 +3388,8 @@ void MainWindow::OnConfigure() {
!multiplayer_state->IsHostingPublicRoom());
connect(&configure_dialog, &ConfigureDialog::LanguageChanged, this,
&MainWindow::OnLanguageChanged);
connect(&configure_dialog, &ConfigureDialog::ExternalContentDirsChanged, this,
&MainWindow::OnGameListRefresh);
const auto result = configure_dialog.exec();
if (result != QDialog::Accepted && !UISettings::values.configuration_applied &&
@ -3907,8 +3909,7 @@ void MainWindow::OnToggleStatusBar() {
statusBar()->setVisible(ui->action_Show_Status_Bar->isChecked());
}
void MainWindow::OnGameListRefresh()
{
void MainWindow::OnGameListRefresh() {
// Resets metadata cache and reloads
QtCommon::Game::ResetMetadata(false);
game_list->RefreshGameDirectory();