summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/hid/controllers/npad.cpp4
-rw-r--r--src/core/hle/service/hid/controllers/npad.h4
-rw-r--r--src/core/hle/service/hid/hid.cpp20
-rw-r--r--src/input_common/helpers/joycon_protocol/joycon_types.h1
-rw-r--r--src/input_common/helpers/joycon_protocol/nfc.cpp10
-rw-r--r--src/input_common/helpers/joycon_protocol/nfc.h6
-rw-r--r--src/video_core/host1x/codecs/h264.cpp4
-rw-r--r--src/video_core/vulkan_common/vulkan_device.cpp2
-rw-r--r--src/video_core/vulkan_common/vulkan_memory_allocator.cpp2
9 files changed, 32 insertions, 21 deletions
diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp
index ef4aec4ea..28818c813 100644
--- a/src/core/hle/service/hid/controllers/npad.cpp
+++ b/src/core/hle/service/hid/controllers/npad.cpp
@@ -979,8 +979,8 @@ void Controller_NPad::VibrateController(
979} 979}
980 980
981void Controller_NPad::VibrateControllers( 981void Controller_NPad::VibrateControllers(
982 const std::vector<Core::HID::VibrationDeviceHandle>& vibration_device_handles, 982 std::span<const Core::HID::VibrationDeviceHandle> vibration_device_handles,
983 const std::vector<Core::HID::VibrationValue>& vibration_values) { 983 std::span<const Core::HID::VibrationValue> vibration_values) {
984 if (!Settings::values.vibration_enabled.GetValue() && !permit_vibration_session_enabled) { 984 if (!Settings::values.vibration_enabled.GetValue() && !permit_vibration_session_enabled) {
985 return; 985 return;
986 } 986 }
diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h
index 9cfe298f1..776411261 100644
--- a/src/core/hle/service/hid/controllers/npad.h
+++ b/src/core/hle/service/hid/controllers/npad.h
@@ -112,8 +112,8 @@ public:
112 const Core::HID::VibrationValue& vibration_value); 112 const Core::HID::VibrationValue& vibration_value);
113 113
114 void VibrateControllers( 114 void VibrateControllers(
115 const std::vector<Core::HID::VibrationDeviceHandle>& vibration_device_handles, 115 std::span<const Core::HID::VibrationDeviceHandle> vibration_device_handles,
116 const std::vector<Core::HID::VibrationValue>& vibration_values); 116 std::span<const Core::HID::VibrationValue> vibration_values);
117 117
118 Core::HID::VibrationValue GetLastVibration( 118 Core::HID::VibrationValue GetLastVibration(
119 const Core::HID::VibrationDeviceHandle& vibration_device_handle) const; 119 const Core::HID::VibrationDeviceHandle& vibration_device_handle) const;
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 87e7b864a..2bf1d8a27 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -1601,16 +1601,16 @@ void Hid::SendVibrationValues(HLERequestContext& ctx) {
1601 IPC::RequestParser rp{ctx}; 1601 IPC::RequestParser rp{ctx};
1602 const auto applet_resource_user_id{rp.Pop<u64>()}; 1602 const auto applet_resource_user_id{rp.Pop<u64>()};
1603 1603
1604 const auto handles = ctx.ReadBuffer(0); 1604 const auto handle_data = ctx.ReadBuffer(0);
1605 const auto vibrations = ctx.ReadBuffer(1); 1605 const auto handle_count = ctx.GetReadBufferNumElements<Core::HID::VibrationDeviceHandle>(0);
1606 1606 const auto vibration_data = ctx.ReadBuffer(1);
1607 std::vector<Core::HID::VibrationDeviceHandle> vibration_device_handles( 1607 const auto vibration_count = ctx.GetReadBufferNumElements<Core::HID::VibrationValue>(1);
1608 handles.size() / sizeof(Core::HID::VibrationDeviceHandle)); 1608
1609 std::vector<Core::HID::VibrationValue> vibration_values(vibrations.size() / 1609 auto vibration_device_handles =
1610 sizeof(Core::HID::VibrationValue)); 1610 std::span(reinterpret_cast<const Core::HID::VibrationDeviceHandle*>(handle_data.data()),
1611 1611 handle_count);
1612 std::memcpy(vibration_device_handles.data(), handles.data(), handles.size()); 1612 auto vibration_values = std::span(
1613 std::memcpy(vibration_values.data(), vibrations.data(), vibrations.size()); 1613 reinterpret_cast<const Core::HID::VibrationValue*>(vibration_data.data()), vibration_count);
1614 1614
1615 applet_resource->GetController<Controller_NPad>(HidController::NPad) 1615 applet_resource->GetController<Controller_NPad>(HidController::NPad)
1616 .VibrateControllers(vibration_device_handles, vibration_values); 1616 .VibrateControllers(vibration_device_handles, vibration_values);
diff --git a/src/input_common/helpers/joycon_protocol/joycon_types.h b/src/input_common/helpers/joycon_protocol/joycon_types.h
index b03143e04..1c8d294b0 100644
--- a/src/input_common/helpers/joycon_protocol/joycon_types.h
+++ b/src/input_common/helpers/joycon_protocol/joycon_types.h
@@ -394,6 +394,7 @@ enum class DriverResult {
394 InvalidHandle, 394 InvalidHandle,
395 NotSupported, 395 NotSupported,
396 Disabled, 396 Disabled,
397 Delayed,
397 Unknown, 398 Unknown,
398}; 399};
399 400
diff --git a/src/input_common/helpers/joycon_protocol/nfc.cpp b/src/input_common/helpers/joycon_protocol/nfc.cpp
index 77ea6d5cf..14818ae33 100644
--- a/src/input_common/helpers/joycon_protocol/nfc.cpp
+++ b/src/input_common/helpers/joycon_protocol/nfc.cpp
@@ -72,6 +72,11 @@ DriverResult NfcProtocol::StartNFCPollingMode() {
72} 72}
73 73
74DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) { 74DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) {
75 if (update_counter++ < AMIIBO_UPDATE_DELAY) {
76 return DriverResult::Delayed;
77 }
78 update_counter = 0;
79
75 LOG_DEBUG(Input, "Start NFC pooling Mode"); 80 LOG_DEBUG(Input, "Start NFC pooling Mode");
76 ScopedSetBlocking sb(this); 81 ScopedSetBlocking sb(this);
77 DriverResult result{DriverResult::Success}; 82 DriverResult result{DriverResult::Success};
@@ -87,7 +92,7 @@ DriverResult NfcProtocol::ScanAmiibo(std::vector<u8>& data) {
87 result = WaitUntilNfcIsReady(); 92 result = WaitUntilNfcIsReady();
88 } 93 }
89 if (result == DriverResult::Success) { 94 if (result == DriverResult::Success) {
90 result = StartPolling(tag_data); 95 result = StartPolling(tag_data, 7);
91 } 96 }
92 if (result == DriverResult::Success) { 97 if (result == DriverResult::Success) {
93 result = GetAmiiboData(data); 98 result = GetAmiiboData(data);
@@ -129,9 +134,8 @@ DriverResult NfcProtocol::WaitUntilNfcIsReady() {
129 return DriverResult::Success; 134 return DriverResult::Success;
130} 135}
131 136
132DriverResult NfcProtocol::StartPolling(TagFoundData& data) { 137DriverResult NfcProtocol::StartPolling(TagFoundData& data, std::size_t timeout_limit) {
133 LOG_DEBUG(Input, "Start Polling for tag"); 138 LOG_DEBUG(Input, "Start Polling for tag");
134 constexpr std::size_t timeout_limit = 7;
135 MCUCommandResponse output{}; 139 MCUCommandResponse output{};
136 std::size_t tries = 0; 140 std::size_t tries = 0;
137 141
diff --git a/src/input_common/helpers/joycon_protocol/nfc.h b/src/input_common/helpers/joycon_protocol/nfc.h
index 11e263e07..4cb992d1d 100644
--- a/src/input_common/helpers/joycon_protocol/nfc.h
+++ b/src/input_common/helpers/joycon_protocol/nfc.h
@@ -32,6 +32,9 @@ public:
32 bool IsEnabled() const; 32 bool IsEnabled() const;
33 33
34private: 34private:
35 // Number of times the function will be delayed until it outputs valid data
36 static constexpr std::size_t AMIIBO_UPDATE_DELAY = 15;
37
35 struct TagFoundData { 38 struct TagFoundData {
36 u8 type; 39 u8 type;
37 std::vector<u8> uuid; 40 std::vector<u8> uuid;
@@ -39,7 +42,7 @@ private:
39 42
40 DriverResult WaitUntilNfcIsReady(); 43 DriverResult WaitUntilNfcIsReady();
41 44
42 DriverResult StartPolling(TagFoundData& data); 45 DriverResult StartPolling(TagFoundData& data, std::size_t timeout_limit = 1);
43 46
44 DriverResult ReadTag(const TagFoundData& data); 47 DriverResult ReadTag(const TagFoundData& data);
45 48
@@ -56,6 +59,7 @@ private:
56 NFCReadBlockCommand GetReadBlockCommand(NFCPages pages) const; 59 NFCReadBlockCommand GetReadBlockCommand(NFCPages pages) const;
57 60
58 bool is_enabled{}; 61 bool is_enabled{};
62 std::size_t update_counter{};
59}; 63};
60 64
61} // namespace InputCommon::Joycon 65} // namespace InputCommon::Joycon
diff --git a/src/video_core/host1x/codecs/h264.cpp b/src/video_core/host1x/codecs/h264.cpp
index e87bd65fa..6ce179167 100644
--- a/src/video_core/host1x/codecs/h264.cpp
+++ b/src/video_core/host1x/codecs/h264.cpp
@@ -111,7 +111,7 @@ const std::vector<u8>& H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegist
111 writer.WriteUe(0); 111 writer.WriteUe(0);
112 112
113 writer.WriteBit(context.h264_parameter_set.entropy_coding_mode_flag != 0); 113 writer.WriteBit(context.h264_parameter_set.entropy_coding_mode_flag != 0);
114 writer.WriteBit(false); 114 writer.WriteBit(context.h264_parameter_set.pic_order_present_flag != 0);
115 writer.WriteUe(0); 115 writer.WriteUe(0);
116 writer.WriteUe(context.h264_parameter_set.num_refidx_l0_default_active); 116 writer.WriteUe(context.h264_parameter_set.num_refidx_l0_default_active);
117 writer.WriteUe(context.h264_parameter_set.num_refidx_l1_default_active); 117 writer.WriteUe(context.h264_parameter_set.num_refidx_l1_default_active);
@@ -129,7 +129,7 @@ const std::vector<u8>& H264::ComposeFrame(const Host1x::NvdecCommon::NvdecRegist
129 writer.WriteBit(context.h264_parameter_set.redundant_pic_cnt_present_flag != 0); 129 writer.WriteBit(context.h264_parameter_set.redundant_pic_cnt_present_flag != 0);
130 writer.WriteBit(context.h264_parameter_set.transform_8x8_mode_flag != 0); 130 writer.WriteBit(context.h264_parameter_set.transform_8x8_mode_flag != 0);
131 131
132 writer.WriteBit(true); 132 writer.WriteBit(true); // pic_scaling_matrix_present_flag
133 133
134 for (s32 index = 0; index < 6; index++) { 134 for (s32 index = 0; index < 6; index++) {
135 writer.WriteBit(true); 135 writer.WriteBit(true);
diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp
index 6ffca2af2..161f050b8 100644
--- a/src/video_core/vulkan_common/vulkan_device.cpp
+++ b/src/video_core/vulkan_common/vulkan_device.cpp
@@ -1009,6 +1009,8 @@ void Device::CollectPhysicalMemoryInfo() {
1009 device_access_memory += mem_properties.memoryHeaps[element].size; 1009 device_access_memory += mem_properties.memoryHeaps[element].size;
1010 } 1010 }
1011 if (!is_integrated) { 1011 if (!is_integrated) {
1012 const u64 reserve_memory = std::min<u64>(device_access_memory / 8, 1_GiB);
1013 device_access_memory -= reserve_memory;
1012 return; 1014 return;
1013 } 1015 }
1014 const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage); 1016 const s64 available_memory = static_cast<s64>(device_access_memory - device_initial_usage);
diff --git a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
index 1732866e0..e28a556f8 100644
--- a/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
+++ b/src/video_core/vulkan_common/vulkan_memory_allocator.cpp
@@ -147,7 +147,7 @@ public:
147 147
148 /// Returns whether this allocation is compatible with the arguments. 148 /// Returns whether this allocation is compatible with the arguments.
149 [[nodiscard]] bool IsCompatible(VkMemoryPropertyFlags flags, u32 type_mask) const { 149 [[nodiscard]] bool IsCompatible(VkMemoryPropertyFlags flags, u32 type_mask) const {
150 return (flags & property_flags) == property_flags && (type_mask & shifted_memory_type) != 0; 150 return (flags & property_flags) == flags && (type_mask & shifted_memory_type) != 0;
151 } 151 }
152 152
153private: 153private: