Gtk: Only adjust the numeric locale with file reads.

This commit is contained in:
BearOso 2023-03-21 16:47:39 -05:00
parent 13a5592ba6
commit e34097ecdf
2 changed files with 8 additions and 6 deletions

View File

@ -181,7 +181,7 @@ void S9xOpenGLDisplayDriver::update_texture_size(int width, int height)
bool S9xOpenGLDisplayDriver::load_shaders(const char *shader_file)
{
setlocale(LC_ALL, "C");
setlocale(LC_NUMERIC, "C");
std::string filename(shader_file);
auto endswith = [&](std::string ext) -> bool {
@ -202,14 +202,14 @@ bool S9xOpenGLDisplayDriver::load_shaders(const char *shader_file)
if (glsl_shader->param.size() > 0)
window->enable_widget("shader_parameters_item", true);
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "");
return true;
}
delete glsl_shader;
}
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "");
return false;
}

View File

@ -87,17 +87,17 @@ int S9xVulkanDisplayDriver::init()
if (!gui_config->shader_filename.empty() && gui_config->use_shaders)
{
shaderchain = std::make_unique<Vulkan::ShaderChain>(context.get());
setlocale(LC_ALL, "C");
setlocale(LC_NUMERIC, "C");
if (!shaderchain->load_shader_preset(gui_config->shader_filename))
{
fmt::print("Couldn't load shader preset file\n");
shaderchain = nullptr;
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "");
}
else
{
window->enable_widget("shader_parameters_item", true);
setlocale(LC_ALL, "");
setlocale(LC_NUMERIC, "");
return 0;
}
}
@ -165,8 +165,10 @@ void *S9xVulkanDisplayDriver::get_parameters()
void S9xVulkanDisplayDriver::save(const char *filename)
{
setlocale(LC_NUMERIC, "C");
if (shaderchain)
shaderchain->preset->save_to_file(filename);
setlocale(LC_NUMERIC, "");
}
bool S9xVulkanDisplayDriver::is_ready()