Implement resource packs

This commit is contained in:
spycrab
2018-11-17 16:36:28 +01:00
parent e6b2758ab4
commit 71d53c922f
20 changed files with 1143 additions and 2 deletions

View File

@ -87,6 +87,7 @@
#include "DolphinQt/QtUtils/RunOnObject.h"
#include "DolphinQt/QtUtils/WindowActivationEventFilter.h"
#include "DolphinQt/RenderWidget.h"
#include "DolphinQt/ResourcePackManager.h"
#include "DolphinQt/Resources.h"
#include "DolphinQt/SearchBar.h"
#include "DolphinQt/Settings.h"
@ -99,6 +100,10 @@
#include "UICommon/DiscordPresence.h"
#include "UICommon/GameFile.h"
#include "UICommon/ResourcePack/Manager.h"
#include "UICommon/ResourcePack/Manifest.h"
#include "UICommon/ResourcePack/ResourcePack.h"
#include "UICommon/UICommon.h"
#include "VideoCommon/VideoConfig.h"
@ -208,6 +213,21 @@ MainWindow::MainWindow(std::unique_ptr<BootParameters> boot_parameters) : QMainW
// Restoring of window states can sometimes go wrong, resulting in widgets being visible when they
// shouldn't be so we have to reapply all our rules afterwards.
Settings::Instance().RefreshWidgetVisibility();
if (!ResourcePack::Init())
QMessageBox::critical(this, tr("Error"), tr("Error occured while loading some texture packs"));
for (auto& pack : ResourcePack::GetPacks())
{
if (!pack.IsValid())
{
QMessageBox::critical(this, tr("Error"),
tr("Invalid Pack %1 provided: %2")
.arg(QString::fromStdString(pack.GetPath()))
.arg(QString::fromStdString(pack.GetError())));
return;
}
}
}
MainWindow::~MainWindow()
@ -391,6 +411,8 @@ void MainWindow::ConnectMenuBar()
// Tools
connect(m_menu_bar, &MenuBar::ShowMemcardManager, this, &MainWindow::ShowMemcardManager);
connect(m_menu_bar, &MenuBar::ShowResourcePackManager, this,
&MainWindow::ShowResourcePackManager);
connect(m_menu_bar, &MenuBar::ShowCheatsManager, this, &MainWindow::ShowCheatsManager);
connect(m_menu_bar, &MenuBar::BootGameCubeIPL, this, &MainWindow::OnBootGameCubeIPL);
connect(m_menu_bar, &MenuBar::ImportNANDBackup, this, &MainWindow::OnImportNANDBackup);
@ -1553,6 +1575,13 @@ void MainWindow::ShowMemcardManager()
manager.exec();
}
void MainWindow::ShowResourcePackManager()
{
ResourcePackManager manager(this);
manager.exec();
}
void MainWindow::ShowCheatsManager()
{
m_cheats_manager->show();