Fix OpenGL ImGui shutdown. Fix config folder on Windows.

This commit is contained in:
BearOso 2023-06-26 15:59:06 -05:00
parent 16da4c2d26
commit fa16fbace4
3 changed files with 23 additions and 2 deletions

View File

@ -332,6 +332,12 @@ void EmuCanvasOpenGL::paintEvent(QPaintEvent *event)
void EmuCanvasOpenGL::deinit()
{
shader_parameters_dialog.reset();
if (ImGui::GetCurrentContext())
{
ImGui_ImplOpenGL3_Shutdown();
ImGui::DestroyContext();
}
context.reset();
}

View File

@ -144,6 +144,7 @@ std::string EmuConfig::findConfigDir()
char *dir;
fs::path path;
#ifndef _WIN32
if ((dir = getenv("XDG_CONFIG_HOME")))
{
path = dir;
@ -158,9 +159,23 @@ std::string EmuConfig::findConfigDir()
{
path = "./.snes9x";
}
#else
if ((dir = getenv("LOCALAPPDATA")))
{
path = dir;
path /= "Snes9x";
}
else if ((dir = getenv("APPDATA")))
{
path = dir;
path /= "Snes9x";
}
else
path = "snes9x";
#endif
if (!fs::exists(path))
fs::create_directory(path);
fs::create_directories(path);
return path.string();
}

View File

@ -408,7 +408,7 @@ std::string S9xGetDirectory(s9x_getdirtype dirtype)
if (!fs::exists(path))
{
fs::create_directory(path);
fs::create_directories(path);
}
else if ((fs::status(path).permissions() & fs::perms::owner_write) == fs::perms::none)
{