vsync, integer scale
This commit is contained in:
@@ -18,6 +18,8 @@ menu:
|
|||||||
shader: "SHADER"
|
shader: "SHADER"
|
||||||
aspect_4_3: "ASPECTE 4:3"
|
aspect_4_3: "ASPECTE 4:3"
|
||||||
supersampling: "SUPERSAMPLING"
|
supersampling: "SUPERSAMPLING"
|
||||||
|
vsync: "VSYNC"
|
||||||
|
integer_scale: "ESCALA ENTERA"
|
||||||
shader_type: "TIPUS SHADER"
|
shader_type: "TIPUS SHADER"
|
||||||
preset: "PRESET"
|
preset: "PRESET"
|
||||||
stretch_filter: "FILTRE 4:3"
|
stretch_filter: "FILTRE 4:3"
|
||||||
|
|||||||
@@ -136,6 +136,14 @@ namespace Menu {
|
|||||||
[] { return onOff(Options::video.supersampling); },
|
[] { return onOff(Options::video.supersampling); },
|
||||||
[](int) { Screen::get()->toggleSupersampling(); }, nullptr});
|
[](int) { Screen::get()->toggleSupersampling(); }, nullptr});
|
||||||
|
|
||||||
|
p.items.push_back({Locale::get("menu.items.vsync"), ItemKind::Toggle,
|
||||||
|
[] { return onOff(Options::video.vsync); },
|
||||||
|
[](int) { Screen::get()->toggleVSync(); }, nullptr});
|
||||||
|
|
||||||
|
p.items.push_back({Locale::get("menu.items.integer_scale"), ItemKind::Toggle,
|
||||||
|
[] { return onOff(Options::video.integer_scale); },
|
||||||
|
[](int) { Screen::get()->toggleIntegerScale(); }, nullptr});
|
||||||
|
|
||||||
p.items.push_back({Locale::get("menu.items.shader_type"), ItemKind::Cycle,
|
p.items.push_back({Locale::get("menu.items.shader_type"), ItemKind::Cycle,
|
||||||
[] { return std::string(Screen::get()->getActiveShaderName()); }, [](int dir) {
|
[] { return std::string(Screen::get()->getActiveShaderName()); }, [](int dir) {
|
||||||
if (dir < 0) Screen::get()->prevShaderType();
|
if (dir < 0) Screen::get()->prevShaderType();
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ void Screen::initShaders() {
|
|||||||
|
|
||||||
// Aplica opcions de vídeo
|
// Aplica opcions de vídeo
|
||||||
shader_backend_->setScaleMode(Options::video.integer_scale);
|
shader_backend_->setScaleMode(Options::video.integer_scale);
|
||||||
|
shader_backend_->setVSync(Options::video.vsync);
|
||||||
shader_backend_->setStretchFilter(Options::video.stretch_filter_linear);
|
shader_backend_->setStretchFilter(Options::video.stretch_filter_linear);
|
||||||
shader_backend_->setStretch4_3(Options::video.aspect_ratio_4_3);
|
shader_backend_->setStretch4_3(Options::video.aspect_ratio_4_3);
|
||||||
shader_backend_->setLinearUpscale(Options::video.linear_upscale);
|
shader_backend_->setLinearUpscale(Options::video.linear_upscale);
|
||||||
@@ -203,6 +204,13 @@ void Screen::toggleIntegerScale() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Screen::toggleVSync() {
|
||||||
|
Options::video.vsync = !Options::video.vsync;
|
||||||
|
if (shader_backend_) {
|
||||||
|
shader_backend_->setVSync(Options::video.vsync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Screen::toggleStretchFilter() {
|
void Screen::toggleStretchFilter() {
|
||||||
Options::video.stretch_filter_linear = !Options::video.stretch_filter_linear;
|
Options::video.stretch_filter_linear = !Options::video.stretch_filter_linear;
|
||||||
if (shader_backend_) {
|
if (shader_backend_) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class Screen {
|
|||||||
void toggleSupersampling();
|
void toggleSupersampling();
|
||||||
void toggleAspectRatio();
|
void toggleAspectRatio();
|
||||||
void toggleIntegerScale();
|
void toggleIntegerScale();
|
||||||
|
void toggleVSync();
|
||||||
void toggleStretchFilter();
|
void toggleStretchFilter();
|
||||||
void nextShaderType(); // Cicla PostFX ↔ CrtPi (F7)
|
void nextShaderType(); // Cicla PostFX ↔ CrtPi (F7)
|
||||||
void prevShaderType(); // Cicla al revés
|
void prevShaderType(); // Cicla al revés
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace Defaults::Video {
|
|||||||
constexpr bool SHADER_ENABLED = false;
|
constexpr bool SHADER_ENABLED = false;
|
||||||
constexpr bool SUPERSAMPLING = false;
|
constexpr bool SUPERSAMPLING = false;
|
||||||
constexpr bool INTEGER_SCALE = true;
|
constexpr bool INTEGER_SCALE = true;
|
||||||
|
constexpr bool VSYNC = true;
|
||||||
constexpr bool ASPECT_RATIO_4_3 = true; // CRT original estira 200→240
|
constexpr bool ASPECT_RATIO_4_3 = true; // CRT original estira 200→240
|
||||||
constexpr bool STRETCH_FILTER_LINEAR = false; // Filtre per a l'estirament 4:3 (false=NEAREST)
|
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 int DOWNSCALE_ALGO = 1; // 0=bilinear, 1=Lanczos2, 2=Lanczos3
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ namespace Options {
|
|||||||
video.supersampling = node["supersampling"].get_value<bool>();
|
video.supersampling = node["supersampling"].get_value<bool>();
|
||||||
if (node.contains("integer_scale"))
|
if (node.contains("integer_scale"))
|
||||||
video.integer_scale = node["integer_scale"].get_value<bool>();
|
video.integer_scale = node["integer_scale"].get_value<bool>();
|
||||||
|
if (node.contains("vsync"))
|
||||||
|
video.vsync = node["vsync"].get_value<bool>();
|
||||||
if (node.contains("aspect_ratio_4_3"))
|
if (node.contains("aspect_ratio_4_3"))
|
||||||
video.aspect_ratio_4_3 = node["aspect_ratio_4_3"].get_value<bool>();
|
video.aspect_ratio_4_3 = node["aspect_ratio_4_3"].get_value<bool>();
|
||||||
if (node.contains("stretch_filter_linear"))
|
if (node.contains("stretch_filter_linear"))
|
||||||
@@ -220,6 +222,7 @@ namespace Options {
|
|||||||
file << " shader_enabled: " << (video.shader_enabled ? "true" : "false") << "\n";
|
file << " shader_enabled: " << (video.shader_enabled ? "true" : "false") << "\n";
|
||||||
file << " supersampling: " << (video.supersampling ? "true" : "false") << "\n";
|
file << " supersampling: " << (video.supersampling ? "true" : "false") << "\n";
|
||||||
file << " integer_scale: " << (video.integer_scale ? "true" : "false") << "\n";
|
file << " integer_scale: " << (video.integer_scale ? "true" : "false") << "\n";
|
||||||
|
file << " vsync: " << (video.vsync ? "true" : "false") << "\n";
|
||||||
file << " aspect_ratio_4_3: " << (video.aspect_ratio_4_3 ? "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 << " stretch_filter_linear: " << (video.stretch_filter_linear ? "true" : "false") << " # filtre 4:3: false=nearest, true=linear\n";
|
||||||
file << " downscale_algo: " << video.downscale_algo << " # 0=bilinear, 1=Lanczos2, 2=Lanczos3\n";
|
file << " downscale_algo: " << video.downscale_algo << " # 0=bilinear, 1=Lanczos2, 2=Lanczos3\n";
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace Options {
|
|||||||
bool shader_enabled{Defaults::Video::SHADER_ENABLED};
|
bool shader_enabled{Defaults::Video::SHADER_ENABLED};
|
||||||
bool supersampling{Defaults::Video::SUPERSAMPLING};
|
bool supersampling{Defaults::Video::SUPERSAMPLING};
|
||||||
bool integer_scale{Defaults::Video::INTEGER_SCALE};
|
bool integer_scale{Defaults::Video::INTEGER_SCALE};
|
||||||
|
bool vsync{Defaults::Video::VSYNC};
|
||||||
bool aspect_ratio_4_3{Defaults::Video::ASPECT_RATIO_4_3};
|
bool aspect_ratio_4_3{Defaults::Video::ASPECT_RATIO_4_3};
|
||||||
bool stretch_filter_linear{Defaults::Video::STRETCH_FILTER_LINEAR};
|
bool stretch_filter_linear{Defaults::Video::STRETCH_FILTER_LINEAR};
|
||||||
int downscale_algo{Defaults::Video::DOWNSCALE_ALGO};
|
int downscale_algo{Defaults::Video::DOWNSCALE_ALGO};
|
||||||
|
|||||||
Reference in New Issue
Block a user