2019-08-17 19:40:58 +00:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-08-17 19:40:58 +00:00
|
|
|
|
|
|
|
#include "InputCommon/DynamicInputTextureManager.h"
|
|
|
|
|
|
|
|
#include <set>
|
|
|
|
|
|
|
|
#include "Common/CommonPaths.h"
|
|
|
|
#include "Common/FileSearch.h"
|
|
|
|
#include "Common/FileUtil.h"
|
|
|
|
#include "Core/ConfigManager.h"
|
2021-02-03 05:04:33 +00:00
|
|
|
#include "Core/Core.h"
|
2019-08-17 19:40:58 +00:00
|
|
|
|
2021-02-15 02:47:00 +00:00
|
|
|
#include "InputCommon/DynamicInputTextures/DITConfiguration.h"
|
2019-08-17 19:40:58 +00:00
|
|
|
#include "VideoCommon/HiresTextures.h"
|
2023-01-30 11:46:10 +00:00
|
|
|
#include "VideoCommon/TextureCacheBase.h"
|
2019-08-17 19:40:58 +00:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-13 13:38:09 +00:00
|
|
|
void DynamicInputTextureManager::GenerateTextures(const Common::IniFile& file,
|
2021-02-27 22:41:50 +00:00
|
|
|
const std::vector<std::string>& controller_names)
|
2019-08-17 19:40:58 +00:00
|
|
|
{
|
|
|
|
for (const auto& configuration : m_configuration)
|
|
|
|
{
|
2023-03-23 01:56:13 +00:00
|
|
|
(void)configuration.GenerateTextures(file, controller_names);
|
2019-08-17 19:40:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace InputCommon
|