diff options
-rw-r--r-- | CMakeLists.txt | 42 | ||||
-rw-r--r-- | src/android/app/build.gradle.kts | 16 | ||||
-rw-r--r-- | src/android/app/src/main/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt | 25 | ||||
-rw-r--r-- | src/android/build.gradle.kts | 4 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 68 |
6 files changed, 62 insertions, 94 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2bef9d6ed..1108e5ae6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,6 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modul include(DownloadExternals) include(CMakeDependentOption) include(CTest) -include(FetchContent) # Set bundled sdl2/qt as dependent options. # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON @@ -99,47 +98,8 @@ if (ANDROID AND YUZU_DOWNLOAD_ANDROID_VVL) DESTINATION "${vvl_lib_path}") endif() -# On Android, fetch and compile libcxx before doing anything else if (ANDROID) set(CMAKE_SKIP_INSTALL_RULES ON) - set(LLVM_VERSION "15.0.6") - - # Note: even though libcxx and libcxxabi have separate releases on the project page, - # the separated releases cannot be compiled. Only in-tree builds work. Therefore we - # must fetch the source release for the entire llvm tree. - FetchContent_Declare(llvm - URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-project-${LLVM_VERSION}.src.tar.xz" - URL_HASH SHA256=9d53ad04dc60cb7b30e810faf64c5ab8157dadef46c8766f67f286238256ff92 - TLS_VERIFY TRUE - ) - FetchContent_MakeAvailable(llvm) - - # libcxx has support for most of the range library, but it's gated behind a flag: - add_compile_definitions(_LIBCPP_ENABLE_EXPERIMENTAL) - - # Disable standard header inclusion - set(ANDROID_STL "none") - - # libcxxabi - set(LIBCXXABI_INCLUDE_TESTS OFF) - set(LIBCXXABI_ENABLE_SHARED FALSE) - set(LIBCXXABI_ENABLE_STATIC TRUE) - set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXX_TARGET_INCLUDE_DIRECTORY}" CACHE STRING "" FORCE) - add_subdirectory("${llvm_SOURCE_DIR}/libcxxabi" "${llvm_BINARY_DIR}/libcxxabi") - link_libraries(cxxabi_static) - - # libcxx - set(LIBCXX_ABI_NAMESPACE "__ndk1" CACHE STRING "" FORCE) - set(LIBCXX_CXX_ABI "libcxxabi") - set(LIBCXX_INCLUDE_TESTS OFF) - set(LIBCXX_INCLUDE_BENCHMARKS OFF) - set(LIBCXX_INCLUDE_DOCS OFF) - set(LIBCXX_ENABLE_SHARED FALSE) - set(LIBCXX_ENABLE_STATIC TRUE) - set(LIBCXX_ENABLE_ASSERTIONS FALSE) - add_subdirectory("${llvm_SOURCE_DIR}/libcxx" "${llvm_BINARY_DIR}/libcxx") - set_target_properties(cxx-headers PROPERTIES INTERFACE_COMPILE_OPTIONS "-isystem${CMAKE_BINARY_DIR}/${LIBCXX_INSTALL_INCLUDE_DIR}") - link_libraries(cxx_static cxx-headers) endif() if (YUZU_USE_BUNDLED_VCPKG) @@ -329,7 +289,7 @@ find_package(Boost 1.79.0 REQUIRED context) find_package(enet 1.3 MODULE) find_package(fmt 9 REQUIRED) find_package(inih 52 MODULE COMPONENTS INIReader) -find_package(LLVM 17 MODULE COMPONENTS Demangle) +find_package(LLVM 17.0.2 MODULE COMPONENTS Demangle) find_package(lz4 REQUIRED) find_package(nlohmann_json 3.8 REQUIRED) find_package(Opus 1.3 MODULE) diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index 84a3308b7..ac43d84b7 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -27,7 +27,7 @@ android { namespace = "org.yuzu.yuzu_emu" compileSdkVersion = "android-34" - ndkVersion = "25.2.9519653" + ndkVersion = "26.1.10909125" buildFeatures { viewBinding = true @@ -203,23 +203,23 @@ ktlint { } dependencies { - implementation("androidx.core:core-ktx:1.10.1") + implementation("androidx.core:core-ktx:1.12.0") implementation("androidx.appcompat:appcompat:1.6.1") - implementation("androidx.recyclerview:recyclerview:1.3.0") + implementation("androidx.recyclerview:recyclerview:1.3.1") implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.fragment:fragment-ktx:1.6.0") + implementation("androidx.fragment:fragment-ktx:1.6.1") implementation("androidx.documentfile:documentfile:1.0.1") implementation("com.google.android.material:material:1.9.0") - implementation("androidx.preference:preference:1.2.0") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1") + implementation("androidx.preference:preference-ktx:1.2.1") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2") implementation("io.coil-kt:coil:2.2.2") implementation("androidx.core:core-splashscreen:1.0.1") implementation("androidx.window:window:1.2.0-beta03") implementation("org.ini4j:ini4j:0.5.4") implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0") - implementation("androidx.navigation:navigation-fragment-ktx:2.6.0") - implementation("androidx.navigation:navigation-ui-ktx:2.6.0") + implementation("androidx.navigation:navigation-fragment-ktx:2.7.4") + implementation("androidx.navigation:navigation-ui-ktx:2.7.4") implementation("info.debatty:java-string-similarity:2.0.0") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") } diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index 832c08e15..a67351727 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -28,7 +28,6 @@ SPDX-License-Identifier: GPL-3.0-or-later android:appCategory="game" android:localeConfig="@xml/locales_config" android:banner="@drawable/tv_banner" - android:extractNativeLibs="true" android:fullBackupContent="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules_api_31" android:enableOnBackInvokedCallback="true"> diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt index 10b1d3547..df21d74b2 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/DriverManagerFragment.kt @@ -26,6 +26,7 @@ import org.yuzu.yuzu_emu.model.DriverViewModel import org.yuzu.yuzu_emu.model.HomeViewModel import org.yuzu.yuzu_emu.utils.FileUtil import org.yuzu.yuzu_emu.utils.GpuDriverHelper +import java.io.File import java.io.IOException class DriverManagerFragment : Fragment() { @@ -154,29 +155,29 @@ class DriverManagerFragment : Fragment() { R.string.installing_driver, false ) { + val driverPath = + "${GpuDriverHelper.driverStoragePath}/${FileUtil.getFilename(result)}" + val driverFile = File(driverPath) + // Ignore file exceptions when a user selects an invalid zip try { - GpuDriverHelper.copyDriverToInternalStorage(result) + if (!GpuDriverHelper.copyDriverToInternalStorage(result)) { + throw IOException("Driver failed validation!") + } } catch (_: IOException) { + if (driverFile.exists()) { + driverFile.delete() + } return@newInstance getString(R.string.select_gpu_driver_error) } - val driverData = GpuDriverHelper.customDriverData - if (driverData.name == null) { - return@newInstance getString(R.string.select_gpu_driver_error) - } - + val driverData = GpuDriverHelper.getMetadataFromZip(driverFile) val driverInList = driverViewModel.driverList.value.firstOrNull { it.second == driverData } if (driverInList != null) { return@newInstance getString(R.string.driver_already_installed) } else { - driverViewModel.addDriver( - Pair( - "${GpuDriverHelper.driverStoragePath}/${FileUtil.getFilename(result)}", - driverData - ) - ) + driverViewModel.addDriver(Pair(driverPath, driverData)) driverViewModel.setNewDriverInstalled(true) } return@newInstance Any() diff --git a/src/android/build.gradle.kts b/src/android/build.gradle.kts index 80f370c16..51e559321 100644 --- a/src/android/build.gradle.kts +++ b/src/android/build.gradle.kts @@ -3,8 +3,8 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id("com.android.application") version "8.0.2" apply false - id("com.android.library") version "8.0.2" apply false + id("com.android.application") version "8.1.2" apply false + id("com.android.library") version "8.1.2" apply false id("org.jetbrains.kotlin.android") version "1.8.21" apply false } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 5427758c1..1a6b63856 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -67,6 +67,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #define QT_NO_OPENGL #include <QClipboard> #include <QDesktopServices> +#include <QDir> #include <QFile> #include <QFileDialog> #include <QInputDialog> @@ -76,6 +77,7 @@ static FileSys::VirtualFile VfsDirectoryCreateFileWrapper(const FileSys::Virtual #include <QPushButton> #include <QScreen> #include <QShortcut> +#include <QStandardPaths> #include <QStatusBar> #include <QString> #include <QSysInfo> @@ -2869,44 +2871,50 @@ void GMainWindow::OnGameListCreateShortcut(u64 program_id, const std::string& ga #endif // __linux__ std::filesystem::path target_directory{}; - // Determine target directory for shortcut -#if defined(WIN32) - const char* home = std::getenv("USERPROFILE"); -#else - const char* home = std::getenv("HOME"); -#endif - const std::filesystem::path home_path = (home == nullptr ? "~" : home); - const char* xdg_data_home = std::getenv("XDG_DATA_HOME"); - if (target == GameListShortcutTarget::Desktop) { - target_directory = home_path / "Desktop"; - if (!Common::FS::IsDir(target_directory)) { - QMessageBox::critical( - this, tr("Create Shortcut"), - tr("Cannot create shortcut on desktop. Path \"%1\" does not exist.") - .arg(QString::fromStdString(target_directory.generic_string())), - QMessageBox::StandardButton::Ok); - return; - } - } else if (target == GameListShortcutTarget::Applications) { - target_directory = (xdg_data_home == nullptr ? home_path / ".local/share" : xdg_data_home) / - "applications"; - if (!Common::FS::CreateDirs(target_directory)) { - QMessageBox::critical( - this, tr("Create Shortcut"), - tr("Cannot create shortcut in applications menu. Path \"%1\" " - "does not exist and cannot be created.") - .arg(QString::fromStdString(target_directory.generic_string())), - QMessageBox::StandardButton::Ok); - return; + switch (target) { + case GameListShortcutTarget::Desktop: { + const QString desktop_path = + QStandardPaths::writableLocation(QStandardPaths::DesktopLocation); + target_directory = desktop_path.toUtf8().toStdString(); + break; + } + case GameListShortcutTarget::Applications: { + const QString applications_path = + QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation); + if (applications_path.isEmpty()) { + const char* home = std::getenv("HOME"); + if (home != nullptr) { + target_directory = std::filesystem::path(home) / ".local/share/applications"; + } + } else { + target_directory = applications_path.toUtf8().toStdString(); } + break; + } + default: + return; + } + + const QDir dir(QString::fromStdString(target_directory.generic_string())); + if (!dir.exists()) { + QMessageBox::critical(this, tr("Create Shortcut"), + tr("Cannot create shortcut. Path \"%1\" does not exist.") + .arg(QString::fromStdString(target_directory.generic_string())), + QMessageBox::StandardButton::Ok); + return; } const std::string game_file_name = std::filesystem::path(game_path).filename().string(); // Determine full paths for icon and shortcut #if defined(__linux__) || defined(__FreeBSD__) + const char* home = std::getenv("HOME"); + const std::filesystem::path home_path = (home == nullptr ? "~" : home); + const char* xdg_data_home = std::getenv("XDG_DATA_HOME"); + std::filesystem::path system_icons_path = - (xdg_data_home == nullptr ? home_path / ".local/share/" : xdg_data_home) / + (xdg_data_home == nullptr ? home_path / ".local/share/" + : std::filesystem::path(xdg_data_home)) / "icons/hicolor/256x256"; if (!Common::FS::CreateDirs(system_icons_path)) { QMessageBox::critical( |