From c8b21fa461f5f19ede0d4a6ef78930f270d7d688 Mon Sep 17 00:00:00 2001 From: BearOso Date: Mon, 7 Aug 2023 18:51:16 -0500 Subject: [PATCH] Qt: Portable mode. Fix hang on close. --- external/SPIRV-Cross | 2 +- external/glslang | 2 +- external/imgui/snes9x_imgui.cpp | 1 + qt/CMakeLists.txt | 5 +++++ qt/src/EmuApplication.cpp | 2 ++ qt/src/EmuConfig.cpp | 7 +++++++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/external/SPIRV-Cross b/external/SPIRV-Cross index 197a273f..4e2fdb25 160000 --- a/external/SPIRV-Cross +++ b/external/SPIRV-Cross @@ -1 +1 @@ -Subproject commit 197a273fd494321157f40a962c51b5fa8c9c3581 +Subproject commit 4e2fdb25671c742a9fbe93a6034eb1542244c7e1 diff --git a/external/glslang b/external/glslang index 9c7fd1a3..3ebb72cc 160000 --- a/external/glslang +++ b/external/glslang @@ -1 +1 @@ -Subproject commit 9c7fd1a33e5cecbe465e1cd70170167d5e40d398 +Subproject commit 3ebb72cc7429f0ab8218104dc3687c659c0f364d diff --git a/external/imgui/snes9x_imgui.cpp b/external/imgui/snes9x_imgui.cpp index 38cf7297..706614f1 100644 --- a/external/imgui/snes9x_imgui.cpp +++ b/external/imgui/snes9x_imgui.cpp @@ -297,6 +297,7 @@ void S9xImGuiInit(S9xImGuiInitInfo *init_info) } ImGui::CreateContext(); + ImGui::GetIO().IniFilename = nullptr; ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_NoMouse; ImGui::StyleColorsLight(); ImFontGlyphRangesBuilder builder; diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 1c453bbd..c1c6c0d9 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -11,6 +11,11 @@ set(CMAKE_AUTOUIC ON) set(CMAKE_AUTORCC ON) set(CMAKE_GLOBAL_AUTOGEN_TARGET ON) + +if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") +set(CMAKE_PREFIX_PATH "../external/qt6-mingw-clang-bin") +endif() + set(DEFINES SNES9X_QT) set(SNES9X_CORE_SOURCES ../fxinst.cpp diff --git a/qt/src/EmuApplication.cpp b/qt/src/EmuApplication.cpp index 871ecf10..123c1561 100644 --- a/qt/src/EmuApplication.cpp +++ b/qt/src/EmuApplication.cpp @@ -215,6 +215,8 @@ void EmuApplication::stopThread() { std::this_thread::yield(); } + + emu_thread = nullptr; } void EmuApplication::unpause() diff --git a/qt/src/EmuConfig.cpp b/qt/src/EmuConfig.cpp index 1627eb66..96ea2822 100644 --- a/qt/src/EmuConfig.cpp +++ b/qt/src/EmuConfig.cpp @@ -8,6 +8,8 @@ namespace fs = std::filesystem; #include "EmuBinding.hpp" #include #include +#include +#include static const char *shortcut_names[] = { @@ -142,6 +144,11 @@ std::string EmuConfig::findConfigDir() char *dir; fs::path path; + auto app_dir_path = QGuiApplication::applicationDirPath(); + auto config_file = QDir(app_dir_path).absoluteFilePath("snes9x.conf"); + if (QFile::exists(config_file)) + return app_dir_path.toStdString(); + #ifndef _WIN32 if ((dir = getenv("XDG_CONFIG_HOME"))) {