InputCommon: Move DynamicInputTextureData to DynamicInputTextures::Data

This commit is contained in:
iwubcode 2021-02-14 21:20:47 -06:00
parent 28a911ae6b
commit 10127a0451
5 changed files with 35 additions and 19 deletions

View File

@ -476,6 +476,7 @@
<ClInclude Include="InputCommon\ControlReference\ExpressionParser.h" />
<ClInclude Include="InputCommon\ControlReference\FunctionExpression.h" />
<ClInclude Include="InputCommon\DynamicInputTextures\DITConfiguration.h" />
<ClInclude Include="InputCommon\DynamicInputTextures\DITData.h" />
<ClInclude Include="InputCommon\DynamicInputTextureManager.h" />
<ClInclude Include="InputCommon\GCAdapter.h" />
<ClInclude Include="InputCommon\GCPadStatus.h" />

View File

@ -64,6 +64,7 @@ add_library(inputcommon
ControlReference/FunctionExpression.h
DynamicInputTextures/DITConfiguration.cpp
DynamicInputTextures/DITConfiguration.h
DynamicInputTextures/DITData.h
)
target_link_libraries(inputcommon

View File

@ -93,7 +93,7 @@ Configuration::Configuration(const std::string& json_file)
const auto output_textures = output_textures_json.get<picojson::object>();
for (auto& [name, data] : output_textures)
{
DynamicInputTextureData texture_data;
Data texture_data;
texture_data.m_hires_texture_name = name;
// Required fields
@ -262,7 +262,7 @@ bool Configuration::GenerateTextures(const IniFile::Section* sec,
}
bool Configuration::GenerateTexture(const IniFile::Section* sec, const std::string& controller_name,
const DynamicInputTextureData& texture_data) const
const Data& texture_data) const
{
std::string device_name;
if (!sec->Get("Device", &device_name))

View File

@ -10,7 +10,7 @@
#include "Common/CommonTypes.h"
#include "Common/IniFile.h"
#include "InputCommon/ImageOperations.h"
#include "InputCommon/DynamicInputTextures/DITData.h"
namespace InputCommon::DynamicInputTextures
{
@ -22,24 +22,10 @@ public:
bool GenerateTextures(const IniFile::Section* sec, const std::string& controller_name) const;
private:
struct DynamicInputTextureData
{
std::string m_image_name;
std::string m_hires_texture_name;
std::string m_generated_folder_name;
using EmulatedKeyToRegionsMap = std::unordered_map<std::string, std::vector<Rect>>;
std::unordered_map<std::string, EmulatedKeyToRegionsMap> m_emulated_controllers;
using HostKeyToImagePath = std::unordered_map<std::string, std::string>;
std::unordered_map<std::string, HostKeyToImagePath> m_host_devices;
bool m_preserve_aspect_ratio = true;
};
bool GenerateTexture(const IniFile::Section* sec, const std::string& controller_name,
const DynamicInputTextureData& texture_data) const;
const Data& texture_data) const;
std::vector<DynamicInputTextureData> m_dynamic_input_textures;
std::vector<Data> m_dynamic_input_textures;
std::string m_base_path;
bool m_valid = true;
};

View File

@ -0,0 +1,28 @@
// Copyright 2021 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <string>
#include <unordered_map>
#include <vector>
#include "InputCommon/ImageOperations.h"
namespace InputCommon::DynamicInputTextures
{
struct Data
{
std::string m_image_name;
std::string m_hires_texture_name;
std::string m_generated_folder_name;
using EmulatedKeyToRegionsMap = std::unordered_map<std::string, std::vector<Rect>>;
std::unordered_map<std::string, EmulatedKeyToRegionsMap> m_emulated_controllers;
using HostKeyToImagePath = std::unordered_map<std::string, std::string>;
std::unordered_map<std::string, HostKeyToImagePath> m_host_devices;
bool m_preserve_aspect_ratio = true;
};
} // namespace InputCommon::DynamicInputTextures