InputCommon: Move DynamicInputTextureConfiguration to DynamicInputTextures::Configuration

This commit is contained in:
iwubcode 2021-02-14 20:47:00 -06:00
parent 38935f2e4e
commit 28a911ae6b
6 changed files with 24 additions and 22 deletions

View File

@ -475,7 +475,7 @@
<ClInclude Include="InputCommon\ControlReference\ControlReference.h" /> <ClInclude Include="InputCommon\ControlReference\ControlReference.h" />
<ClInclude Include="InputCommon\ControlReference\ExpressionParser.h" /> <ClInclude Include="InputCommon\ControlReference\ExpressionParser.h" />
<ClInclude Include="InputCommon\ControlReference\FunctionExpression.h" /> <ClInclude Include="InputCommon\ControlReference\FunctionExpression.h" />
<ClInclude Include="InputCommon\DynamicInputTextureConfiguration.h" /> <ClInclude Include="InputCommon\DynamicInputTextures\DITConfiguration.h" />
<ClInclude Include="InputCommon\DynamicInputTextureManager.h" /> <ClInclude Include="InputCommon\DynamicInputTextureManager.h" />
<ClInclude Include="InputCommon\GCAdapter.h" /> <ClInclude Include="InputCommon\GCAdapter.h" />
<ClInclude Include="InputCommon\GCPadStatus.h" /> <ClInclude Include="InputCommon\GCPadStatus.h" />
@ -1041,7 +1041,7 @@
<ClCompile Include="InputCommon\ControlReference\ControlReference.cpp" /> <ClCompile Include="InputCommon\ControlReference\ControlReference.cpp" />
<ClCompile Include="InputCommon\ControlReference\ExpressionParser.cpp" /> <ClCompile Include="InputCommon\ControlReference\ExpressionParser.cpp" />
<ClCompile Include="InputCommon\ControlReference\FunctionExpression.cpp" /> <ClCompile Include="InputCommon\ControlReference\FunctionExpression.cpp" />
<ClCompile Include="InputCommon\DynamicInputTextureConfiguration.cpp" /> <ClCompile Include="InputCommon\DynamicInputTextures\DITConfiguration.cpp" />
<ClCompile Include="InputCommon\DynamicInputTextureManager.cpp" /> <ClCompile Include="InputCommon\DynamicInputTextureManager.cpp" />
<ClCompile Include="InputCommon\GCAdapter.cpp" /> <ClCompile Include="InputCommon\GCAdapter.cpp" />
<ClCompile Include="InputCommon\ImageOperations.cpp" /> <ClCompile Include="InputCommon\ImageOperations.cpp" />

View File

@ -1,6 +1,4 @@
add_library(inputcommon add_library(inputcommon
DynamicInputTextureConfiguration.cpp
DynamicInputTextureConfiguration.h
DynamicInputTextureManager.cpp DynamicInputTextureManager.cpp
DynamicInputTextureManager.h DynamicInputTextureManager.h
ImageOperations.cpp ImageOperations.cpp
@ -64,6 +62,8 @@ add_library(inputcommon
ControlReference/ExpressionParser.h ControlReference/ExpressionParser.h
ControlReference/FunctionExpression.cpp ControlReference/FunctionExpression.cpp
ControlReference/FunctionExpression.h ControlReference/FunctionExpression.h
DynamicInputTextures/DITConfiguration.cpp
DynamicInputTextures/DITConfiguration.h
) )
target_link_libraries(inputcommon target_link_libraries(inputcommon

View File

@ -12,7 +12,7 @@
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "InputCommon/DynamicInputTextureConfiguration.h" #include "InputCommon/DynamicInputTextures/DITConfiguration.h"
#include "VideoCommon/HiresTextures.h" #include "VideoCommon/HiresTextures.h"
#include "VideoCommon/RenderBase.h" #include "VideoCommon/RenderBase.h"

View File

@ -11,7 +11,10 @@
namespace InputCommon namespace InputCommon
{ {
class DynamicInputTextureConfiguration; namespace DynamicInputTextures
{
class Configuration;
}
class DynamicInputTextureManager class DynamicInputTextureManager
{ {
public: public:
@ -21,7 +24,7 @@ public:
void GenerateTextures(const IniFile::Section* sec, const std::string& controller_name); void GenerateTextures(const IniFile::Section* sec, const std::string& controller_name);
private: private:
std::vector<DynamicInputTextureConfiguration> m_configuration; std::vector<DynamicInputTextures::Configuration> m_configuration;
std::string m_config_type; std::string m_config_type;
}; };
} // namespace InputCommon } // namespace InputCommon

View File

@ -2,7 +2,7 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "InputCommon/DynamicInputTextureConfiguration.h" #include "InputCommon/DynamicInputTextures/DITConfiguration.h"
#include <optional> #include <optional>
#include <sstream> #include <sstream>
@ -30,9 +30,9 @@ std::string GetStreamAsString(std::ifstream& stream)
} }
} // namespace } // namespace
namespace InputCommon namespace InputCommon::DynamicInputTextures
{ {
DynamicInputTextureConfiguration::DynamicInputTextureConfiguration(const std::string& json_file) Configuration::Configuration(const std::string& json_file)
{ {
std::ifstream json_stream; std::ifstream json_stream;
File::OpenFStream(json_stream, json_file, std::ios_base::in); File::OpenFStream(json_stream, json_file, std::ios_base::in);
@ -247,10 +247,10 @@ DynamicInputTextureConfiguration::DynamicInputTextureConfiguration(const std::st
} }
} }
DynamicInputTextureConfiguration::~DynamicInputTextureConfiguration() = default; Configuration::~Configuration() = default;
bool DynamicInputTextureConfiguration::GenerateTextures(const IniFile::Section* sec, bool Configuration::GenerateTextures(const IniFile::Section* sec,
const std::string& controller_name) const const std::string& controller_name) const
{ {
bool any_dirty = false; bool any_dirty = false;
for (const auto& texture_data : m_dynamic_input_textures) for (const auto& texture_data : m_dynamic_input_textures)
@ -261,9 +261,8 @@ bool DynamicInputTextureConfiguration::GenerateTextures(const IniFile::Section*
return any_dirty; return any_dirty;
} }
bool DynamicInputTextureConfiguration::GenerateTexture( bool Configuration::GenerateTexture(const IniFile::Section* sec, const std::string& controller_name,
const IniFile::Section* sec, const std::string& controller_name, const DynamicInputTextureData& texture_data) const
const DynamicInputTextureData& texture_data) const
{ {
std::string device_name; std::string device_name;
if (!sec->Get("Device", &device_name)) if (!sec->Get("Device", &device_name))
@ -381,4 +380,4 @@ bool DynamicInputTextureConfiguration::GenerateTexture(
return false; return false;
} }
} // namespace InputCommon } // namespace InputCommon::DynamicInputTextures

View File

@ -12,13 +12,13 @@
#include "Common/IniFile.h" #include "Common/IniFile.h"
#include "InputCommon/ImageOperations.h" #include "InputCommon/ImageOperations.h"
namespace InputCommon namespace InputCommon::DynamicInputTextures
{ {
class DynamicInputTextureConfiguration class Configuration
{ {
public: public:
explicit DynamicInputTextureConfiguration(const std::string& json_file); explicit Configuration(const std::string& json_file);
~DynamicInputTextureConfiguration(); ~Configuration();
bool GenerateTextures(const IniFile::Section* sec, const std::string& controller_name) const; bool GenerateTextures(const IniFile::Section* sec, const std::string& controller_name) const;
private: private:
@ -43,4 +43,4 @@ private:
std::string m_base_path; std::string m_base_path;
bool m_valid = true; bool m_valid = true;
}; };
} // namespace InputCommon } // namespace InputCommon::DynamicInputTextures