Core / DolphinQt: make WFS directory configurable

This commit is contained in:
iwubcode 2021-12-16 18:29:57 -06:00
parent bf37679e4e
commit 5ecd5f010f
5 changed files with 31 additions and 0 deletions

View File

@ -157,6 +157,7 @@ const Info<std::string> MAIN_LOAD_PATH{{System::Main, "General", "LoadPath"}, ""
const Info<std::string> MAIN_RESOURCEPACK_PATH{{System::Main, "General", "ResourcePackPath"}, ""}; const Info<std::string> MAIN_RESOURCEPACK_PATH{{System::Main, "General", "ResourcePackPath"}, ""};
const Info<std::string> MAIN_FS_PATH{{System::Main, "General", "NANDRootPath"}, ""}; const Info<std::string> MAIN_FS_PATH{{System::Main, "General", "NANDRootPath"}, ""};
const Info<std::string> MAIN_SD_PATH{{System::Main, "General", "WiiSDCardPath"}, ""}; const Info<std::string> MAIN_SD_PATH{{System::Main, "General", "WiiSDCardPath"}, ""};
const Info<std::string> MAIN_WFS_PATH{{System::Main, "General", "WFSPath"}, ""};
// Main.GBA // Main.GBA

View File

@ -138,6 +138,7 @@ extern const Info<std::string> MAIN_LOAD_PATH;
extern const Info<std::string> MAIN_RESOURCEPACK_PATH; extern const Info<std::string> MAIN_RESOURCEPACK_PATH;
extern const Info<std::string> MAIN_FS_PATH; extern const Info<std::string> MAIN_FS_PATH;
extern const Info<std::string> MAIN_SD_PATH; extern const Info<std::string> MAIN_SD_PATH;
extern const Info<std::string> MAIN_WFS_PATH;
// Main.GBA // Main.GBA

View File

@ -111,6 +111,17 @@ void PathPane::BrowseSDCard()
} }
} }
void PathPane::BrowseWFS()
{
const QString dir = QDir::toNativeSeparators(DolphinFileDialog::getExistingDirectory(
this, tr("Select WFS Path"), QString::fromStdString(Config::Get(Config::MAIN_WFS_PATH))));
if (!dir.isEmpty())
{
m_wfs_edit->setText(dir);
Config::SetBase(Config::MAIN_WFS_PATH, dir.toStdString());
}
}
void PathPane::OnSDCardPathChanged() void PathPane::OnSDCardPathChanged()
{ {
Config::SetBase(Config::MAIN_SD_PATH, m_sdcard_edit->text().toStdString()); Config::SetBase(Config::MAIN_SD_PATH, m_sdcard_edit->text().toStdString());
@ -237,6 +248,15 @@ QGridLayout* PathPane::MakePathsLayout()
layout->addWidget(m_sdcard_edit, 5, 1); layout->addWidget(m_sdcard_edit, 5, 1);
layout->addWidget(sdcard_open, 5, 2); layout->addWidget(sdcard_open, 5, 2);
m_wfs_edit = new QLineEdit(QString::fromStdString(File::GetUserPath(D_WFSROOT_IDX)));
connect(m_load_edit, &QLineEdit::editingFinished,
[=] { Config::SetBase(Config::MAIN_WFS_PATH, m_wfs_edit->text().toStdString()); });
QPushButton* wfs_open = new QPushButton(QStringLiteral("..."));
connect(wfs_open, &QPushButton::clicked, this, &PathPane::BrowseWFS);
layout->addWidget(new QLabel(tr("WFS Path:")), 6, 0);
layout->addWidget(m_wfs_edit, 6, 1);
layout->addWidget(wfs_open, 6, 2);
return layout; return layout;
} }

View File

@ -25,6 +25,7 @@ private:
void BrowseLoad(); void BrowseLoad();
void BrowseResourcePack(); void BrowseResourcePack();
void BrowseSDCard(); void BrowseSDCard();
void BrowseWFS();
QGroupBox* MakeGameFolderBox(); QGroupBox* MakeGameFolderBox();
QGridLayout* MakePathsLayout(); QGridLayout* MakePathsLayout();
void RemovePath(); void RemovePath();
@ -39,6 +40,7 @@ private:
QLineEdit* m_load_edit; QLineEdit* m_load_edit;
QLineEdit* m_resource_pack_edit; QLineEdit* m_resource_pack_edit;
QLineEdit* m_sdcard_edit; QLineEdit* m_sdcard_edit;
QLineEdit* m_wfs_edit;
QPushButton* m_remove_path; QPushButton* m_remove_path;
}; };

View File

@ -77,12 +77,19 @@ static void CreateResourcePackPath(const std::string& path)
File::SetUserPath(D_RESOURCEPACK_IDX, path + '/'); File::SetUserPath(D_RESOURCEPACK_IDX, path + '/');
} }
static void CreateWFSPath(const std::string& path)
{
if (!path.empty())
File::SetUserPath(D_WFSROOT_IDX, path + '/');
}
static void InitCustomPaths() static void InitCustomPaths()
{ {
File::SetUserPath(D_WIIROOT_IDX, Config::Get(Config::MAIN_FS_PATH)); File::SetUserPath(D_WIIROOT_IDX, Config::Get(Config::MAIN_FS_PATH));
CreateLoadPath(Config::Get(Config::MAIN_LOAD_PATH)); CreateLoadPath(Config::Get(Config::MAIN_LOAD_PATH));
CreateDumpPath(Config::Get(Config::MAIN_DUMP_PATH)); CreateDumpPath(Config::Get(Config::MAIN_DUMP_PATH));
CreateResourcePackPath(Config::Get(Config::MAIN_RESOURCEPACK_PATH)); CreateResourcePackPath(Config::Get(Config::MAIN_RESOURCEPACK_PATH));
CreateWFSPath(Config::Get(Config::MAIN_WFS_PATH));
File::SetUserPath(F_WIISDCARD_IDX, Config::Get(Config::MAIN_SD_PATH)); File::SetUserPath(F_WIISDCARD_IDX, Config::Get(Config::MAIN_SD_PATH));
File::SetUserPath(F_GBABIOS_IDX, Config::Get(Config::MAIN_GBA_BIOS_PATH)); File::SetUserPath(F_GBABIOS_IDX, Config::Get(Config::MAIN_GBA_BIOS_PATH));
File::SetUserPath(D_GBASAVES_IDX, Config::Get(Config::MAIN_GBA_SAVES_PATH)); File::SetUserPath(D_GBASAVES_IDX, Config::Get(Config::MAIN_GBA_SAVES_PATH));