mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Bug fixes, testing, and review changes
This commit is contained in:
parent
f969ddb54e
commit
acc8fe5a2a
2 changed files with 20 additions and 7 deletions
|
@ -265,8 +265,17 @@ void GameList::ValidateEntry(const QModelIndex& item) {
|
||||||
if (file_path.isEmpty())
|
if (file_path.isEmpty())
|
||||||
return;
|
return;
|
||||||
std::string std_file_path(file_path.toStdString());
|
std::string std_file_path(file_path.toStdString());
|
||||||
if (!FileUtil::Exists(std_file_path) || FileUtil::IsDirectory(std_file_path))
|
if (!FileUtil::Exists(std_file_path))
|
||||||
return;
|
return;
|
||||||
|
if (FileUtil::IsDirectory(std_file_path)) {
|
||||||
|
QDir dir(std_file_path.c_str());
|
||||||
|
QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
|
||||||
|
if (matching_main.size() == 1) {
|
||||||
|
emit GameChosen(dir.path() + DIR_SEP + matching_main[0]);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Users usually want to run a diffrent game after closing one
|
// Users usually want to run a diffrent game after closing one
|
||||||
search_field->clear();
|
search_field->clear();
|
||||||
emit GameChosen(file_path);
|
emit GameChosen(file_path);
|
||||||
|
@ -368,10 +377,10 @@ static bool IsExtractedNCAMain(const std::string& file_name) {
|
||||||
return QFileInfo(file_name.c_str()).fileName() == "main";
|
return QFileInfo(file_name.c_str()).fileName() == "main";
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString FormatGameName(std::string physical_name) {
|
static QString FormatGameName(const std::string& physical_name) {
|
||||||
QFileInfo fileInfo(physical_name.c_str());
|
QFileInfo file_info(physical_name.c_str());
|
||||||
if (IsExtractedNCAMain(physical_name)) {
|
if (IsExtractedNCAMain(physical_name)) {
|
||||||
return fileInfo.dir().dirName();
|
return file_info.dir().path();
|
||||||
} else {
|
} else {
|
||||||
return QString::fromStdString(physical_name);
|
return QString::fromStdString(physical_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
#include "common/common_paths.h"
|
||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/logging/filter.h"
|
#include "common/logging/filter.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
|
@ -568,9 +569,12 @@ void GMainWindow::OnMenuLoadFile() {
|
||||||
void GMainWindow::OnMenuLoadFolder() {
|
void GMainWindow::OnMenuLoadFolder() {
|
||||||
QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory"));
|
QDir dir = QFileDialog::getExistingDirectory(this, tr("Open Extracted ROM Directory"));
|
||||||
|
|
||||||
QStringList matchingMain = dir.entryList(QStringList() << "main", QDir::Files);
|
QStringList matching_main = dir.entryList(QStringList("main"), QDir::Files);
|
||||||
if (matchingMain.size() == 1) {
|
if (matching_main.size() == 1) {
|
||||||
BootGame(matchingMain[0]);
|
BootGame(dir.path() + DIR_SEP + matching_main[0]);
|
||||||
|
} else {
|
||||||
|
QMessageBox::warning(this, tr("Invalid Directory Selected"),
|
||||||
|
tr("The directory you have selected does not contain a 'main' file."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue