Skip to content
Permalink
Browse files
Merge pull request #7600 from spycrab/resource_pack
Implement resource packs
  • Loading branch information
spycrab committed Dec 23, 2018
2 parents 2d00315 + 71d53c9 commit fc99809
Show file tree
Hide file tree
Showing 20 changed files with 1,143 additions and 2 deletions.
@@ -66,6 +66,7 @@
#define MEMORYWATCHER_DIR "MemoryWatcher"
#define WFSROOT_DIR "WFS"
#define BACKUP_DIR "Backup"
#define RESOURCEPACK_DIR "ResourcePacks"

// This one is only used to remove it if it was present
#define SHADERCACHE_LEGACY_DIR "ShaderCache"
@@ -780,6 +780,7 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[D_PIPES_IDX] = s_user_paths[D_USER_IDX] + PIPES_DIR DIR_SEP;
s_user_paths[D_WFSROOT_IDX] = s_user_paths[D_USER_IDX] + WFSROOT_DIR DIR_SEP;
s_user_paths[D_BACKUP_IDX] = s_user_paths[D_USER_IDX] + BACKUP_DIR DIR_SEP;
s_user_paths[D_RESOURCEPACK_IDX] = s_user_paths[D_USER_IDX] + RESOURCEPACK_DIR DIR_SEP;
s_user_paths[F_DOLPHINCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + DOLPHIN_CONFIG;
s_user_paths[F_GCPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + GCPAD_CONFIG;
s_user_paths[F_WIIPADCONFIG_IDX] = s_user_paths[D_CONFIG_IDX] + WIIPAD_CONFIG;
@@ -51,6 +51,7 @@ enum
D_MEMORYWATCHER_IDX,
D_WFSROOT_IDX,
D_BACKUP_IDX,
D_RESOURCEPACK_IDX,
F_DOLPHINCONFIG_IDX,
F_GCPADCONFIG_IDX,
F_WIIPADCONFIG_IDX,
@@ -210,4 +211,4 @@ void OpenFStream(T& fstream, const std::string& filename, std::ios_base::openmod
#endif
}

} // namespace
} // namespace File
@@ -108,6 +108,7 @@ add_executable(dolphin-emu
QtUtils/WinIconHelper.cpp
QtUtils/WrapInScrollArea.cpp
QtUtils/AspectRatioWidget.cpp
ResourcePackManager.cpp
Settings/AdvancedPane.cpp
Settings/AudioPane.cpp
Settings/GameCubePane.cpp
@@ -331,6 +331,7 @@
<ClCompile Include="FIFO\FIFOAnalyzer.cpp" />
<ClCompile Include="FIFO\FIFOPlayerWindow.cpp" />
<ClCompile Include="QtUtils\WinIconHelper.cpp" />
<ClCompile Include="ResourcePackManager.cpp" />
<ClCompile Include="TAS\GCTASInputWindow.cpp" />
<ClCompile Include="TAS\WiiTASInputWindow.cpp" />
<ClCompile Include="TAS\TASInputWindow.cpp" />
@@ -393,6 +394,7 @@
<ClInclude Include="QtUtils\QueueOnObject.h" />
<ClInclude Include="QtUtils\RunOnObject.h" />
<ClInclude Include="QtUtils\WinIconHelper.h" />
<ClInclude Include="ResourcePackManager.h" />
<ClInclude Include="Resources.h" />
<ClInclude Include="Translation.h" />
<ClInclude Include="WiiUpdate.h" />
@@ -480,4 +482,4 @@
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
</Project>
</Project>
@@ -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()
@@ -393,6 +413,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);
@@ -1556,6 +1578,13 @@ void MainWindow::ShowMemcardManager()
manager.exec();
}

void MainWindow::ShowResourcePackManager()
{
ResourcePackManager manager(this);

manager.exec();
}

void MainWindow::ShowCheatsManager()
{
m_cheats_manager->show();
@@ -131,6 +131,7 @@ class MainWindow final : public QMainWindow
void ShowNetPlaySetupDialog();
void ShowFIFOPlayer();
void ShowMemcardManager();
void ShowResourcePackManager();
void ShowCheatsManager();

void NetPlayInit();
@@ -208,6 +208,9 @@ void MenuBar::AddToolsMenu()
m_show_cheat_manager =
tools_menu->addAction(tr("&Cheats Manager"), this, [this] { emit ShowCheatsManager(); });

tools_menu->addAction(tr("&Resource Pack Manager"), this,
[this] { emit ShowResourcePackManager(); });

connect(&Settings::Instance(), &Settings::EnableCheatsChanged, [this](bool enabled) {
m_show_cheat_manager->setEnabled(Core::GetState() != Core::State::Uninitialized && enabled);
});
@@ -78,6 +78,7 @@ class MenuBar final : public QMenuBar
void ShowFIFOPlayer();
void ShowAboutDialog();
void ShowCheatsManager();
void ShowResourcePackManager();
void ConnectWiiRemote(int id);

// Options

0 comments on commit fc99809

Please sign in to comment.