diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2023-06-20 19:26:53 -0500 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2023-06-20 19:26:53 -0500 |
| commit | 1d767c3a5bad5fe02a9830da0317a9a336139664 (patch) | |
| tree | d35ec0fe29f7c81ed06c8a6bb0bdfc16006f6fe0 /Source/Core/VideoCommon/GraphicsModSystem/Runtime | |
| parent | 5ad2d86cc7b0356b7ea04e5bc9e50013fdf5a3b4 (diff) | |
VideoCommon: add graphics mod callback interface for when a texture is created
Diffstat (limited to 'Source/Core/VideoCommon/GraphicsModSystem/Runtime')
4 files changed, 31 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h index a7b366122d..04a371a73e 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h @@ -21,5 +21,6 @@ public: virtual void OnProjection(GraphicsModActionData::Projection*) {} virtual void OnProjectionAndTexture(GraphicsModActionData::Projection*) {} virtual void OnTextureLoad(GraphicsModActionData::TextureLoad*) {} + virtual void OnTextureCreate(GraphicsModActionData::TextureCreate*) {} virtual void OnFrameEnd() {} }; diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionData.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionData.h index 14f2e3a9b3..48de0e5368 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionData.h +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionData.h @@ -32,4 +32,7 @@ struct TextureLoad { std::string_view texture_name; }; +struct TextureCreate +{ +}; } // namespace GraphicsModActionData diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp index 3f1cea1b80..3e4cd6e4e6 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.cpp @@ -58,6 +58,12 @@ public: return; m_action_impl->OnTextureLoad(texture_load); } + void OnTextureCreate(GraphicsModActionData::TextureCreate* texture_create) override + { + if (!m_mod.m_enabled) + return; + m_action_impl->OnTextureCreate(texture_create); + } void OnFrameEnd() override { if (!m_mod.m_enabled) @@ -143,6 +149,18 @@ GraphicsModManager::GetTextureLoadActions(const std::string& texture_name) const return m_default; } +const std::vector<GraphicsModAction*>& +GraphicsModManager::GetTextureCreateActions(const std::string& texture_name) const +{ + if (const auto it = m_create_texture_target_to_actions.find(texture_name); + it != m_create_texture_target_to_actions.end()) + { + return it->second; + } + + return m_default; +} + const std::vector<GraphicsModAction*>& GraphicsModManager::GetEFBActions(const FBInfo& efb) const { if (const auto it = m_efb_target_to_actions.find(efb); it != m_efb_target_to_actions.end()) @@ -223,6 +241,10 @@ void GraphicsModManager::Load(const GraphicsModGroupConfig& config) m_load_texture_target_to_actions[the_target.m_texture_info_string].push_back( m_actions.back().get()); }, + [&](const CreateTextureTarget& the_target) { + m_create_texture_target_to_actions[the_target.m_texture_info_string].push_back( + m_actions.back().get()); + }, [&](const EFBTarget& the_target) { FBInfo info; info.m_height = the_target.m_height; @@ -315,6 +337,7 @@ void GraphicsModManager::Reset() m_projection_texture_target_to_actions.clear(); m_draw_started_target_to_actions.clear(); m_load_texture_target_to_actions.clear(); + m_create_texture_target_to_actions.clear(); m_efb_target_to_actions.clear(); m_xfb_target_to_actions.clear(); } diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h index ed0063444a..2d67b4db76 100644 --- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h +++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModManager.h @@ -30,6 +30,8 @@ public: GetDrawStartedActions(const std::string& texture_name) const; const std::vector<GraphicsModAction*>& GetTextureLoadActions(const std::string& texture_name) const; + const std::vector<GraphicsModAction*>& + GetTextureCreateActions(const std::string& texture_name) const; const std::vector<GraphicsModAction*>& GetEFBActions(const FBInfo& efb) const; const std::vector<GraphicsModAction*>& GetXFBActions(const FBInfo& xfb) const; @@ -49,6 +51,8 @@ private: m_projection_texture_target_to_actions; std::unordered_map<std::string, std::vector<GraphicsModAction*>> m_draw_started_target_to_actions; std::unordered_map<std::string, std::vector<GraphicsModAction*>> m_load_texture_target_to_actions; + std::unordered_map<std::string, std::vector<GraphicsModAction*>> + m_create_texture_target_to_actions; std::unordered_map<FBInfo, std::vector<GraphicsModAction*>, FBInfoHasher> m_efb_target_to_actions; std::unordered_map<FBInfo, std::vector<GraphicsModAction*>, FBInfoHasher> m_xfb_target_to_actions; |
