afegits tots els valors d'escala que dona sdl3

This commit is contained in:
2026-04-16 19:15:35 +02:00
parent a3fc1119ae
commit 52431adb0e
14 changed files with 165 additions and 98 deletions

View File

@@ -17,12 +17,10 @@ namespace Defaults::Video {
constexpr bool GPU_ACCELERATION = true;
constexpr bool SHADER_ENABLED = false;
constexpr bool SUPERSAMPLING = false;
constexpr bool INTEGER_SCALE = true;
constexpr bool VSYNC = true;
constexpr bool ASPECT_RATIO_4_3 = false; // CRT original estira 200→240
constexpr bool STRETCH_FILTER_LINEAR = false; // Filtre per a l'estirament 4:3 (false=NEAREST)
constexpr int DOWNSCALE_ALGO = 1; // 0=bilinear, 1=Lanczos2, 2=Lanczos3
constexpr bool LINEAR_UPSCALE = false;
constexpr bool ASPECT_RATIO_4_3 = false; // CRT original estira 200→240
constexpr int DOWNSCALE_ALGO = 1; // 0=bilinear, 1=Lanczos2, 2=Lanczos3
// TextureFilter i ScalingMode viuen a Options (requereixen #include, evitem dependència circular).
} // namespace Defaults::Video
namespace Defaults::Audio {

View File

@@ -123,18 +123,24 @@ namespace Options {
video.shader_enabled = node["shader_enabled"].get_value<bool>();
if (node.contains("supersampling"))
video.supersampling = node["supersampling"].get_value<bool>();
if (node.contains("integer_scale"))
video.integer_scale = node["integer_scale"].get_value<bool>();
if (node.contains("scaling_mode")) {
auto s = node["scaling_mode"].get_value<std::string>();
if (s == "disabled") video.scaling_mode = ScalingMode::DISABLED;
else if (s == "stretch") video.scaling_mode = ScalingMode::STRETCH;
else if (s == "letterbox") video.scaling_mode = ScalingMode::LETTERBOX;
else if (s == "overscan") video.scaling_mode = ScalingMode::OVERSCAN;
else video.scaling_mode = ScalingMode::INTEGER;
}
if (node.contains("vsync"))
video.vsync = node["vsync"].get_value<bool>();
if (node.contains("aspect_ratio_4_3"))
video.aspect_ratio_4_3 = node["aspect_ratio_4_3"].get_value<bool>();
if (node.contains("stretch_filter_linear"))
video.stretch_filter_linear = node["stretch_filter_linear"].get_value<bool>();
if (node.contains("texture_filter")) {
auto s = node["texture_filter"].get_value<std::string>();
video.texture_filter = (s == "linear") ? TextureFilter::LINEAR : TextureFilter::NEAREST;
}
if (node.contains("downscale_algo"))
video.downscale_algo = node["downscale_algo"].get_value<int>();
if (node.contains("linear_upscale"))
video.linear_upscale = node["linear_upscale"].get_value<bool>();
if (node.contains("current_shader"))
video.current_shader = node["current_shader"].get_value<std::string>();
if (node.contains("current_postfx_preset"))
@@ -277,12 +283,21 @@ namespace Options {
file << " gpu_acceleration: " << (video.gpu_acceleration ? "true" : "false") << "\n";
file << " shader_enabled: " << (video.shader_enabled ? "true" : "false") << "\n";
file << " supersampling: " << (video.supersampling ? "true" : "false") << "\n";
file << " integer_scale: " << (video.integer_scale ? "true" : "false") << "\n";
{
const char* m = "integer";
switch (video.scaling_mode) {
case ScalingMode::DISABLED: m = "disabled"; break;
case ScalingMode::STRETCH: m = "stretch"; break;
case ScalingMode::LETTERBOX: m = "letterbox"; break;
case ScalingMode::OVERSCAN: m = "overscan"; break;
case ScalingMode::INTEGER: m = "integer"; break;
}
file << " scaling_mode: " << m << " # disabled|stretch|letterbox|overscan|integer\n";
}
file << " vsync: " << (video.vsync ? "true" : "false") << "\n";
file << " aspect_ratio_4_3: " << (video.aspect_ratio_4_3 ? "true" : "false") << "\n";
file << " stretch_filter_linear: " << (video.stretch_filter_linear ? "true" : "false") << " # filtre 4:3: false=nearest, true=linear\n";
file << " texture_filter: " << (video.texture_filter == TextureFilter::LINEAR ? "linear" : "nearest") << " # nearest|linear\n";
file << " downscale_algo: " << video.downscale_algo << " # 0=bilinear, 1=Lanczos2, 2=Lanczos3\n";
file << " linear_upscale: " << (video.linear_upscale ? "true" : "false") << "\n";
file << " current_shader: " << video.current_shader << "\n";
file << " current_postfx_preset: " << video.current_postfx_preset << "\n";
file << " current_crtpi_preset: " << video.current_crtpi_preset << "\n";

View File

@@ -23,17 +23,28 @@ namespace Options {
TOP = 1,
BOTTOM = 2 };
// Filtre de textura per a l'upscale final (sempre, no només en 4:3)
enum class TextureFilter { NEAREST = 0,
LINEAR = 1 };
// Mode de presentació lògica (escala finestra): mapeja directament
// als valors de SDL_RendererLogicalPresentation.
enum class ScalingMode { DISABLED = 0,
STRETCH = 1,
LETTERBOX = 2,
OVERSCAN = 3,
INTEGER = 4 };
// Opcions de vídeo
struct Video {
bool gpu_acceleration{Defaults::Video::GPU_ACCELERATION};
bool shader_enabled{Defaults::Video::SHADER_ENABLED};
bool supersampling{Defaults::Video::SUPERSAMPLING};
bool integer_scale{Defaults::Video::INTEGER_SCALE};
ScalingMode scaling_mode{ScalingMode::INTEGER};
bool vsync{Defaults::Video::VSYNC};
bool aspect_ratio_4_3{Defaults::Video::ASPECT_RATIO_4_3};
bool stretch_filter_linear{Defaults::Video::STRETCH_FILTER_LINEAR};
TextureFilter texture_filter{TextureFilter::NEAREST};
int downscale_algo{Defaults::Video::DOWNSCALE_ALGO};
bool linear_upscale{Defaults::Video::LINEAR_UPSCALE};
std::string current_shader{"postfx"}; // "postfx" o "crtpi"
std::string current_postfx_preset{"CRT"}; // Nom del preset PostFX actiu
std::string current_crtpi_preset{"DEFAULT"}; // Nom del preset CrtPi actiu