summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.ci/scripts/windows/install-vulkan-sdk.ps133
-rw-r--r--.ci/templates/build-msvc.yml9
-rw-r--r--.github/workflows/android-build.yml1
-rw-r--r--.github/workflows/verify.yml30
-rw-r--r--CMakeLists.txt4
m---------externals/SDL0
m---------externals/Vulkan-Headers0
-rw-r--r--src/android/app/src/main/AndroidManifest.xml1
-rw-r--r--src/core/file_sys/vfs_real.cpp3
-rw-r--r--src/core/hid/emulated_controller.cpp12
-rw-r--r--src/core/hid/emulated_controller.h8
-rw-r--r--src/core/hle/service/nfc/common/device.cpp32
-rw-r--r--src/input_common/drivers/mouse.cpp5
-rw-r--r--src/video_core/texture_cache/texture_cache.h4
-rw-r--r--src/video_core/vulkan_common/vulkan_memory_allocator.cpp4
-rw-r--r--src/yuzu/main.cpp10
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 @@
1# SPDX-FileCopyrightText: 2023 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-3.0-or-later
3
4$ErrorActionPreference = "Stop"
5
6$VulkanSDKVer = "1.3.250.1"
7$ExeFile = "VulkanSDK-$VulkanSDKVer-Installer.exe"
8$Uri = "https://sdk.lunarg.com/sdk/download/$VulkanSDKVer/windows/$ExeFile"
9$Destination = "./$ExeFile"
10
11echo "Downloading Vulkan SDK $VulkanSDKVer from $Uri"
12$WebClient = New-Object System.Net.WebClient
13$WebClient.DownloadFile($Uri, $Destination)
14echo "Finished downloading $ExeFile"
15
16$VULKAN_SDK = "C:/VulkanSDK/$VulkanSDKVer"
17$Arguments = "--root `"$VULKAN_SDK`" --accept-licenses --default-answer --confirm-command install"
18
19echo "Installing Vulkan SDK $VulkanSDKVer"
20$InstallProcess = Start-Process -FilePath $Destination -NoNewWindow -PassThru -Wait -ArgumentList $Arguments
21$ExitCode = $InstallProcess.ExitCode
22
23if ($ExitCode -ne 0) {
24 echo "Error installing Vulkan SDK $VulkanSDKVer (Error: $ExitCode)"
25 Exit $ExitCode
26}
27
28echo "Finished installing Vulkan SDK $VulkanSDKVer"
29
30if ("$env:GITHUB_ACTIONS" -eq "true") {
31 echo "VULKAN_SDK=$VULKAN_SDK" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
32 echo "$VULKAN_SDK/Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
33}
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:
7 version: '' 7 version: ''
8 8
9steps: 9steps:
10- script: choco install vulkan-sdk 10- task: Powershell@2
11 displayName: 'Install vulkan-sdk' 11 displayName: 'Install Vulkan SDK'
12- 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 .. 12 inputs:
13 targetType: 'filePath'
14 filePath: './.ci/scripts/windows/install-vulkan-sdk.ps1'
15- 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 ..
13 displayName: 'Configure CMake' 16 displayName: 'Configure CMake'
14- task: MSBuild@1 17- task: MSBuild@1
15 displayName: 'Build' 18 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:
10jobs: 10jobs:
11 android: 11 android:
12 runs-on: ubuntu-latest 12 runs-on: ubuntu-latest
13 if: ${{ github.repository == 'yuzu-emu/yuzu-android' }}
13 steps: 14 steps:
14 - uses: actions/checkout@v3 15 - uses: actions/checkout@v3
15 with: 16 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:
73 needs: format 73 needs: format
74 runs-on: windows-2022 74 runs-on: windows-2022
75 steps: 75 steps:
76 - uses: actions/checkout@v3
77 with:
78 submodules: recursive
79 fetch-depth: 0
76 - name: Set up cache 80 - name: Set up cache
77 uses: actions/cache@v3 81 uses: actions/cache@v3
78 with: 82 with:
@@ -81,22 +85,22 @@ jobs:
81 restore-keys: | 85 restore-keys: |
82 ${{ runner.os }}-msvc- 86 ${{ runner.os }}-msvc-
83 - name: Install dependencies 87 - name: Install dependencies
84 # due to how chocolatey works, only cmd.exe is supported here 88 shell: pwsh
85 shell: cmd
86 run: | 89 run: |
87 choco install vulkan-sdk wget 90 $ErrorActionPreference = "Stop"
88 call refreshenv 91 $BuildCacheVer = "v0.28.4"
89 wget https://github.com/mbitsnbites/buildcache/releases/download/v0.27.6/buildcache-windows.zip 92 $File = "buildcache-windows.zip"
90 7z x buildcache-windows.zip 93 $Uri = "https://github.com/mbitsnbites/buildcache/releases/download/$BuildCacheVer/$File"
91 copy buildcache\bin\buildcache.exe C:\ProgramData\chocolatey\bin 94 $WebClient = New-Object System.Net.WebClient
92 rmdir buildcache 95 $WebClient.DownloadFile($Uri, $File)
93 echo %PATH% >> %GITHUB_PATH% 96 7z x $File
97 $CurrentDir = Convert-Path .
98 echo "$CurrentDir/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
99 - name: Install Vulkan SDK
100 shell: pwsh
101 run: .\.ci\scripts\windows\install-vulkan-sdk.ps1
94 - name: Set up MSVC 102 - name: Set up MSVC
95 uses: ilammy/msvc-dev-cmd@v1 103 uses: ilammy/msvc-dev-cmd@v1
96 - uses: actions/checkout@v3
97 with:
98 submodules: recursive
99 fetch-depth: 0
100 - name: Configure 104 - name: Configure
101 env: 105 env:
102 CC: cl.exe 106 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)
285find_package(zstd 1.5 REQUIRED) 285find_package(zstd 1.5 REQUIRED)
286 286
287if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS) 287if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS)
288 find_package(Vulkan 1.3.246 REQUIRED) 288 find_package(Vulkan 1.3.256 REQUIRED)
289endif() 289endif()
290 290
291if (ENABLE_LIBUSB) 291if (ENABLE_LIBUSB)
@@ -489,7 +489,7 @@ if (ENABLE_SDL2)
489 if (YUZU_USE_BUNDLED_SDL2) 489 if (YUZU_USE_BUNDLED_SDL2)
490 # Detect toolchain and platform 490 # Detect toolchain and platform
491 if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64) 491 if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
492 set(SDL2_VER "SDL2-2.28.0") 492 set(SDL2_VER "SDL2-2.28.1")
493 else() 493 else()
494 message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.") 494 message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.")
495 endif() 495 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
54 <activity 54 <activity
55 android:name="org.yuzu.yuzu_emu.activities.EmulationActivity" 55 android:name="org.yuzu.yuzu_emu.activities.EmulationActivity"
56 android:theme="@style/Theme.Yuzu.Main" 56 android:theme="@style/Theme.Yuzu.Main"
57 android:launchMode="singleTop"
57 android:screenOrientation="userLandscape" 58 android:screenOrientation="userLandscape"
58 android:supportsPictureInPicture="true" 59 android:supportsPictureInPicture="true"
59 android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|uiMode" 60 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 {
283 if (size) { 283 if (size) {
284 return *size; 284 return *size;
285 } 285 }
286 return FS::GetSize(path); 286 auto lk = base.RefreshReference(path, perms, *reference);
287 return reference->file ? reference->file->GetSize() : 0;
287} 288}
288 289
289bool RealVfsFile::Resize(std::size_t new_size) { 290bool 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(
1243 auto& nfc_output_device = output_devices[3]; 1243 auto& nfc_output_device = output_devices[3];
1244 1244
1245 if (device_index == EmulatedDeviceIndex::LeftIndex) { 1245 if (device_index == EmulatedDeviceIndex::LeftIndex) {
1246 controller.left_polling_mode = polling_mode;
1246 return left_output_device->SetPollingMode(polling_mode); 1247 return left_output_device->SetPollingMode(polling_mode);
1247 } 1248 }
1248 1249
1249 if (device_index == EmulatedDeviceIndex::RightIndex) { 1250 if (device_index == EmulatedDeviceIndex::RightIndex) {
1251 controller.right_polling_mode = polling_mode;
1250 const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode); 1252 const auto virtual_nfc_result = nfc_output_device->SetPollingMode(polling_mode);
1251 const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode); 1253 const auto mapped_nfc_result = right_output_device->SetPollingMode(polling_mode);
1252 1254
@@ -1261,12 +1263,22 @@ Common::Input::DriverResult EmulatedController::SetPollingMode(
1261 return mapped_nfc_result; 1263 return mapped_nfc_result;
1262 } 1264 }
1263 1265
1266 controller.left_polling_mode = polling_mode;
1267 controller.right_polling_mode = polling_mode;
1264 left_output_device->SetPollingMode(polling_mode); 1268 left_output_device->SetPollingMode(polling_mode);
1265 right_output_device->SetPollingMode(polling_mode); 1269 right_output_device->SetPollingMode(polling_mode);
1266 nfc_output_device->SetPollingMode(polling_mode); 1270 nfc_output_device->SetPollingMode(polling_mode);
1267 return Common::Input::DriverResult::Success; 1271 return Common::Input::DriverResult::Success;
1268} 1272}
1269 1273
1274Common::Input::PollingMode EmulatedController::GetPollingMode(
1275 EmulatedDeviceIndex device_index) const {
1276 if (device_index == EmulatedDeviceIndex::LeftIndex) {
1277 return controller.left_polling_mode;
1278 }
1279 return controller.right_polling_mode;
1280}
1281
1270bool EmulatedController::SetCameraFormat( 1282bool EmulatedController::SetCameraFormat(
1271 Core::IrSensor::ImageTransferProcessorFormat camera_format) { 1283 Core::IrSensor::ImageTransferProcessorFormat camera_format) {
1272 LOG_INFO(Service_HID, "Set camera format {}", camera_format); 1284 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 {
143 CameraState camera_state{}; 143 CameraState camera_state{};
144 RingSensorForce ring_analog_state{}; 144 RingSensorForce ring_analog_state{};
145 NfcState nfc_state{}; 145 NfcState nfc_state{};
146 Common::Input::PollingMode left_polling_mode{};
147 Common::Input::PollingMode right_polling_mode{};
146}; 148};
147 149
148enum class ControllerTriggerType { 150enum class ControllerTriggerType {
@@ -370,6 +372,12 @@ public:
370 */ 372 */
371 Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index, 373 Common::Input::DriverResult SetPollingMode(EmulatedDeviceIndex device_index,
372 Common::Input::PollingMode polling_mode); 374 Common::Input::PollingMode polling_mode);
375 /**
376 * Get the current polling mode from a controller
377 * @param device_index index of the controller to set the polling mode
378 * @return current polling mode
379 */
380 Common::Input::PollingMode GetPollingMode(EmulatedDeviceIndex device_index) const;
373 381
374 /** 382 /**
375 * Sets the desired camera format to be polled from a controller 383 * 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() {
66}; 66};
67 67
68void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) { 68void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
69 if (!is_initalized) {
70 return;
71 }
72
73 if (type == Core::HID::ControllerTriggerType::Connected) { 69 if (type == Core::HID::ControllerTriggerType::Connected) {
74 Initialize(); 70 Initialize();
75 availability_change_event->Signal(); 71 availability_change_event->Signal();
@@ -77,12 +73,12 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
77 } 73 }
78 74
79 if (type == Core::HID::ControllerTriggerType::Disconnected) { 75 if (type == Core::HID::ControllerTriggerType::Disconnected) {
80 device_state = DeviceState::Unavailable; 76 Finalize();
81 availability_change_event->Signal(); 77 availability_change_event->Signal();
82 return; 78 return;
83 } 79 }
84 80
85 if (type != Core::HID::ControllerTriggerType::Nfc) { 81 if (!is_initalized) {
86 return; 82 return;
87 } 83 }
88 84
@@ -90,6 +86,17 @@ void NfcDevice::NpadUpdate(Core::HID::ControllerTriggerType type) {
90 return; 86 return;
91 } 87 }
92 88
89 // Ensure nfc mode is always active
90 if (npad_device->GetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex) ==
91 Common::Input::PollingMode::Active) {
92 npad_device->SetPollingMode(Core::HID::EmulatedDeviceIndex::RightIndex,
93 Common::Input::PollingMode::NFC);
94 }
95
96 if (type != Core::HID::ControllerTriggerType::Nfc) {
97 return;
98 }
99
93 const auto nfc_status = npad_device->GetNfc(); 100 const auto nfc_status = npad_device->GetNfc();
94 switch (nfc_status.state) { 101 switch (nfc_status.state) {
95 case Common::Input::NfcState::NewAmiibo: 102 case Common::Input::NfcState::NewAmiibo:
@@ -207,11 +214,14 @@ void NfcDevice::Initialize() {
207} 214}
208 215
209void NfcDevice::Finalize() { 216void NfcDevice::Finalize() {
210 if (device_state == DeviceState::TagMounted) { 217 if (npad_device->IsConnected()) {
211 Unmount(); 218 if (device_state == DeviceState::TagMounted) {
212 } 219 Unmount();
213 if (device_state == DeviceState::SearchingForTag || device_state == DeviceState::TagRemoved) { 220 }
214 StopDetection(); 221 if (device_state == DeviceState::SearchingForTag ||
222 device_state == DeviceState::TagRemoved) {
223 StopDetection();
224 }
215 } 225 }
216 226
217 if (device_state != DeviceState::Unavailable) { 227 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) {
160 last_mouse_change.y += mouse_change.y * y_sensitivity; 160 last_mouse_change.y += mouse_change.y * y_sensitivity;
161 161
162 // Bind the mouse change to [0 <= deadzone_counterweight <= 1.0] 162 // Bind the mouse change to [0 <= deadzone_counterweight <= 1.0]
163 if (last_mouse_change.Length() < deadzone_counterweight) { 163 const float length = last_mouse_change.Length();
164 last_mouse_change /= last_mouse_change.Length(); 164 if (length < deadzone_counterweight && length != 0.0f) {
165 last_mouse_change /= length;
165 last_mouse_change *= deadzone_counterweight; 166 last_mouse_change *= deadzone_counterweight;
166 } 167 }
167 168
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
598 [&](ImageId id, Image&) { deleted_images.push_back(id); }); 598 [&](ImageId id, Image&) { deleted_images.push_back(id); });
599 for (const ImageId id : deleted_images) { 599 for (const ImageId id : deleted_images) {
600 Image& image = slot_images[id]; 600 Image& image = slot_images[id];
601 if (True(image.flags & ImageFlagBits::CpuModified)) {
602 continue;
603 }
604 image.flags |= ImageFlagBits::CpuModified;
601 if (True(image.flags & ImageFlagBits::Remapped)) { 605 if (True(image.flags & ImageFlagBits::Remapped)) {
602 continue; 606 continue;
603 } 607 }
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 {
221 const VmaAllocationCreateInfo alloc_ci = { 221 const VmaAllocationCreateInfo alloc_ci = {
222 .flags = VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT, 222 .flags = VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT,
223 .usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE, 223 .usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE,
224 .requiredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, 224 .requiredFlags = 0,
225 .preferredFlags = 0, 225 .preferredFlags = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
226 .memoryTypeBits = 0, 226 .memoryTypeBits = 0,
227 .pool = VK_NULL_HANDLE, 227 .pool = VK_NULL_HANDLE,
228 .pUserData = nullptr, 228 .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;
178constexpr int default_mouse_center_timeout = 10; 178constexpr int default_mouse_center_timeout = 10;
179constexpr int default_input_update_timeout = 1; 179constexpr int default_input_update_timeout = 1;
180 180
181constexpr size_t CopyBufferSize = 1_MiB;
182
181/** 183/**
182 * "Callouts" are one-time instructional messages shown to the user. In the config settings, there 184 * "Callouts" are one-time instructional messages shown to the user. In the config settings, there
183 * is a bitfield "callout_flags" options, used to track if a message has already been shown to the 185 * 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() {
2929 2931
2930 int remaining = filenames.size(); 2932 int remaining = filenames.size();
2931 2933
2932 // This would only overflow above 2^43 bytes (8.796 TB) 2934 // This would only overflow above 2^51 bytes (2.252 PB)
2933 int total_size = 0; 2935 int total_size = 0;
2934 for (const QString& file : files) { 2936 for (const QString& file : files) {
2935 total_size += static_cast<int>(QFile(file).size() / 0x1000); 2937 total_size += static_cast<int>(QFile(file).size() / CopyBufferSize);
2936 } 2938 }
2937 if (total_size < 0) { 2939 if (total_size < 0) {
2938 LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting."); 2940 LOG_CRITICAL(Frontend, "Attempting to install too many files, aborting.");
@@ -3032,7 +3034,7 @@ InstallResult GMainWindow::InstallNSPXCI(const QString& filename) {
3032 return false; 3034 return false;
3033 } 3035 }
3034 3036
3035 std::vector<u8> buffer(1_MiB); 3037 std::vector<u8> buffer(CopyBufferSize);
3036 3038
3037 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { 3039 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
3038 if (install_progress->wasCanceled()) { 3040 if (install_progress->wasCanceled()) {
@@ -3088,7 +3090,7 @@ InstallResult GMainWindow::InstallNCA(const QString& filename) {
3088 return false; 3090 return false;
3089 } 3091 }
3090 3092
3091 std::array<u8, 0x1000> buffer{}; 3093 std::vector<u8> buffer(CopyBufferSize);
3092 3094
3093 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) { 3095 for (std::size_t i = 0; i < src->GetSize(); i += buffer.size()) {
3094 if (install_progress->wasCanceled()) { 3096 if (install_progress->wasCanceled()) {