console_commands: cmdSs en subcomandes (size/upscale/downscale/on/off)
This commit is contained in:
@@ -55,16 +55,16 @@ static auto boolToggle(
|
|||||||
// ── Command handlers ─────────────────────────────────────────────────────────
|
// ── Command handlers ─────────────────────────────────────────────────────────
|
||||||
|
|
||||||
// SS [ON|OFF|SIZE|UPSCALE [NEAREST|LINEAR]|DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]]
|
// SS [ON|OFF|SIZE|UPSCALE [NEAREST|LINEAR]|DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3]]
|
||||||
static auto cmdSs(const std::vector<std::string>& args) -> std::string { // NOLINT(readability-function-cognitive-complexity)
|
// SS SIZE — dimensions de la textura supersampling activa
|
||||||
if (!Screen::get()->isHardwareAccelerated()) { return "No GPU acceleration"; }
|
static auto cmdSsSize() -> std::string {
|
||||||
static const std::array<std::string_view, 3> DOWNSCALE_NAMES = {"Bilinear", "Lanczos2", "Lanczos3"};
|
|
||||||
if (!args.empty() && args[0] == "SIZE") {
|
|
||||||
if (!Options::video.supersampling.enabled) { return "Supersampling is OFF: no texture"; }
|
if (!Options::video.supersampling.enabled) { return "Supersampling is OFF: no texture"; }
|
||||||
const auto [w, h] = Screen::get()->getSsTextureSize();
|
const auto [w, h] = Screen::get()->getSsTextureSize();
|
||||||
if (w == 0) { return "SS texture: not active"; }
|
if (w == 0) { return "SS texture: not active"; }
|
||||||
return "SS texture: " + std::to_string(w) + "x" + std::to_string(h);
|
return "SS texture: " + std::to_string(w) + "x" + std::to_string(h);
|
||||||
}
|
}
|
||||||
if (!args.empty() && args[0] == "UPSCALE") {
|
|
||||||
|
// SS UPSCALE [NEAREST|LINEAR] — toggle o estableix mode upscale
|
||||||
|
static auto cmdSsUpscale(const std::vector<std::string>& args) -> std::string {
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
Screen::get()->setLinearUpscale(!Options::video.supersampling.linear_upscale);
|
Screen::get()->setLinearUpscale(!Options::video.supersampling.linear_upscale);
|
||||||
return std::string("Upscale: ") + (Options::video.supersampling.linear_upscale ? "Linear" : "Nearest");
|
return std::string("Upscale: ") + (Options::video.supersampling.linear_upscale ? "Linear" : "Nearest");
|
||||||
@@ -81,7 +81,10 @@ static auto cmdSs(const std::vector<std::string>& args) -> std::string { // NOL
|
|||||||
}
|
}
|
||||||
return "usage: ss upscale [nearest|linear]";
|
return "usage: ss upscale [nearest|linear]";
|
||||||
}
|
}
|
||||||
if (!args.empty() && args[0] == "DOWNSCALE") {
|
|
||||||
|
// SS DOWNSCALE [BILINEAR|LANCZOS2|LANCZOS3] — consulta o estableix algorisme
|
||||||
|
static auto cmdSsDownscale(const std::vector<std::string>& args) -> std::string {
|
||||||
|
static const std::array<std::string_view, 3> DOWNSCALE_NAMES = {"Bilinear", "Lanczos2", "Lanczos3"};
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
return std::string("Downscale: ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(Options::video.supersampling.downscale_algo)]);
|
return std::string("Downscale: ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(Options::video.supersampling.downscale_algo)]);
|
||||||
}
|
}
|
||||||
@@ -96,20 +99,33 @@ static auto cmdSs(const std::vector<std::string>& args) -> std::string { // NOL
|
|||||||
Screen::get()->setDownscaleAlgo(algo);
|
Screen::get()->setDownscaleAlgo(algo);
|
||||||
return std::string("Downscale: ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(algo)]);
|
return std::string("Downscale: ") + std::string(DOWNSCALE_NAMES[static_cast<size_t>(algo)]);
|
||||||
}
|
}
|
||||||
if (args.empty()) {
|
|
||||||
Screen::get()->toggleSupersampling();
|
// SS ON — activa supersampling si encara no ho està
|
||||||
return std::string("PostFX Supersampling ") + (Options::video.supersampling.enabled ? "ON" : "OFF");
|
static auto cmdSsOn() -> std::string {
|
||||||
}
|
|
||||||
if (args[0] == "ON") {
|
|
||||||
if (Options::video.supersampling.enabled) { return "Supersampling already ON"; }
|
if (Options::video.supersampling.enabled) { return "Supersampling already ON"; }
|
||||||
Screen::get()->toggleSupersampling();
|
Screen::get()->toggleSupersampling();
|
||||||
return "PostFX Supersampling ON";
|
return "PostFX Supersampling ON";
|
||||||
}
|
}
|
||||||
if (args[0] == "OFF") {
|
|
||||||
|
// SS OFF — desactiva supersampling si encara està actiu
|
||||||
|
static auto cmdSsOff() -> std::string {
|
||||||
if (!Options::video.supersampling.enabled) { return "Supersampling already OFF"; }
|
if (!Options::video.supersampling.enabled) { return "Supersampling already OFF"; }
|
||||||
Screen::get()->toggleSupersampling();
|
Screen::get()->toggleSupersampling();
|
||||||
return "PostFX Supersampling OFF";
|
return "PostFX Supersampling OFF";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SS — toggle (sense args) o dispatch a subcomandes
|
||||||
|
static auto cmdSs(const std::vector<std::string>& args) -> std::string {
|
||||||
|
if (!Screen::get()->isHardwareAccelerated()) { return "No GPU acceleration"; }
|
||||||
|
if (args.empty()) {
|
||||||
|
Screen::get()->toggleSupersampling();
|
||||||
|
return std::string("PostFX Supersampling ") + (Options::video.supersampling.enabled ? "ON" : "OFF");
|
||||||
|
}
|
||||||
|
if (args[0] == "SIZE") { return cmdSsSize(); }
|
||||||
|
if (args[0] == "UPSCALE") { return cmdSsUpscale(args); }
|
||||||
|
if (args[0] == "DOWNSCALE") { return cmdSsDownscale(args); }
|
||||||
|
if (args[0] == "ON") { return cmdSsOn(); }
|
||||||
|
if (args[0] == "OFF") { return cmdSsOff(); }
|
||||||
return "usage: ss [on|off|size|upscale [nearest|linear]|downscale [bilinear|lanczos2|lanczos3]]";
|
return "usage: ss [on|off|size|upscale [nearest|linear]|downscale [bilinear|lanczos2|lanczos3]]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user