Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #10280 from iwubcode/wfs_root_configurable
Core / DolphinQt: make WFS directory configurable
  • Loading branch information
JMC47 committed Dec 19, 2021
2 parents d8e347c + 5ecd5f0 commit 2d1c735
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions Source/Core/Core/Config/MainSettings.cpp
Expand Up @@ -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_FS_PATH{{System::Main, "General", "NANDRootPath"}, ""};
const Info<std::string> MAIN_SD_PATH{{System::Main, "General", "WiiSDCardPath"}, ""};
const Info<std::string> MAIN_WFS_PATH{{System::Main, "General", "WFSPath"}, ""};

// Main.GBA

Expand Down
1 change: 1 addition & 0 deletions Source/Core/Core/Config/MainSettings.h
Expand Up @@ -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_FS_PATH;
extern const Info<std::string> MAIN_SD_PATH;
extern const Info<std::string> MAIN_WFS_PATH;

// Main.GBA

Expand Down
20 changes: 20 additions & 0 deletions Source/Core/DolphinQt/Settings/PathPane.cpp
Expand Up @@ -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()
{
Config::SetBase(Config::MAIN_SD_PATH, m_sdcard_edit->text().toStdString());
Expand Down Expand Up @@ -237,6 +248,15 @@ QGridLayout* PathPane::MakePathsLayout()
layout->addWidget(m_sdcard_edit, 5, 1);
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;
}

Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinQt/Settings/PathPane.h
Expand Up @@ -25,6 +25,7 @@ class PathPane final : public QWidget
void BrowseLoad();
void BrowseResourcePack();
void BrowseSDCard();
void BrowseWFS();
QGroupBox* MakeGameFolderBox();
QGridLayout* MakePathsLayout();
void RemovePath();
Expand All @@ -39,6 +40,7 @@ class PathPane final : public QWidget
QLineEdit* m_load_edit;
QLineEdit* m_resource_pack_edit;
QLineEdit* m_sdcard_edit;
QLineEdit* m_wfs_edit;

QPushButton* m_remove_path;
};
7 changes: 7 additions & 0 deletions Source/Core/UICommon/UICommon.cpp
Expand Up @@ -77,12 +77,19 @@ static void CreateResourcePackPath(const std::string& 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()
{
File::SetUserPath(D_WIIROOT_IDX, Config::Get(Config::MAIN_FS_PATH));
CreateLoadPath(Config::Get(Config::MAIN_LOAD_PATH));
CreateDumpPath(Config::Get(Config::MAIN_DUMP_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_GBABIOS_IDX, Config::Get(Config::MAIN_GBA_BIOS_PATH));
File::SetUserPath(D_GBASAVES_IDX, Config::Get(Config::MAIN_GBA_SAVES_PATH));
Expand Down

0 comments on commit 2d1c735

Please sign in to comment.