2018-06-27 01:56:27 +00:00
|
|
|
auto Program::updateVideoDriver() -> void {
|
|
|
|
video = Video::create(settings["Video/Driver"].text());
|
|
|
|
video->setContext(presentation->viewport.handle());
|
|
|
|
video->setExclusive(false);
|
|
|
|
updateVideoBlocking();
|
|
|
|
updateVideoShader();
|
|
|
|
|
|
|
|
if(video->ready()) {
|
|
|
|
presentation->clearViewport();
|
|
|
|
updateVideoShader();
|
|
|
|
}
|
|
|
|
|
|
|
|
video->onUpdate([&](uint width, uint height) {
|
|
|
|
if(!emulator->loaded()) presentation->clearViewport();
|
|
|
|
});
|
|
|
|
|
|
|
|
settingsWindow->advanced.updateVideoDriver();
|
|
|
|
|
|
|
|
if(!video->ready()) {
|
|
|
|
MessageDialog({
|
|
|
|
"Error: failed to initialize [", settings["Video/Driver"].text(), "] video driver."
|
|
|
|
}).error();
|
|
|
|
settings["Video/Driver"].setValue("None");
|
|
|
|
return updateVideoDriver();
|
|
|
|
}
|
2018-07-08 04:58:27 +00:00
|
|
|
|
|
|
|
presentation->updateShaders();
|
2018-06-27 01:56:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::updateVideoBlocking() -> void {
|
|
|
|
video->setBlocking(settings["Video/Blocking"].boolean());
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::updateVideoShader() -> void {
|
|
|
|
if(settings["Video/Driver"].text() == "OpenGL"
|
|
|
|
&& settings["Video/Shader"].text() != "None"
|
|
|
|
&& settings["Video/Shader"].text() != "Blur"
|
|
|
|
) {
|
|
|
|
video->setSmooth(false);
|
|
|
|
video->setShader(settings["Video/Shader"].text());
|
|
|
|
} else {
|
|
|
|
video->setSmooth(settings["Video/Shader"].text() == "Blur");
|
|
|
|
video->setShader("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auto Program::updateVideoPalette() -> void {
|
|
|
|
emulator->set("Color Emulation", false);
|
|
|
|
double luminance = settings["Video/Luminance"].natural() / 100.0;
|
|
|
|
double saturation = settings["Video/Saturation"].natural() / 100.0;
|
|
|
|
double gamma = settings["Video/Gamma"].natural() / 100.0;
|
|
|
|
Emulator::video.setLuminance(luminance);
|
|
|
|
Emulator::video.setSaturation(saturation);
|
|
|
|
Emulator::video.setGamma(gamma);
|
|
|
|
Emulator::video.setPalette();
|
|
|
|
}
|