Skip to content

Commit

Permalink
Merge pull request #11681 from iwubcode/asset_management
Browse files Browse the repository at this point in the history
VideoCommon: migrate texture packs to use the asset loader system
  • Loading branch information
AdmiralCurtiss committed Jun 8, 2023
2 parents f561bd4 + e831d7b commit 7845fb0
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 352 deletions.
9 changes: 4 additions & 5 deletions Source/Core/Core/Core.cpp
Expand Up @@ -83,10 +83,10 @@
#include "InputCommon/ControllerInterface/ControllerInterface.h"
#include "InputCommon/GCAdapter.h"

#include "VideoCommon/Assets/CustomAssetLoader.h"
#include "VideoCommon/AsyncRequests.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/FrameDumper.h"
#include "VideoCommon/HiresTextures.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/PerformanceMetrics.h"
#include "VideoCommon/Present.h"
Expand Down Expand Up @@ -546,6 +546,9 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi

FreeLook::LoadInputConfig();

system.GetCustomAssetLoader().Init();
Common::ScopeGuard asset_loader_guard([&system] { system.GetCustomAssetLoader().Shutdown(); });

Movie::Init(*boot);
Common::ScopeGuard movie_guard{&Movie::Shutdown};

Expand Down Expand Up @@ -597,10 +600,6 @@ static void EmuThread(std::unique_ptr<BootParameters> boot, WindowSystemInfo wsi
return;
}

// Inputs loading may have generated custom dynamic textures
// it's now ok to initialize any custom textures
HiresTexture::Update();

AudioCommon::PostInitSoundStream(system);

// The hardware is initialized.
Expand Down
7 changes: 7 additions & 0 deletions Source/Core/Core/System.cpp
Expand Up @@ -27,6 +27,7 @@
#include "Core/PowerPC/PowerPC.h"
#include "IOS/USB/Emulated/Infinity.h"
#include "IOS/USB/Emulated/Skylander.h"
#include "VideoCommon/Assets/CustomAssetLoader.h"
#include "VideoCommon/CommandProcessor.h"
#include "VideoCommon/Fifo.h"
#include "VideoCommon/GeometryShaderManager.h"
Expand Down Expand Up @@ -79,6 +80,7 @@ struct System::Impl
VideoInterface::VideoInterfaceManager m_video_interface;
Interpreter m_interpreter;
JitInterface m_jit_interface;
VideoCommon::CustomAssetLoader m_custom_asset_loader;
};

System::System() : m_impl{std::make_unique<Impl>(*this)}
Expand Down Expand Up @@ -263,4 +265,9 @@ VideoInterface::VideoInterfaceManager& System::GetVideoInterface() const
{
return m_impl->m_video_interface;
}

VideoCommon::CustomAssetLoader& System::GetCustomAssetLoader() const
{
return m_impl->m_custom_asset_loader;
}
} // namespace Core
5 changes: 5 additions & 0 deletions Source/Core/Core/System.h
Expand Up @@ -85,6 +85,10 @@ namespace SerialInterface
{
class SerialInterfaceManager;
};
namespace VideoCommon
{
class CustomAssetLoader;
}
namespace VideoInterface
{
class VideoInterfaceManager;
Expand Down Expand Up @@ -152,6 +156,7 @@ class System
Sram& GetSRAM() const;
VertexShaderManager& GetVertexShaderManager() const;
VideoInterface::VideoInterfaceManager& GetVideoInterface() const;
VideoCommon::CustomAssetLoader& GetCustomAssetLoader() const;

private:
System();
Expand Down
6 changes: 1 addition & 5 deletions Source/Core/InputCommon/DynamicInputTextureManager.cpp
Expand Up @@ -42,13 +42,9 @@ void DynamicInputTextureManager::Load()
void DynamicInputTextureManager::GenerateTextures(const Common::IniFile& file,
const std::vector<std::string>& controller_names)
{
bool any_dirty = false;
for (const auto& configuration : m_configuration)
{
any_dirty |= configuration.GenerateTextures(file, controller_names);
(void)configuration.GenerateTextures(file, controller_names);
}

if (any_dirty && g_texture_cache && Core::GetState() != Core::State::Starting)
g_texture_cache->ForceReloadTextures();
}
} // namespace InputCommon

0 comments on commit 7845fb0

Please sign in to comment.