summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
8 files changed, 53 insertions, 16 deletions
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,