diff --git a/dep/msvc/vsprops/QtCompile.props b/dep/msvc/vsprops/QtCompile.props index ccdd91241..93139b21e 100644 --- a/dep/msvc/vsprops/QtCompile.props +++ b/dep/msvc/vsprops/QtCompile.props @@ -18,6 +18,7 @@ $(IntDir) $(QtToolOutDir)moc_ $(BinaryOutputDir)translations\ + $(BinaryOutputDir)resources\ d $(QtDebugSuffix) QtPlugins @@ -41,18 +42,18 @@ + Outputs="@(ResFiles->'$(QtRccOutDir)%(Filename).rcc')"> - - + + - + diff --git a/src/duckstation-qt/CMakeLists.txt b/src/duckstation-qt/CMakeLists.txt index f4ee00202..74500cb2c 100644 --- a/src/duckstation-qt/CMakeLists.txt +++ b/src/duckstation-qt/CMakeLists.txt @@ -3,11 +3,9 @@ find_package(Qt6 6.7.2 COMPONENTS Core Gui Widgets LinguistTools REQUIRED) include(CopyBaseTranslations) set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(SRCS - resources/resources.qrc aboutdialog.cpp aboutdialog.h aboutdialog.ui @@ -253,6 +251,20 @@ elseif(APPLE) set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/DuckStation.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) endif() +# Compile qrc to a binary file. +if(NOT APPLE) + set(RCC_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/duckstation-qt.rcc") + qt_add_binary_resources(duckstation-qt-rcc resources/duckstation-qt.qrc DESTINATION ${RCC_FILE} OPTIONS -no-compress) + add_dependencies(duckstation-qt duckstation-qt-rcc) +else() + set(RCC_FILE "${CMAKE_CURRENT_BINARY_DIR}/duckstation-qt.rcc") + qt_add_binary_resources(duckstation-qt-rcc resources/duckstation-qt.qrc DESTINATION ${RCC_FILE} OPTIONS -no-compress) + add_dependencies(duckstation-qt duckstation-qt-rcc) + target_sources(duckstation-qt PRIVATE ${RCC_FILE}) + set_source_files_properties(${RCC_FILE} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) +endif() + + # Translation setup. qt_add_lrelease(duckstation-qt TS_FILES ${TS_FILES} QM_FILES_OUTPUT_VARIABLE QM_FILES) if(NOT APPLE) diff --git a/src/duckstation-qt/duckstation-qt.vcxproj b/src/duckstation-qt/duckstation-qt.vcxproj index 8f05fc0b9..6e1d5a3f7 100644 --- a/src/duckstation-qt/duckstation-qt.vcxproj +++ b/src/duckstation-qt/duckstation-qt.vcxproj @@ -211,7 +211,7 @@ - + Document @@ -259,7 +259,6 @@ - diff --git a/src/duckstation-qt/duckstation-qt.vcxproj.filters b/src/duckstation-qt/duckstation-qt.vcxproj.filters index c4459a40b..5c9708a41 100644 --- a/src/duckstation-qt/duckstation-qt.vcxproj.filters +++ b/src/duckstation-qt/duckstation-qt.vcxproj.filters @@ -17,7 +17,6 @@ - @@ -300,7 +299,7 @@ - + resources diff --git a/src/duckstation-qt/qthost.cpp b/src/duckstation-qt/qthost.cpp index 307170a1b..09fc65fd6 100644 --- a/src/duckstation-qt/qthost.cpp +++ b/src/duckstation-qt/qthost.cpp @@ -479,10 +479,12 @@ bool QtHost::SetCriticalFolders() CrashHandler::SetWriteDirectory(EmuFolders::DataRoot); // the resources directory should exist, bail out if not - if (!FileSystem::DirectoryExists(EmuFolders::Resources.c_str())) + const std::string rcc_path = Path::Combine(EmuFolders::Resources, "duckstation-qt.rcc"); + if (!FileSystem::DirectoryExists(EmuFolders::Resources.c_str()) || !FileSystem::FileExists(rcc_path.c_str()) || + !QResource::registerResource(QString::fromStdString(rcc_path))) { QMessageBox::critical(nullptr, QStringLiteral("Error"), - QStringLiteral("Resources directory is missing, your installation is incomplete.")); + QStringLiteral("Resources are missing, your installation is incomplete.")); return false; } @@ -2415,7 +2417,7 @@ bool QtHost::ParseCommandLineParametersAndInitializeConfig(QApplication& app, } // To do anything useful, we need the config initialized. - if (!QtHost::InitializeConfig(std::move(settings_filename))) + if (!InitializeConfig(std::move(settings_filename))) { // NOTE: No point translating this, because no config means the language won't be loaded anyway. QMessageBox::critical(nullptr, QStringLiteral("Error"), QStringLiteral("Failed to initialize config.")); diff --git a/src/duckstation-qt/resources/resources.qrc b/src/duckstation-qt/resources/duckstation-qt.qrc similarity index 100% rename from src/duckstation-qt/resources/resources.qrc rename to src/duckstation-qt/resources/duckstation-qt.qrc