mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 13:57:57 -07:00
e149ad4f0a
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
55 lines
1.6 KiB
C++
55 lines
1.6 KiB
C++
// Copyright 2019 Dolphin Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include "InputCommon/DynamicInputTextureManager.h"
|
|
|
|
#include <set>
|
|
|
|
#include "Common/CommonPaths.h"
|
|
#include "Common/FileSearch.h"
|
|
#include "Common/FileUtil.h"
|
|
#include "Core/ConfigManager.h"
|
|
#include "Core/Core.h"
|
|
|
|
#include "InputCommon/DynamicInputTextures/DITConfiguration.h"
|
|
#include "VideoCommon/HiresTextures.h"
|
|
#include "VideoCommon/RenderBase.h"
|
|
|
|
namespace InputCommon
|
|
{
|
|
DynamicInputTextureManager::DynamicInputTextureManager() = default;
|
|
|
|
DynamicInputTextureManager::~DynamicInputTextureManager() = default;
|
|
|
|
void DynamicInputTextureManager::Load()
|
|
{
|
|
m_configuration.clear();
|
|
|
|
const std::string& game_id = SConfig::GetInstance().GetGameID();
|
|
const std::set<std::string> dynamic_input_directories =
|
|
GetTextureDirectoriesWithGameId(File::GetUserPath(D_DYNAMICINPUT_IDX), game_id);
|
|
|
|
for (const auto& dynamic_input_directory : dynamic_input_directories)
|
|
{
|
|
const auto json_files = Common::DoFileSearch({dynamic_input_directory}, {".json"});
|
|
for (auto& file : json_files)
|
|
{
|
|
m_configuration.emplace_back(file);
|
|
}
|
|
}
|
|
}
|
|
|
|
void DynamicInputTextureManager::GenerateTextures(const 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);
|
|
}
|
|
|
|
if (any_dirty && g_renderer && Core::GetState() != Core::State::Starting)
|
|
g_renderer->ForceReloadTextures();
|
|
}
|
|
} // namespace InputCommon
|