mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-18 04:55:16 +02:00
43 lines
2.4 KiB
C++
43 lines
2.4 KiB
C++
#include "Extension/Console/commands.h"
|
|
#include "Extension/Profile/local_profile_runtime.h"
|
|
namespace dingosdk::console {
|
|
void register_graphics_commands(Commands ®istry) {
|
|
constexpr const char *names[]{"filmgrain", "vignette", "chromaticaberration"};
|
|
constexpr const char *descriptions[]{"Film grain effect", "Darkening around the screen edges",
|
|
"Color fringing at screen edges"};
|
|
for (unsigned i = 0; i < graphics_keys.size(); ++i) {
|
|
auto value = argument("0|1|-1", Type::integer);
|
|
value.choices = {"-1", "0", "1"};
|
|
auto entry = variable(names[i], descriptions[i], Group::graphics, value);
|
|
entry.aliases = {"graphics " + std::string(graphics_keys[i])};
|
|
entry.inspect = [i](const Model &m) {
|
|
return State{
|
|
m.graphics.available,
|
|
m.graphics.ready[i] ? std::optional<std::string>(m.graphics.enabled[i] ? "1" : "0") : std::nullopt,
|
|
"Graphics controls are unavailable.",
|
|
"Saved override: " +
|
|
(m.graphics.choices.effects[i] == -1 ? "default" : std::to_string(m.graphics.choices.effects[i])),
|
|
m.graphics.choices.effects[i] != -1};
|
|
};
|
|
entry.run = [i](const Model &, const Values &args, const Output &out) {
|
|
const bool saved =
|
|
set_local_graphics_control(graphics_keys[i], static_cast<int>(std::get<std::int64_t>(args[0])));
|
|
out(saved ? local_profile_graphics_controls().status : "error: Graphics control could not be saved.");
|
|
};
|
|
entry.reset = [i](const Model &, const Output &out) {
|
|
out(set_local_graphics_control(graphics_keys[i], -1) ? local_profile_graphics_controls().status
|
|
: "error: Graphics control could not be restored.");
|
|
};
|
|
registry.add(std::move(entry));
|
|
}
|
|
auto value = argument("-1", Type::integer, true);
|
|
value.choices = {"-1"};
|
|
auto reset = action("graphics reset", "Restore all authored graphics effects", Group::graphics, {value});
|
|
reset.run = [](const Model &, const Values &, const Output &out) {
|
|
out(set_local_graphics_control("reset", -1) ? local_profile_graphics_controls().status
|
|
: "error: Could not restore graphics.");
|
|
};
|
|
registry.add(std::move(reset));
|
|
}
|
|
} // namespace dingosdk::console
|