Merge pull request #1282 from lioncash/compat
yuzu: Move compatibility list specifics to their own source files
This commit is contained in:
commit
7ddd5b765d
|
@ -9,6 +9,8 @@ add_executable(yuzu
|
||||||
about_dialog.h
|
about_dialog.h
|
||||||
bootmanager.cpp
|
bootmanager.cpp
|
||||||
bootmanager.h
|
bootmanager.h
|
||||||
|
compatibility_list.cpp
|
||||||
|
compatibility_list.h
|
||||||
configuration/config.cpp
|
configuration/config.cpp
|
||||||
configuration/config.h
|
configuration/config.h
|
||||||
configuration/configure_audio.cpp
|
configuration/configure_audio.cpp
|
||||||
|
|
18
src/yuzu/compatibility_list.cpp
Normal file
18
src/yuzu/compatibility_list.cpp
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
// Copyright 2018 yuzu Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <fmt/format.h>
|
||||||
|
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
|
|
||||||
|
CompatibilityList::const_iterator FindMatchingCompatibilityEntry(
|
||||||
|
const CompatibilityList& compatibility_list, u64 program_id) {
|
||||||
|
return std::find_if(compatibility_list.begin(), compatibility_list.end(),
|
||||||
|
[program_id](const auto& element) {
|
||||||
|
std::string pid = fmt::format("{:016X}", program_id);
|
||||||
|
return element.first == pid;
|
||||||
|
});
|
||||||
|
}
|
17
src/yuzu/compatibility_list.h
Normal file
17
src/yuzu/compatibility_list.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
// Copyright 2018 yuzu Emulator Project
|
||||||
|
// Licensed under GPLv2 or any later version
|
||||||
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include "common/common_types.h"
|
||||||
|
|
||||||
|
using CompatibilityList = std::unordered_map<std::string, std::pair<QString, QString>>;
|
||||||
|
|
||||||
|
CompatibilityList::const_iterator FindMatchingCompatibilityEntry(
|
||||||
|
const CompatibilityList& compatibility_list, u64 program_id);
|
|
@ -19,6 +19,7 @@
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/file_sys/patch_manager.h"
|
#include "core/file_sys/patch_manager.h"
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
#include "yuzu/game_list.h"
|
#include "yuzu/game_list.h"
|
||||||
#include "yuzu/game_list_p.h"
|
#include "yuzu/game_list_p.h"
|
||||||
#include "yuzu/game_list_worker.h"
|
#include "yuzu/game_list_worker.h"
|
||||||
|
|
|
@ -4,8 +4,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <unordered_map>
|
|
||||||
|
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
@ -21,6 +19,7 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
|
|
||||||
class GameListWorker;
|
class GameListWorker;
|
||||||
class GMainWindow;
|
class GMainWindow;
|
||||||
|
@ -90,9 +89,8 @@ signals:
|
||||||
void GameChosen(QString game_path);
|
void GameChosen(QString game_path);
|
||||||
void ShouldCancelWorker();
|
void ShouldCancelWorker();
|
||||||
void OpenFolderRequested(u64 program_id, GameListOpenTarget target);
|
void OpenFolderRequested(u64 program_id, GameListOpenTarget target);
|
||||||
void NavigateToGamedbEntryRequested(
|
void NavigateToGamedbEntryRequested(u64 program_id,
|
||||||
u64 program_id,
|
const CompatibilityList& compatibility_list);
|
||||||
std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onTextChanged(const QString& newText);
|
void onTextChanged(const QString& newText);
|
||||||
|
@ -114,7 +112,7 @@ private:
|
||||||
QStandardItemModel* item_model = nullptr;
|
QStandardItemModel* item_model = nullptr;
|
||||||
GameListWorker* current_worker = nullptr;
|
GameListWorker* current_worker = nullptr;
|
||||||
QFileSystemWatcher* watcher = nullptr;
|
QFileSystemWatcher* watcher = nullptr;
|
||||||
std::unordered_map<std::string, std::pair<QString, QString>> compatibility_list;
|
CompatibilityList compatibility_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(GameListOpenTarget);
|
Q_DECLARE_METATYPE(GameListOpenTarget);
|
||||||
|
|
|
@ -176,14 +176,3 @@ public:
|
||||||
return data(SizeRole).toULongLong() < other.data(SizeRole).toULongLong();
|
return data(SizeRole).toULongLong() < other.data(SizeRole).toULongLong();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline auto FindMatchingCompatibilityEntry(
|
|
||||||
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list,
|
|
||||||
u64 program_id) {
|
|
||||||
return std::find_if(
|
|
||||||
compatibility_list.begin(), compatibility_list.end(),
|
|
||||||
[program_id](const std::pair<std::string, std::pair<QString, QString>>& element) {
|
|
||||||
std::string pid = fmt::format("{:016X}", program_id);
|
|
||||||
return element.first == pid;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "core/file_sys/registered_cache.h"
|
#include "core/file_sys/registered_cache.h"
|
||||||
#include "core/hle/service/filesystem/filesystem.h"
|
#include "core/hle/service/filesystem/filesystem.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
#include "yuzu/game_list.h"
|
#include "yuzu/game_list.h"
|
||||||
#include "yuzu/game_list_p.h"
|
#include "yuzu/game_list_p.h"
|
||||||
#include "yuzu/game_list_worker.h"
|
#include "yuzu/game_list_worker.h"
|
||||||
|
@ -75,9 +76,8 @@ QString FormatPatchNameVersions(const FileSys::PatchManager& patch_manager, bool
|
||||||
}
|
}
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
GameListWorker::GameListWorker(
|
GameListWorker::GameListWorker(FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan,
|
||||||
FileSys::VirtualFilesystem vfs, QString dir_path, bool deep_scan,
|
const CompatibilityList& compatibility_list)
|
||||||
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list)
|
|
||||||
: vfs(std::move(vfs)), dir_path(std::move(dir_path)), deep_scan(deep_scan),
|
: vfs(std::move(vfs)), dir_path(std::move(dir_path)), deep_scan(deep_scan),
|
||||||
compatibility_list(compatibility_list) {}
|
compatibility_list(compatibility_list) {}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
|
|
||||||
class QStandardItem;
|
class QStandardItem;
|
||||||
|
|
||||||
|
@ -32,9 +33,8 @@ class GameListWorker : public QObject, public QRunnable {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GameListWorker(
|
GameListWorker(std::shared_ptr<FileSys::VfsFilesystem> vfs, QString dir_path, bool deep_scan,
|
||||||
std::shared_ptr<FileSys::VfsFilesystem> vfs, QString dir_path, bool deep_scan,
|
const CompatibilityList& compatibility_list);
|
||||||
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list);
|
|
||||||
~GameListWorker() override;
|
~GameListWorker() override;
|
||||||
|
|
||||||
/// Starts the processing of directory tree information.
|
/// Starts the processing of directory tree information.
|
||||||
|
@ -67,6 +67,6 @@ private:
|
||||||
QStringList watch_list;
|
QStringList watch_list;
|
||||||
QString dir_path;
|
QString dir_path;
|
||||||
bool deep_scan;
|
bool deep_scan;
|
||||||
const std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list;
|
const CompatibilityList& compatibility_list;
|
||||||
std::atomic_bool stop_processing;
|
std::atomic_bool stop_processing;
|
||||||
};
|
};
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "yuzu/about_dialog.h"
|
#include "yuzu/about_dialog.h"
|
||||||
#include "yuzu/bootmanager.h"
|
#include "yuzu/bootmanager.h"
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
#include "yuzu/configuration/config.h"
|
#include "yuzu/configuration/config.h"
|
||||||
#include "yuzu/configuration/configure_dialog.h"
|
#include "yuzu/configuration/configure_dialog.h"
|
||||||
#include "yuzu/debugger/console.h"
|
#include "yuzu/debugger/console.h"
|
||||||
|
@ -725,14 +726,11 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
|
||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(qpath));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(qpath));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GMainWindow::OnGameListNavigateToGamedbEntry(
|
void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
|
||||||
u64 program_id,
|
const CompatibilityList& compatibility_list) {
|
||||||
std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list) {
|
const auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
|
||||||
|
|
||||||
auto it = FindMatchingCompatibilityEntry(compatibility_list, program_id);
|
|
||||||
|
|
||||||
QString directory;
|
QString directory;
|
||||||
|
|
||||||
if (it != compatibility_list.end())
|
if (it != compatibility_list.end())
|
||||||
directory = it->second.second;
|
directory = it->second.second;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "ui_main.h"
|
#include "ui_main.h"
|
||||||
|
#include "yuzu/compatibility_list.h"
|
||||||
#include "yuzu/hotkeys.h"
|
#include "yuzu/hotkeys.h"
|
||||||
|
|
||||||
class Config;
|
class Config;
|
||||||
|
@ -137,9 +138,8 @@ private slots:
|
||||||
/// Called whenever a user selects a game in the game list widget.
|
/// Called whenever a user selects a game in the game list widget.
|
||||||
void OnGameListLoadFile(QString game_path);
|
void OnGameListLoadFile(QString game_path);
|
||||||
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
|
void OnGameListOpenFolder(u64 program_id, GameListOpenTarget target);
|
||||||
void OnGameListNavigateToGamedbEntry(
|
void OnGameListNavigateToGamedbEntry(u64 program_id,
|
||||||
u64 program_id,
|
const CompatibilityList& compatibility_list);
|
||||||
std::unordered_map<std::string, std::pair<QString, QString>>& compatibility_list);
|
|
||||||
void OnMenuLoadFile();
|
void OnMenuLoadFile();
|
||||||
void OnMenuLoadFolder();
|
void OnMenuLoadFolder();
|
||||||
void OnMenuInstallToNAND();
|
void OnMenuInstallToNAND();
|
||||||
|
|
Loading…
Reference in a new issue