mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-22 17:07:50 -05:00
core: Port core to VfsFilesystem for file access
This commit is contained in:
@ -197,7 +197,8 @@ void GameList::onFilterCloseClicked() {
|
||||
main_window->filterBarSetChecked(false);
|
||||
}
|
||||
|
||||
GameList::GameList(GMainWindow* parent) : QWidget{parent} {
|
||||
GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent)
|
||||
: QWidget{parent}, vfs(std::move(vfs)) {
|
||||
watcher = new QFileSystemWatcher(this);
|
||||
connect(watcher, &QFileSystemWatcher::directoryChanged, this, &GameList::RefreshGameDirectory);
|
||||
|
||||
@ -341,7 +342,7 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
|
||||
|
||||
emit ShouldCancelWorker();
|
||||
|
||||
GameListWorker* worker = new GameListWorker(dir_path, deep_scan);
|
||||
GameListWorker* worker = new GameListWorker(vfs, dir_path, deep_scan);
|
||||
|
||||
connect(worker, &GameListWorker::EntryReady, this, &GameList::AddEntry, Qt::QueuedConnection);
|
||||
connect(worker, &GameListWorker::Finished, this, &GameList::DonePopulating,
|
||||
@ -436,7 +437,7 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
|
||||
if (!is_dir &&
|
||||
(HasSupportedFileExtension(physical_name) || IsExtractedNCAMain(physical_name))) {
|
||||
std::unique_ptr<Loader::AppLoader> loader =
|
||||
Loader::GetLoader(std::make_shared<FileSys::RealVfsFile>(physical_name));
|
||||
Loader::GetLoader(vfs->OpenFile(physical_name, FileSys::Mode::Read));
|
||||
if (!loader || ((loader->GetFileType() == Loader::FileType::Unknown ||
|
||||
loader->GetFileType() == Loader::FileType::Error) &&
|
||||
!UISettings::values.show_unknown))
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
QToolButton* button_filter_close = nullptr;
|
||||
};
|
||||
|
||||
explicit GameList(GMainWindow* parent = nullptr);
|
||||
explicit GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent = nullptr);
|
||||
~GameList() override;
|
||||
|
||||
void clearFilter();
|
||||
@ -90,6 +90,7 @@ private:
|
||||
void PopupContextMenu(const QPoint& menu_location);
|
||||
void RefreshGameDirectory();
|
||||
|
||||
FileSys::VirtualFilesystem vfs;
|
||||
SearchField* search_field;
|
||||
GMainWindow* main_window = nullptr;
|
||||
QVBoxLayout* layout = nullptr;
|
||||
|
@ -139,7 +139,7 @@ class GameListWorker : public QObject, public QRunnable {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GameListWorker(QString dir_path, bool deep_scan)
|
||||
GameListWorker(FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan)
|
||||
: dir_path(std::move(dir_path)), deep_scan(deep_scan) {}
|
||||
|
||||
public slots:
|
||||
@ -163,6 +163,7 @@ signals:
|
||||
void Finished(QStringList watch_list);
|
||||
|
||||
private:
|
||||
FileSys::VirtualFilesystem vfs;
|
||||
QStringList watch_list;
|
||||
QString dir_path;
|
||||
bool deep_scan;
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "common/string_util.h"
|
||||
#include "core/core.h"
|
||||
#include "core/crypto/key_manager.h"
|
||||
#include "core/file_sys/vfs_real.h"
|
||||
#include "core/gdbstub/gdbstub.h"
|
||||
#include "core/loader/loader.h"
|
||||
#include "core/settings.h"
|
||||
@ -81,9 +82,9 @@ static void ShowCalloutMessage(const QString& message, CalloutFlag flag) {
|
||||
|
||||
void GMainWindow::ShowCallouts() {}
|
||||
|
||||
const int GMainWindow::max_recent_files_item;
|
||||
|
||||
GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||
GMainWindow::GMainWindow()
|
||||
: config(new Config()), emu_thread(nullptr),
|
||||
vfs(std::make_shared<FileSys::RealVfsFilesystem>()) {
|
||||
|
||||
debug_context = Tegra::DebugContext::Construct();
|
||||
|
||||
@ -132,7 +133,7 @@ void GMainWindow::InitializeWidgets() {
|
||||
render_window = new GRenderWindow(this, emu_thread.get());
|
||||
render_window->hide();
|
||||
|
||||
game_list = new GameList(this);
|
||||
game_list = new GameList(vfs, this);
|
||||
ui.horizontalLayout->addWidget(game_list);
|
||||
|
||||
// Create status bar
|
||||
@ -406,6 +407,7 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
||||
}
|
||||
|
||||
Core::System& system{Core::System::GetInstance()};
|
||||
system.SetFilesystem(vfs);
|
||||
|
||||
system.SetGPUDebugContext(debug_context);
|
||||
|
||||
|
@ -161,6 +161,9 @@ private:
|
||||
bool emulation_running = false;
|
||||
std::unique_ptr<EmuThread> emu_thread;
|
||||
|
||||
// FS
|
||||
FileSys::VirtualFilesystem vfs;
|
||||
|
||||
// Debugger panes
|
||||
ProfilerWidget* profilerWidget;
|
||||
MicroProfileDialog* microProfileDialog;
|
||||
|
Reference in New Issue
Block a user