| 1 | // Copyright 2022 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "VideoCommon/GraphicsModSystem/Runtime/GraphicsModActionFactory.h" |
| 5 | |
| 6 | #include "VideoCommon/GraphicsModSystem/Runtime/Actions/CustomPipelineAction.h" |
| 7 | #include "VideoCommon/GraphicsModSystem/Runtime/Actions/MoveAction.h" |
| 8 | #include "VideoCommon/GraphicsModSystem/Runtime/Actions/PrintAction.h" |
| 9 | #include "VideoCommon/GraphicsModSystem/Runtime/Actions/ScaleAction.h" |
| 10 | #include "VideoCommon/GraphicsModSystem/Runtime/Actions/SkipAction.h" |
| 11 | |
| 12 | namespace GraphicsModActionFactory |
| 13 | { |
| 14 | std::unique_ptr<GraphicsModAction> Create(std::string_view name, const picojson::value& json_data, |
| 15 | std::shared_ptr<VideoCommon::CustomAssetLibrary> library) |
| 16 | { |
| 17 | if (name == PrintAction::factory_name) |
| 18 | { |
| 19 | return std::make_unique<PrintAction>(); |
| 20 | } |
| 21 | else if (name == SkipAction::factory_name) |
| 22 | { |
| 23 | return std::make_unique<SkipAction>(); |
| 24 | } |
| 25 | else if (name == MoveAction::factory_name) |
| 26 | { |
| 27 | return MoveAction::Create(json_data); |
| 28 | } |
| 29 | else if (name == ScaleAction::factory_name) |
| 30 | { |
| 31 | return ScaleAction::Create(json_data); |
| 32 | } |
| 33 | else if (name == CustomPipelineAction::factory_name) |
| 34 | { |
| 35 | return CustomPipelineAction::Create(json_data, std::move(library)); |
| 36 | } |
| 37 | |
| 38 | return nullptr; |
| 39 | } |
| 40 | } // namespace GraphicsModActionFactory |