Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #11300 from iwubcode/custom-shaders
VideoCommon: add a graphics mod action that allows you to modify the game's base rendering
- Loading branch information
Showing
28 changed files
with
2,576 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModAsset.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| // Copyright 2023 Dolphin Emulator Project | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #include "VideoCommon/GraphicsModSystem/Config/GraphicsModAsset.h" | ||
|
|
||
| #include "Common/Logging/Log.h" | ||
|
|
||
| bool GraphicsModAssetConfig::DeserializeFromConfig(const picojson::object& obj) | ||
| { | ||
| auto name_iter = obj.find("name"); | ||
| if (name_iter == obj.end()) | ||
| { | ||
| ERROR_LOG_FMT(VIDEO, "Failed to load mod configuration file, specified asset has no name"); | ||
| return false; | ||
| } | ||
| if (!name_iter->second.is<std::string>()) | ||
| { | ||
| ERROR_LOG_FMT(VIDEO, "Failed to load mod configuration file, specified asset has a name " | ||
| "that is not a string"); | ||
| return false; | ||
| } | ||
| m_name = name_iter->second.to_str(); | ||
|
|
||
| auto data_iter = obj.find("data"); | ||
| if (data_iter == obj.end()) | ||
| { | ||
| ERROR_LOG_FMT(VIDEO, "Failed to load mod configuration file, specified asset '{}' has no data", | ||
| m_name); | ||
| return false; | ||
| } | ||
| if (!data_iter->second.is<picojson::object>()) | ||
| { | ||
| ERROR_LOG_FMT(VIDEO, | ||
| "Failed to load mod configuration file, specified asset '{}' has data " | ||
| "that is not an object", | ||
| m_name); | ||
| return false; | ||
| } | ||
| for (const auto& [key, value] : data_iter->second.get<picojson::object>()) | ||
| { | ||
| if (!value.is<std::string>()) | ||
| { | ||
| ERROR_LOG_FMT(VIDEO, | ||
| "Failed to load mod configuration file, specified asset '{}' has data " | ||
| "with a value for key '{}' that is not a string", | ||
| m_name, key); | ||
| } | ||
| m_map[key] = value.to_str(); | ||
| } | ||
|
|
||
| return true; | ||
| } |
18 changes: 18 additions & 0 deletions
18
Source/Core/VideoCommon/GraphicsModSystem/Config/GraphicsModAsset.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Copyright 2023 Dolphin Emulator Project | ||
| // SPDX-License-Identifier: GPL-2.0-or-later | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <picojson.h> | ||
|
|
||
| #include "VideoCommon/Assets/DirectFilesystemAssetLibrary.h" | ||
|
|
||
| struct GraphicsModAssetConfig | ||
| { | ||
| std::string m_name; | ||
| VideoCommon::DirectFilesystemAssetLibrary::AssetMap m_map; | ||
|
|
||
| bool DeserializeFromConfig(const picojson::object& obj); | ||
| }; |
Oops, something went wrong.