diff options
Diffstat (limited to '')
-rw-r--r-- | .ci/scripts/windows/install-vulkan-sdk.ps1 | 33 | ||||
-rw-r--r-- | .ci/templates/build-msvc.yml | 9 | ||||
-rw-r--r-- | .github/workflows/android-build.yml | 1 | ||||
-rw-r--r-- | .github/workflows/verify.yml | 30 | ||||
-rw-r--r-- | CMakeLists.txt | 4 | ||||
m--------- | externals/SDL | 0 | ||||
m--------- | externals/Vulkan-Headers | 0 | ||||
-rw-r--r-- | src/android/app/src/main/AndroidManifest.xml | 1 | ||||
-rw-r--r-- | src/core/file_sys/vfs_real.cpp | 3 | ||||
-rw-r--r-- | src/core/hid/emulated_controller.cpp | 12 | ||||
-rw-r--r-- | src/core/hid/emulated_controller.h | 8 | ||||
-rw-r--r-- | src/core/hle/service/nfc/common/device.cpp | 32 | ||||
-rw-r--r-- | src/input_common/drivers/mouse.cpp | 5 | ||||
-rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 4 | ||||
-rw-r--r-- | src/video_core/vulkan_common/vulkan_memory_allocator.cpp | 4 | ||||
-rw-r--r-- | src/yuzu/main.cpp | 10 |
16 files changed, 118 insertions, 38 deletions
diff --git a/.ci/scripts/windows/install-vulkan-sdk.ps1 b/.ci/scripts/windows/install-vulkan-sdk.ps1 new file mode 100644 index 000000000..de218d90a --- /dev/null +++ b/.ci/scripts/windows/install-vulkan-sdk.ps1 @@ -0,0 +1,33 @@ +# SPDX-FileCopyrightText: 2023 yuzu Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + +$ErrorActionPreference = "Stop" + +$VulkanSDKVer = "1.3.250.1" +$ExeFile = "VulkanSDK-$VulkanSDKVer-Installer.exe" +$Uri = "https://sdk.lunarg.com/sdk/download/$VulkanSDKVer/windows/$ExeFile" +$Destination = "./$ExeFile" + +echo "Downloading Vulkan SDK $VulkanSDKVer from $Uri" +$WebClient = New-Object System.Net.WebClient +$WebClient.DownloadFile($Uri, $Destination) +echo "Finished downloading $ExeFile" + +$VULKAN_SDK = "C:/VulkanSDK/$VulkanSDKVer" +$Arguments = "--root `"$VULKAN_SDK`" --accept-licenses --default-answer --confirm-command install" + +echo "Installing Vulkan SDK $VulkanSDKVer" +$InstallProcess = Start-Process -FilePath $Destination -NoNewWindow -PassThru -Wait -ArgumentList $Arguments +$ExitCode = $InstallProcess.ExitCode + +if ($ExitCode -ne 0) { + echo "Error installing Vulkan SDK $VulkanSDKVer (Error: $ExitCode)" + Exit $ExitCode +} + +echo "Finished installing Vulkan SDK $VulkanSDKVer" + +if ("$env:GITHUB_ACTIONS" -eq "true") { + echo "VULKAN_SDK=$VULKAN_SDK" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "$VULKAN_SDK/Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append +} diff --git a/.ci/templates/build-msvc.yml b/.ci/templates/build-msvc.yml index ceb7e0c32..d069fa9c3 100644 --- a/.ci/templates/build-msvc.yml +++ b/.ci/templates/build-msvc.yml @@ -7,9 +7,12 @@ parameters: version: '' steps: -- script: choco install vulkan-sdk - displayName: 'Install vulkan-sdk' -- script: refreshenv && mkdir build && cd build && cmake -E env CXXFLAGS="/Gw /GA /Gr /Ob2" cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DYUZU_ENABLE_LTO=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_CRASH_DUMPS=ON .. && cd .. +- task: Powershell@2 + displayName: 'Install Vulkan SDK' + inputs: + targetType: 'filePath' + filePath: './.ci/scripts/windows/install-vulkan-sdk.ps1' +- script: refreshenv && glslangValidator --version && mkdir build && cd build && cmake -E env CXXFLAGS="/Gw /GA /Gr /Ob2" cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_POLICY_DEFAULT_CMP0069=NEW -DYUZU_ENABLE_LTO=ON -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DYUZU_TESTS=OFF -DUSE_DISCORD_PRESENCE=ON -DENABLE_QT_TRANSLATION=ON -DDISPLAY_VERSION=${{ parameters['version'] }} -DCMAKE_BUILD_TYPE=Release -DYUZU_CRASH_DUMPS=ON .. && cd .. displayName: 'Configure CMake' - task: MSBuild@1 displayName: 'Build' diff --git a/.github/workflows/android-build.yml b/.github/workflows/android-build.yml index e639e965a..5893f860e 100644 --- a/.github/workflows/android-build.yml +++ b/.github/workflows/android-build.yml @@ -10,6 +10,7 @@ on: jobs: android: runs-on: ubuntu-latest + if: ${{ github.repository == 'yuzu-emu/yuzu-android' }} steps: - uses: actions/checkout@v3 with: diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index b5d338199..cbe6b0fbd 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -73,6 +73,10 @@ jobs: needs: format runs-on: windows-2022 steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + fetch-depth: 0 - name: Set up cache uses: actions/cache@v3 with: @@ -81,22 +85,22 @@ jobs: restore-keys: | ${{ runner.os }}-msvc- - name: Install dependencies - # due to how chocolatey works, only cmd.exe is supported here - shell: cmd + shell: pwsh run: | - choco install vulkan-sdk wget - call refreshenv - wget https://github.com/mbitsnbites/buildcache/releases/download/v0.27.6/buildcache-windows.zip - 7z x buildcache-windows.zip - copy buildcache\bin\buildcache.exe C:\ProgramData\chocolatey\bin - rmdir buildcache - echo %PATH% >> %GITHUB_PATH% + $ErrorActionPreference = "Stop" + $BuildCacheVer = "v0.28.4" + $File = "buildcache-windows.zip" + $Uri = "https://github.com/mbitsnbites/buildcache/releases/download/$BuildCacheVer/$File" + $WebClient = New-Object System.Net.WebClient + $WebClient.DownloadFile($Uri, $File) + 7z x $File + $CurrentDir = Convert-Path . + echo "$CurrentDir/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - name: Install Vulkan SDK + shell: pwsh + run: .\.ci\scripts\windows\install-vulkan-sdk.ps1 - name: Set up MSVC uses: ilammy/msvc-dev-cmd@v1 - - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 0 - name: Configure env: CC: cl.exe diff --git a/CMakeLists.txt b/CMakeLists.txt index f5ef0ef50..7f8febb90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -285,7 +285,7 @@ find_package(ZLIB 1.2 REQUIRED) find_package(zstd 1.5 REQUIRED) if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS) - find_package(Vulkan 1.3.246 REQUIRED) + find_package(Vulkan 1.3.256 REQUIRED) endif() if (ENABLE_LIBUSB) @@ -489,7 +489,7 @@ if (ENABLE_SDL2) if (YUZU_USE_BUNDLED_SDL2) # Detect toolchain and platform if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) - set(SDL2_VER "SDL2-2.28.0") + set(SDL2_VER "SDL2-2.28.1") else() message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") endif() diff --git a/externals/SDL b/externals/SDL -Subproject 491fba1d06a4810645092b2559b9cc94abeb23b +Subproject 116a5344ff4e8b8166eac2db540cd6578b4ba02 diff --git a/externals/Vulkan-Headers b/externals/Vulkan-Headers -Subproject 63af1cf1ee906ba4dcd5a324bdd0201d4f4bfd1 +Subproject ed857118e243fdc0f3a100f00ac9919e874cfe6 diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index 51d949d65..742685fb0 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -54,6 +54,7 @@ SPDX-License-Identifier: GPL-3.0-or-later <activity android:name="org.yuzu.yuzu_emu.activities.EmulationActivity" android:theme="@style/Theme.Yuzu.Main" + android:launchMode="singleTop" android:screenOrientation="userLandscape" android:supportsPictureInPicture="true" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|uiMode" diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index b0515ec05..1c706e4d8 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -283,7 +283,8 @@ std::size_t RealVfsFile::GetSize() const { if (size) { return *size; } - return FS::GetSize(path); + auto lk = base.RefreshReference(path, perms, *reference); + return reference->file ? reference->file->GetSize() : 0; } bool RealVfsFile::Resize(std::size_t new_size) { diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 1ebc32c1e..94bd656fe 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -1243,10 +1243,12 @@ Common::Input::DriverResult EmulatedController::SetPollingMode( auto& nfc_output_device = output_devices[3]; if (device_index == EmulatedDeviceIndex::LeftIndex) { + controller.left_polling_mode = polling_mode; return left_output_device->SetPollingMode(polling_mode); } if (device_index == EmulatedDeviceIndex::RightIndex) { + controller.right_polling_mode = polling_mode; const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode); const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode); @@ -1261,12 +1263,22 @@ Common::Input::DriverResult EmulatedController::SetPollingMode( return mapped_nfc_result; } + controller.left_polling_mode = polling_mode; + controller.right_polling_mode = polling_mode; left_output_device->SetPollingMode(polling_mode); right_output_device->SetPollingMode(polling_mode); nfc_output_device->SetPollingMode(polling_mode); return Common::Input::DriverResult::Success; } +Common::Input::PollingMode EmulatedController::GetPollingMode( + EmulatedDeviceIndex device_index) const { + if (device_index == EmulatedDeviceIndex::LeftIndex) { + return controller.left_polling_mode; + } + return controller.right_polling_mode; +} + bool EmulatedController::SetCameraFormat( Core::IrSensor::ImageTransferProcessorFormat camera_format) { LOG_INFO(Service_HID, "Set camera format {}", camera_format); diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h index d511e5fac..88d77db8d 100644 --- a/src/core/hid/emulated_controller.h +++ b/src/core/hid/emulated_controller.h @@ -143,6 +143,8 @@ struct ControllerStatus { CameraState camera_state{}; RingSensorForce ring_analog_state{}; NfcState nfc_state{}; + Common::Input::PollingMode left_polling_mode{}; + Common::Input::PollingMode right_polling_mode{}; }; enum class ControllerTriggerType { @@ -370,6 +372,12 @@ public: */ Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index, Common::Input::PollingMode polling_mode); + /** + * Get the current polling mode from a controller + * @param device_index index of the controller to set the polling mode + * @return current polling mode + */ + Common::Input::PollingMode GetPollingMode(EmulatedDeviceIndex device_index) const; /** * Sets the desired camera format to be polled from a controller diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp index 5bf289818..2d633b03f 100644 --- a/src/core/hle/service/nfc/common/device.cpp +++ b/src/core/hle/service/nfc/common/device.cpp @@ -66,10 +66,6 @@ NfcDevice::~NfcDevice() { }; void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { - if (!is_initalized) { - return; - } - if (type == Core::HID::ControllerTriggerType::Connected) { Initialize(); availability_change_event->Signal(); @@ -77,12 +73,12 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { } if (type == Core::HID::ControllerTriggerType::Disconnected) { - device_state = DeviceState::Unavailable; + Finalize(); availability_change_event->Signal(); return; } - if (type != Core::HID::ControllerTriggerType::Nfc) { + if (!is_initalized) { return; } @@ -90,6 +86,17 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { return; } + // Ensure nfc mode is always active + if (npad_device->GetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex) == + Common::Input::PollingMode::Active) { + npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex, + Common::Input::PollingMode::NFC); + } + + if (type != Core::HID::ControllerTriggerType::Nfc) { + return; + } + const auto nfc_status = npad_device->GetNfc(); switch (nfc_status.state) { case Common::Input::NfcState::NewAmiibo: @@ -207,11 +214,14 @@ void NfcDevice::Initialize() { } void NfcDevice::Finalize() { - if (device_state == DeviceState::TagMounted) { - Unmount(); - } - if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) { - StopDetection(); + if (npad_device->IsConnected()) { + if (device_state == DeviceState::TagMounted) { + Unmount(); + } + if (device_state == DeviceState::SearchingForTag || + device_state == DeviceState::TagRemoved) { + StopDetection(); + } } if (device_state != DeviceState::Unavailable) { diff --git a/src/input_common/drivers/mouse.cpp b/src/input_common/drivers/mouse.cpp index dac29c78f..9fb824baf 100644 --- a/src/input_common/drivers/mouse.cpp +++ b/src/input_common/drivers/mouse.cpp @@ -160,8 +160,9 @@ void Mouse::Move(int x, int y, int center_x, int center_y) { last_mouse_change.y += mouse_change.y * y_sensitivity; // Bind the mouse change to [0 <= deadzone_counterweight <= 1.0] - if (last_mouse_change.Length() < deadzone_counterweight) { - last_mouse_change /= last_mouse_change.Length(); + const float length = last_mouse_change.Length(); + if (length < deadzone_counterweight && length != 0.0f) { + last_mouse_change /= length; last_mouse_change *= deadzone_counterweight; } diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 79f158db4..3a859139c 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h @@ -598,6 +598,10 @@ void TextureCache<P>::UnmapGPUMemory(size_t as_id, GPUVAddr gpu_addr, size_t siz [&](ImageId id, Image&) { deleted_images.push_back(id); }); for (const ImageId id : deleted_images) { Image& image = slot_images[id]; + if (True(image.flags & ImageFlagBits::CpuModified)) { + continue; + } + image.flags |= ImageFlagBits::CpuModified; if (True(image.flags & ImageFlagBits::Remapped)) { continue; } diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp index a2ef0efa4..42f3ee0b4 100644 --- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp +++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp @@ -221,8 +221,8 @@ vk::Image MemoryAllocator::CreateImage(const VkImageCreateInfo& ci) const { const VmaAllocationCreateInfo alloc_ci = { .flags = VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT, .usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, - .requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, - .preferredFlags = 0, + .requiredFlags = 0, + .preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, .memoryTypeBits = 0, .pool = VK_NULL_HANDLE, .pUserData = nullptr, diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 20532416c..6cd557c29 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -178,6 +178,8 @@ constexpr int default_mouse_hide_timeout = 2500; constexpr int default_mouse_center_timeout = 10; constexpr int default_input_update_timeout = 1; +constexpr size_t CopyBufferSize = 1_MiB; + /** * "Callouts" are one-time instructional messages shown to the user. In the config settings, there * is a bitfield "callout_flags" options, used to track if a message has already been shown to the @@ -2929,10 +2931,10 @@ void GMainWindow::OnMenuInstallToNAND() { int remaining = filenames.size(); - // This would only overflow above 2^43 bytes (8.796 TB) + // This would only overflow above 2^51 bytes (2.252 PB) int total_size = 0; for (const QString& file : files) { - total_size += static_cast<int>(QFile(file).size() / 0x1000); + total_size += static_cast<int>(QFile(file).size() / CopyBufferSize); } if (total_size < 0) { LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting."); @@ -3032,7 +3034,7 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) { return false; } - std::vector<u8> buffer(1_MiB); + std::vector<u8> buffer(CopyBufferSize); for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (install_progress->wasCanceled()) { @@ -3088,7 +3090,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) { return false; } - std::array<u8, 0x1000> buffer{}; + std::vector<u8> buffer(CopyBufferSize); for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { if (install_progress->wasCanceled()) { |