summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2022-07-02 14:49:51 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2022-10-09 00:00:01 -0500
commitbc360584a3a8a8902f50642496b2d1287e5088ac (patch)
tree335aac640b71462ecbe3e7ba672be08c9d0255f3 /Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions
parent6cf99195c645f54d54c72322ad0312a0e56bc985 (diff)
VideoCommon: add structures to graphics mods to allow for future adding or removing parameters with less code overhead
Diffstat (limited to 'Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions')
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.cpp20
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h4
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.cpp21
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h9
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp48
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h7
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.cpp18
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h5
8 files changed, 82 insertions, 50 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.cpp
index cc724c0480..d141af585c 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.cpp
@@ -30,18 +30,26 @@ MoveAction::MoveAction(Common::Vec3 position_offset) : m_position_offset(positio
{
}
-void MoveAction::OnProjection(Common::Matrix44* matrix)
+void MoveAction::OnProjection(GraphicsModActionData::Projection* projection)
{
- if (!matrix)
+ if (!projection) [[unlikely]]
return;
- *matrix *= Common::Matrix44::Translate(m_position_offset);
+ if (!projection->matrix) [[unlikely]]
+ return;
+
+ auto& matrix = *projection->matrix;
+ matrix = matrix * Common::Matrix44::Translate(m_position_offset);
}
-void MoveAction::OnProjectionAndTexture(Common::Matrix44* matrix)
+void MoveAction::OnProjectionAndTexture(GraphicsModActionData::Projection* projection)
{
- if (!matrix)
+ if (!projection) [[unlikely]]
+ return;
+
+ if (!projection->matrix) [[unlikely]]
return;
- *matrix *= Common::Matrix44::Translate(m_position_offset);
+ auto& matrix = *projection->matrix;
+ matrix = matrix * Common::Matrix44::Translate(m_position_offset);
}
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h
index 768d6a9f38..273cab1cfc 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h
@@ -14,8 +14,8 @@ class MoveAction final : public GraphicsModAction
public:
static std::unique_ptr<MoveAction> Create(const picojson::value& json_data);
explicit MoveAction(Common::Vec3 position_offset);
- void OnProjection(Common::Matrix44* matrix) override;
- void OnProjectionAndTexture(Common::Matrix44* matrix) override;
+ void OnProjection(GraphicsModActionData::Projection* projection) override;
+ void OnProjectionAndTexture(GraphicsModActionData::Projection* projection) override;
private:
Common::Vec3 m_position_offset;
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.cpp
index e6f7d6b659..e131b4ee1e 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.cpp
@@ -5,27 +5,32 @@
#include "Common/Logging/Log.h"
-void PrintAction::OnDrawStarted(bool*)
+void PrintAction::OnDrawStarted(GraphicsModActionData::DrawStarted*)
{
INFO_LOG_FMT(VIDEO, "OnDrawStarted Called");
}
-void PrintAction::OnEFB(bool*, u32 texture_width, u32 texture_height, u32* scaled_width,
- u32* scaled_height)
+void PrintAction::OnEFB(GraphicsModActionData::EFB* efb)
{
- if (!scaled_width || !scaled_height)
+ if (!efb) [[unlikely]]
return;
- INFO_LOG_FMT(VIDEO, "OnEFB Called. Original [{}, {}], Scaled [{}, {}]", texture_width,
- texture_height, *scaled_width, *scaled_height);
+ if (!efb->scaled_width) [[unlikely]]
+ return;
+
+ if (!efb->scaled_height) [[unlikely]]
+ return;
+
+ INFO_LOG_FMT(VIDEO, "OnEFB Called. Original [{}, {}], Scaled [{}, {}]", efb->texture_width,
+ efb->texture_height, *efb->scaled_width, *efb->scaled_height);
}
-void PrintAction::OnProjection(Common::Matrix44*)
+void PrintAction::OnProjection(GraphicsModActionData::Projection*)
{
INFO_LOG_FMT(VIDEO, "OnProjection Called");
}
-void PrintAction::OnProjectionAndTexture(Common::Matrix44*)
+void PrintAction::OnProjectionAndTexture(GraphicsModActionData::Projection*)
{
INFO_LOG_FMT(VIDEO, "OnProjectionAndTexture Called");
}
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h
index 6d8c123b68..6474eeb5f0 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h
@@ -8,10 +8,9 @@
class PrintAction final : public GraphicsModAction
{
public:
- void OnDrawStarted(bool* skip) override;
- void OnEFB(bool* skip, u32 texture_width, u32 texture_height, u32* scaled_width,
- u32* scaled_height) override;
- void OnProjection(Common::Matrix44* matrix) override;
- void OnProjectionAndTexture(Common::Matrix44* matrix) override;
+ void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
+ void OnEFB(GraphicsModActionData::EFB*) override;
+ void OnProjection(GraphicsModActionData::Projection*) override;
+ void OnProjectionAndTexture(GraphicsModActionData::Projection*) override;
void OnTextureLoad() override;
};
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp
index d0cac24acb..305cd8b737 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.cpp
@@ -30,30 +30,46 @@ ScaleAction::ScaleAction(Common::Vec3 scale) : m_scale(scale)
{
}
-void ScaleAction::OnEFB(bool*, u32 texture_width, u32 texture_height, u32* scaled_width,
- u32* scaled_height)
+void ScaleAction::OnEFB(GraphicsModActionData::EFB* efb)
{
- if (scaled_width && m_scale.x > 0)
- *scaled_width = texture_width * m_scale.x;
+ if (!efb) [[unlikely]]
+ return;
+
+ if (!efb->scaled_width) [[unlikely]]
+ return;
+
+ if (!efb->scaled_height) [[unlikely]]
+ return;
+
+ if (m_scale.x > 0)
+ *efb->scaled_width = efb->texture_width * m_scale.x;
- if (scaled_height && m_scale.y > 0)
- *scaled_height = texture_height * m_scale.y;
+ if (m_scale.y > 0)
+ *efb->scaled_height = efb->texture_height * m_scale.y;
}
-void ScaleAction::OnProjection(Common::Matrix44* matrix)
+void ScaleAction::OnProjection(GraphicsModActionData::Projection* projection)
{
- if (!matrix)
+ if (!projection) [[unlikely]]
return;
- auto& the_matrix = *matrix;
- the_matrix.data[0] = the_matrix.data[0] * m_scale.x;
- the_matrix.data[5] = the_matrix.data[5] * m_scale.y;
+
+ if (!projection->matrix) [[unlikely]]
+ return;
+
+ auto& matrix = *projection->matrix;
+ matrix.data[0] = matrix.data[0] * m_scale.x;
+ matrix.data[5] = matrix.data[5] * m_scale.y;
}
-void ScaleAction::OnProjectionAndTexture(Common::Matrix44* matrix)
+void ScaleAction::OnProjectionAndTexture(GraphicsModActionData::Projection* projection)
{
- if (!matrix)
+ if (!projection) [[unlikely]]
return;
- auto& the_matrix = *matrix;
- the_matrix.data[0] = the_matrix.data[0] * m_scale.x;
- the_matrix.data[5] = the_matrix.data[5] * m_scale.y;
+
+ if (!projection->matrix) [[unlikely]]
+ return;
+
+ auto& matrix = *projection->matrix;
+ matrix.data[0] = matrix.data[0] * m_scale.x;
+ matrix.data[5] = matrix.data[5] * m_scale.y;
}
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h
index cbe8744941..7192fe0c76 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h
@@ -14,10 +14,9 @@ class ScaleAction final : public GraphicsModAction
public:
static std::unique_ptr<ScaleAction> Create(const picojson::value& json_data);
explicit ScaleAction(Common::Vec3 scale);
- void OnEFB(bool* skip, u32 texture_width, u32 texture_height, u32* scaled_width,
- u32* scaled_height) override;
- void OnProjection(Common::Matrix44* matrix) override;
- void OnProjectionAndTexture(Common::Matrix44* matrix) override;
+ void OnEFB(GraphicsModActionData::EFB*) override;
+ void OnProjection(GraphicsModActionData::Projection*) override;
+ void OnProjectionAndTexture(GraphicsModActionData::Projection*) override;
private:
Common::Vec3 m_scale;
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.cpp
index ae3551497f..b693fef4f7 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.cpp
@@ -3,18 +3,24 @@
#include "VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h"
-void SkipAction::OnDrawStarted(bool* skip)
+void SkipAction::OnDrawStarted(GraphicsModActionData::DrawStarted* draw_started)
{
- if (!skip)
+ if (!draw_started) [[unlikely]]
return;
- *skip = true;
+ if (!draw_started->skip) [[unlikely]]
+ return;
+
+ *draw_started->skip = true;
}
-void SkipAction::OnEFB(bool* skip, u32, u32, u32*, u32*)
+void SkipAction::OnEFB(GraphicsModActionData::EFB* efb)
{
- if (!skip)
+ if (!efb) [[unlikely]]
+ return;
+
+ if (!efb->skip) [[unlikely]]
return;
- *skip = true;
+ *efb->skip = true;
}
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h
index 5cd204a89d..59de810355 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h
@@ -8,7 +8,6 @@
class SkipAction final : public GraphicsModAction
{
public:
- void OnDrawStarted(bool* skip) override;
- void OnEFB(bool* skip, u32 texture_width, u32 texture_height, u32* scaled_width,
- u32* scaled_height) override;
+ void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
+ void OnEFB(GraphicsModActionData::EFB*) override;
};