summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/GraphicsModSystem
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2024-02-18 15:39:19 -0600
committeriwubcode <iwubcode@users.noreply.github.com>2024-02-18 15:45:10 -0600
commita1147dae6e7dadc0def660a3067d0e9f519711b0 (patch)
tree83800d88946495eeac0c1a1a1cdfda75a82cdf78 /Source/Core/VideoCommon/GraphicsModSystem
parent01571669409f5196cc5b89cba110728d15f30568 (diff)
VideoCommon: move factory names to be a static inside each action class, so that they can be reused in the future for serialization
Diffstat (limited to 'Source/Core/VideoCommon/GraphicsModSystem')
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h2
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h2
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h3
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h2
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h1
-rw-r--r--Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionFactory.cpp10
6 files changed, 15 insertions, 5 deletions
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h
index 8413ec187e..99026b99ce 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h
@@ -5,6 +5,7 @@
#include <memory>
#include <string>
+#include <string_view>
#include <vector>
#include <picojson.h>
@@ -21,6 +22,7 @@ public:
std::string m_pixel_material_asset;
};
+ static constexpr std::string_view factory_name = "custom_pipeline";
static std::unique_ptr<CustomPipelineAction>
Create(const picojson::value& json_data,
std::shared_ptr<VideoCommon::CustomAssetLibrary> library);
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h
index 273cab1cfc..b7a0358ce8 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h
@@ -4,6 +4,7 @@
#pragma once
#include <memory>
+#include <string_view>
#include <picojson.h>
@@ -12,6 +13,7 @@
class MoveAction final : public GraphicsModAction
{
public:
+ static constexpr std::string_view factory_name = "move";
static std::unique_ptr<MoveAction> Create(const picojson::value& json_data);
explicit MoveAction(Common::Vec3 position_offset);
void OnProjection(GraphicsModActionData::Projection* projection) override;
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h
index 73a8103ad4..82a21c152f 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h
@@ -3,11 +3,14 @@
#pragma once
+#include <string_view>
+
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h"
class PrintAction final : public GraphicsModAction
{
public:
+ static constexpr std::string_view factory_name = "print";
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
void OnEFB(GraphicsModActionData::EFB*) override;
void OnProjection(GraphicsModActionData::Projection*) override;
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h
index 7192fe0c76..4673ed2d18 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h
@@ -4,6 +4,7 @@
#pragma once
#include <memory>
+#include <string_view>
#include <picojson.h>
@@ -12,6 +13,7 @@
class ScaleAction final : public GraphicsModAction
{
public:
+ static constexpr std::string_view factory_name = "scale";
static std::unique_ptr<ScaleAction> Create(const picojson::value& json_data);
explicit ScaleAction(Common::Vec3 scale);
void OnEFB(GraphicsModActionData::EFB*) override;
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h
index 59de810355..8cda643c5a 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h
@@ -8,6 +8,7 @@
class SkipAction final : public GraphicsModAction
{
public:
+ static constexpr std::string_view factory_name = "skip";
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
void OnEFB(GraphicsModActionData::EFB*) override;
};
diff --git a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionFactory.cpp b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionFactory.cpp
index 6ff64aa038..1059595ef1 100644
--- a/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionFactory.cpp
+++ b/Source/Core/VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionFactory.cpp
@@ -14,23 +14,23 @@ namespace GraphicsModActionFactory
std::unique_ptr<GraphicsModAction> Create(std::string_view name, const picojson::value& json_data,
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
{
- if (name == "print")
+ if (name == PrintAction::factory_name)
{
return std::make_unique<PrintAction>();
}
- else if (name == "skip")
+ else if (name == SkipAction::factory_name)
{
return std::make_unique<SkipAction>();
}
- else if (name == "move")
+ else if (name == MoveAction::factory_name)
{
return MoveAction::Create(json_data);
}
- else if (name == "scale")
+ else if (name == ScaleAction::factory_name)
{
return ScaleAction::Create(json_data);
}
- else if (name == "custom_pipeline")
+ else if (name == CustomPipelineAction::factory_name)
{
return CustomPipelineAction::Create(json_data, std::move(library));
}