Merge pull request #12590 from iwubcode/graphics_mod_action_factory_name
VideoCommon: move factory names to be a static inside each action class
This commit is contained in:
commit
22d96ef5b5
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <picojson.h>
|
#include <picojson.h>
|
||||||
|
@ -21,6 +22,7 @@ public:
|
||||||
std::string m_pixel_material_asset;
|
std::string m_pixel_material_asset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static constexpr std::string_view factory_name = "custom_pipeline";
|
||||||
static std::unique_ptr<CustomPipelineAction>
|
static std::unique_ptr<CustomPipelineAction>
|
||||||
Create(const picojson::value& json_data,
|
Create(const picojson::value& json_data,
|
||||||
std::shared_ptr<VideoCommon::CustomAssetLibrary> library);
|
std::shared_ptr<VideoCommon::CustomAssetLibrary> library);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include <picojson.h>
|
#include <picojson.h>
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
class MoveAction final : public GraphicsModAction
|
class MoveAction final : public GraphicsModAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static constexpr std::string_view factory_name = "move";
|
||||||
static std::unique_ptr<MoveAction> Create(const picojson::value& json_data);
|
static std::unique_ptr<MoveAction> Create(const picojson::value& json_data);
|
||||||
explicit MoveAction(Common::Vec3 position_offset);
|
explicit MoveAction(Common::Vec3 position_offset);
|
||||||
void OnProjection(GraphicsModActionData::Projection* projection) override;
|
void OnProjection(GraphicsModActionData::Projection* projection) override;
|
||||||
|
|
|
@ -3,11 +3,14 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h"
|
#include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModAction.h"
|
||||||
|
|
||||||
class PrintAction final : public GraphicsModAction
|
class PrintAction final : public GraphicsModAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static constexpr std::string_view factory_name = "print";
|
||||||
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
|
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
|
||||||
void OnEFB(GraphicsModActionData::EFB*) override;
|
void OnEFB(GraphicsModActionData::EFB*) override;
|
||||||
void OnProjection(GraphicsModActionData::Projection*) override;
|
void OnProjection(GraphicsModActionData::Projection*) override;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include <picojson.h>
|
#include <picojson.h>
|
||||||
|
|
||||||
|
@ -12,6 +13,7 @@
|
||||||
class ScaleAction final : public GraphicsModAction
|
class ScaleAction final : public GraphicsModAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static constexpr std::string_view factory_name = "scale";
|
||||||
static std::unique_ptr<ScaleAction> Create(const picojson::value& json_data);
|
static std::unique_ptr<ScaleAction> Create(const picojson::value& json_data);
|
||||||
explicit ScaleAction(Common::Vec3 scale);
|
explicit ScaleAction(Common::Vec3 scale);
|
||||||
void OnEFB(GraphicsModActionData::EFB*) override;
|
void OnEFB(GraphicsModActionData::EFB*) override;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
class SkipAction final : public GraphicsModAction
|
class SkipAction final : public GraphicsModAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static constexpr std::string_view factory_name = "skip";
|
||||||
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
|
void OnDrawStarted(GraphicsModActionData::DrawStarted*) override;
|
||||||
void OnEFB(GraphicsModActionData::EFB*) override;
|
void OnEFB(GraphicsModActionData::EFB*) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,23 +14,23 @@ namespace GraphicsModActionFactory
|
||||||
std::unique_ptr<GraphicsModAction> Create(std::string_view name, const picojson::value& json_data,
|
std::unique_ptr<GraphicsModAction> Create(std::string_view name, const picojson::value& json_data,
|
||||||
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
|
std::shared_ptr<VideoCommon::CustomAssetLibrary> library)
|
||||||
{
|
{
|
||||||
if (name == "print")
|
if (name == PrintAction::factory_name)
|
||||||
{
|
{
|
||||||
return std::make_unique<PrintAction>();
|
return std::make_unique<PrintAction>();
|
||||||
}
|
}
|
||||||
else if (name == "skip")
|
else if (name == SkipAction::factory_name)
|
||||||
{
|
{
|
||||||
return std::make_unique<SkipAction>();
|
return std::make_unique<SkipAction>();
|
||||||
}
|
}
|
||||||
else if (name == "move")
|
else if (name == MoveAction::factory_name)
|
||||||
{
|
{
|
||||||
return MoveAction::Create(json_data);
|
return MoveAction::Create(json_data);
|
||||||
}
|
}
|
||||||
else if (name == "scale")
|
else if (name == ScaleAction::factory_name)
|
||||||
{
|
{
|
||||||
return ScaleAction::Create(json_data);
|
return ScaleAction::Create(json_data);
|
||||||
}
|
}
|
||||||
else if (name == "custom_pipeline")
|
else if (name == CustomPipelineAction::factory_name)
|
||||||
{
|
{
|
||||||
return CustomPipelineAction::Create(json_data, std::move(library));
|
return CustomPipelineAction::Create(json_data, std::move(library));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue