summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hid/emulated_controller.cpp35
-rw-r--r--src/core/hid/emulated_controller.h1
-rw-r--r--src/core/hle/service/audio/audren_u.cpp27
-rw-r--r--src/core/hle/service/filesystem/fsp_srv.cpp3
-rw-r--r--src/core/hle/service/hid/hid.cpp6
-rw-r--r--src/yuzu/bootmanager.cpp20
-rw-r--r--src/yuzu/configuration/configure_camera.cpp20
7 files changed, 102 insertions, 10 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 049602e7d..f9f902c2d 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -101,8 +101,10 @@ void EmulatedController::ReloadFromSettings() {
101 // Other or debug controller should always be a pro controller 101 // Other or debug controller should always be a pro controller
102 if (npad_id_type != NpadIdType::Other) { 102 if (npad_id_type != NpadIdType::Other) {
103 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type)); 103 SetNpadStyleIndex(MapSettingsTypeToNPad(player.controller_type));
104 original_npad_type = npad_type;
104 } else { 105 } else {
105 SetNpadStyleIndex(NpadStyleIndex::ProController); 106 SetNpadStyleIndex(NpadStyleIndex::ProController);
107 original_npad_type = npad_type;
106 } 108 }
107 109
108 if (player.connected) { 110 if (player.connected) {
@@ -354,6 +356,7 @@ void EmulatedController::DisableConfiguration() {
354 Disconnect(); 356 Disconnect();
355 } 357 }
356 SetNpadStyleIndex(tmp_npad_type); 358 SetNpadStyleIndex(tmp_npad_type);
359 original_npad_type = tmp_npad_type;
357 } 360 }
358 361
359 // Apply temporary connected status to the real controller 362 // Apply temporary connected status to the real controller
@@ -1004,13 +1007,27 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
1004 if (!is_connected) { 1007 if (!is_connected) {
1005 return; 1008 return;
1006 } 1009 }
1010
1011 // Attempt to reconnect with the original type
1012 if (npad_type != original_npad_type) {
1013 Disconnect();
1014 const auto current_npad_type = npad_type;
1015 SetNpadStyleIndex(original_npad_type);
1016 if (IsControllerSupported()) {
1017 Connect();
1018 return;
1019 }
1020 SetNpadStyleIndex(current_npad_type);
1021 Connect();
1022 }
1023
1007 if (IsControllerSupported()) { 1024 if (IsControllerSupported()) {
1008 return; 1025 return;
1009 } 1026 }
1010 1027
1011 Disconnect(); 1028 Disconnect();
1012 1029
1013 // Fallback fullkey controllers to Pro controllers 1030 // Fallback Fullkey controllers to Pro controllers
1014 if (IsControllerFullkey() && supported_style_tag.fullkey) { 1031 if (IsControllerFullkey() && supported_style_tag.fullkey) {
1015 LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type); 1032 LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
1016 SetNpadStyleIndex(NpadStyleIndex::ProController); 1033 SetNpadStyleIndex(NpadStyleIndex::ProController);
@@ -1018,6 +1035,22 @@ void EmulatedController::SetSupportedNpadStyleTag(NpadStyleTag supported_styles)
1018 return; 1035 return;
1019 } 1036 }
1020 1037
1038 // Fallback Dual joycon controllers to Pro controllers
1039 if (npad_type == NpadStyleIndex::JoyconDual && supported_style_tag.fullkey) {
1040 LOG_WARNING(Service_HID, "Reconnecting controller type {} as Pro controller", npad_type);
1041 SetNpadStyleIndex(NpadStyleIndex::ProController);
1042 Connect();
1043 return;
1044 }
1045
1046 // Fallback Pro controllers to Dual joycon
1047 if (npad_type == NpadStyleIndex::ProController && supported_style_tag.joycon_dual) {
1048 LOG_WARNING(Service_HID, "Reconnecting controller type {} as Dual Joycons", npad_type);
1049 SetNpadStyleIndex(NpadStyleIndex::JoyconDual);
1050 Connect();
1051 return;
1052 }
1053
1021 LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller", 1054 LOG_ERROR(Service_HID, "Controller type {} is not supported. Disconnecting controller",
1022 npad_type); 1055 npad_type);
1023} 1056}
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index cbd7c26d3..c3aa8f9d3 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -440,6 +440,7 @@ private:
440 440
441 const NpadIdType npad_id_type; 441 const NpadIdType npad_id_type;
442 NpadStyleIndex npad_type{NpadStyleIndex::None}; 442 NpadStyleIndex npad_type{NpadStyleIndex::None};
443 NpadStyleIndex original_npad_type{NpadStyleIndex::None};
443 NpadStyleTag supported_style_tag{NpadStyleSet::All}; 444 NpadStyleTag supported_style_tag{NpadStyleSet::All};
444 bool is_connected{false}; 445 bool is_connected{false};
445 bool is_configuring{false}; 446 bool is_configuring{false};
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 381a66ba5..bc69117c6 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -50,7 +50,7 @@ public:
50 {7, &IAudioRenderer::QuerySystemEvent, "QuerySystemEvent"}, 50 {7, &IAudioRenderer::QuerySystemEvent, "QuerySystemEvent"},
51 {8, &IAudioRenderer::SetRenderingTimeLimit, "SetRenderingTimeLimit"}, 51 {8, &IAudioRenderer::SetRenderingTimeLimit, "SetRenderingTimeLimit"},
52 {9, &IAudioRenderer::GetRenderingTimeLimit, "GetRenderingTimeLimit"}, 52 {9, &IAudioRenderer::GetRenderingTimeLimit, "GetRenderingTimeLimit"},
53 {10, nullptr, "RequestUpdateAuto"}, 53 {10, &IAudioRenderer::RequestUpdate, "RequestUpdateAuto"},
54 {11, nullptr, "ExecuteAudioRendererRendering"}, 54 {11, nullptr, "ExecuteAudioRendererRendering"},
55 }; 55 };
56 // clang-format on 56 // clang-format on
@@ -113,15 +113,30 @@ private:
113 113
114 // These buffers are written manually to avoid an issue with WriteBuffer throwing errors for 114 // These buffers are written manually to avoid an issue with WriteBuffer throwing errors for
115 // checking size 0. Performance size is 0 for most games. 115 // checking size 0. Performance size is 0 for most games.
116 const auto buffers{ctx.BufferDescriptorB()}; 116
117 std::vector<u8> output(buffers[0].Size(), 0); 117 std::vector<u8> output{};
118 std::vector<u8> performance(buffers[1].Size(), 0); 118 std::vector<u8> performance{};
119 auto is_buffer_b{ctx.BufferDescriptorB()[0].Size() != 0};
120 if (is_buffer_b) {
121 const auto buffersB{ctx.BufferDescriptorB()};
122 output.resize(buffersB[0].Size(), 0);
123 performance.resize(buffersB[1].Size(), 0);
124 } else {
125 const auto buffersC{ctx.BufferDescriptorC()};
126 output.resize(buffersC[0].Size(), 0);
127 performance.resize(buffersC[1].Size(), 0);
128 }
119 129
120 auto result = impl->RequestUpdate(input, performance, output); 130 auto result = impl->RequestUpdate(input, performance, output);
121 131
122 if (result.IsSuccess()) { 132 if (result.IsSuccess()) {
123 ctx.WriteBufferB(output.data(), output.size(), 0); 133 if (is_buffer_b) {
124 ctx.WriteBufferB(performance.data(), performance.size(), 1); 134 ctx.WriteBufferB(output.data(), output.size(), 0);
135 ctx.WriteBufferB(performance.data(), performance.size(), 1);
136 } else {
137 ctx.WriteBufferC(output.data(), output.size(), 0);
138 ctx.WriteBufferC(performance.data(), performance.size(), 1);
139 }
125 } else { 140 } else {
126 LOG_ERROR(Service_Audio, "RequestUpdate failed error 0x{:02X}!", result.description); 141 LOG_ERROR(Service_Audio, "RequestUpdate failed error 0x{:02X}!", result.description);
127 } 142 }
diff --git a/src/core/hle/service/filesystem/fsp_srv.cpp b/src/core/hle/service/filesystem/fsp_srv.cpp
index fae6e5aff..e23eae36a 100644
--- a/src/core/hle/service/filesystem/fsp_srv.cpp
+++ b/src/core/hle/service/filesystem/fsp_srv.cpp
@@ -246,7 +246,8 @@ static void BuildEntryIndex(std::vector<FileSys::Entry>& entries, const std::vec
246 entries.reserve(entries.size() + new_data.size()); 246 entries.reserve(entries.size() + new_data.size());
247 247
248 for (const auto& new_entry : new_data) { 248 for (const auto& new_entry : new_data) {
249 entries.emplace_back(new_entry->GetName(), type, new_entry->GetSize()); 249 entries.emplace_back(new_entry->GetName(), type,
250 type == FileSys::EntryType::Directory ? 0 : new_entry->GetSize());
250 } 251 }
251} 252}
252 253
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp
index 5ecbddf94..7909141c0 100644
--- a/src/core/hle/service/hid/hid.cpp
+++ b/src/core/hle/service/hid/hid.cpp
@@ -2146,12 +2146,18 @@ public:
2146 {324, nullptr, "GetUniquePadButtonSet"}, 2146 {324, nullptr, "GetUniquePadButtonSet"},
2147 {325, nullptr, "GetUniquePadColor"}, 2147 {325, nullptr, "GetUniquePadColor"},
2148 {326, nullptr, "GetUniquePadAppletDetailedUiType"}, 2148 {326, nullptr, "GetUniquePadAppletDetailedUiType"},
2149 {327, nullptr, "GetAbstractedPadIdDataFromNpad"},
2150 {328, nullptr, "AttachAbstractedPadToNpad"},
2151 {329, nullptr, "DetachAbstractedPadAll"},
2152 {330, nullptr, "CheckAbstractedPadConnection"},
2149 {500, nullptr, "SetAppletResourceUserId"}, 2153 {500, nullptr, "SetAppletResourceUserId"},
2150 {501, nullptr, "RegisterAppletResourceUserId"}, 2154 {501, nullptr, "RegisterAppletResourceUserId"},
2151 {502, nullptr, "UnregisterAppletResourceUserId"}, 2155 {502, nullptr, "UnregisterAppletResourceUserId"},
2152 {503, nullptr, "EnableAppletToGetInput"}, 2156 {503, nullptr, "EnableAppletToGetInput"},
2153 {504, nullptr, "SetAruidValidForVibration"}, 2157 {504, nullptr, "SetAruidValidForVibration"},
2154 {505, nullptr, "EnableAppletToGetSixAxisSensor"}, 2158 {505, nullptr, "EnableAppletToGetSixAxisSensor"},
2159 {506, nullptr, "EnableAppletToGetPadInput"},
2160 {507, nullptr, "EnableAppletToGetTouchScreen"},
2155 {510, nullptr, "SetVibrationMasterVolume"}, 2161 {510, nullptr, "SetVibrationMasterVolume"},
2156 {511, nullptr, "GetVibrationMasterVolume"}, 2162 {511, nullptr, "GetVibrationMasterVolume"},
2157 {512, nullptr, "BeginPermitVibrationSession"}, 2163 {512, nullptr, "BeginPermitVibrationSession"},
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp
index c262d0a2b..d3fbdb09d 100644
--- a/src/yuzu/bootmanager.cpp
+++ b/src/yuzu/bootmanager.cpp
@@ -815,6 +815,12 @@ void GRenderWindow::InitializeCamera() {
815 if (Settings::values.ir_sensor_device.GetValue() == cameraInfo.deviceName().toStdString() || 815 if (Settings::values.ir_sensor_device.GetValue() == cameraInfo.deviceName().toStdString() ||
816 Settings::values.ir_sensor_device.GetValue() == "Auto") { 816 Settings::values.ir_sensor_device.GetValue() == "Auto") {
817 camera = std::make_unique<QCamera>(cameraInfo); 817 camera = std::make_unique<QCamera>(cameraInfo);
818 if (!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder) &&
819 !camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
820 LOG_ERROR(Frontend,
821 "Camera doesn't support CaptureViewfinder or CaptureStillImage");
822 continue;
823 }
818 camera_found = true; 824 camera_found = true;
819 break; 825 break;
820 } 826 }
@@ -825,10 +831,22 @@ void GRenderWindow::InitializeCamera() {
825 } 831 }
826 832
827 camera_capture = std::make_unique<QCameraImageCapture>(camera.get()); 833 camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
834
835 if (!camera_capture->isCaptureDestinationSupported(
836 QCameraImageCapture::CaptureDestination::CaptureToBuffer)) {
837 LOG_ERROR(Frontend, "Camera doesn't support saving to buffer");
838 return;
839 }
840
841 camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer);
828 connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this, 842 connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
829 &GRenderWindow::OnCameraCapture); 843 &GRenderWindow::OnCameraCapture);
830 camera->unload(); 844 camera->unload();
831 camera->setCaptureMode(QCamera::CaptureViewfinder); 845 if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder)) {
846 camera->setCaptureMode(QCamera::CaptureViewfinder);
847 } else if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
848 camera->setCaptureMode(QCamera::CaptureStillImage);
849 }
832 camera->load(); 850 camera->load();
833 camera->start(); 851 camera->start();
834 852
diff --git a/src/yuzu/configuration/configure_camera.cpp b/src/yuzu/configuration/configure_camera.cpp
index 73cdcf3f2..2a61de2a1 100644
--- a/src/yuzu/configuration/configure_camera.cpp
+++ b/src/yuzu/configuration/configure_camera.cpp
@@ -42,6 +42,12 @@ void ConfigureCamera::PreviewCamera() {
42 LOG_INFO(Frontend, "Selected Camera {} {}", cameraInfo.description().toStdString(), 42 LOG_INFO(Frontend, "Selected Camera {} {}", cameraInfo.description().toStdString(),
43 cameraInfo.deviceName().toStdString()); 43 cameraInfo.deviceName().toStdString());
44 camera = std::make_unique<QCamera>(cameraInfo); 44 camera = std::make_unique<QCamera>(cameraInfo);
45 if (!camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder) &&
46 !camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
47 LOG_ERROR(Frontend,
48 "Camera doesn't support CaptureViewfinder or CaptureStillImage");
49 continue;
50 }
45 camera_found = true; 51 camera_found = true;
46 break; 52 break;
47 } 53 }
@@ -57,10 +63,22 @@ void ConfigureCamera::PreviewCamera() {
57 } 63 }
58 64
59 camera_capture = std::make_unique<QCameraImageCapture>(camera.get()); 65 camera_capture = std::make_unique<QCameraImageCapture>(camera.get());
66
67 if (!camera_capture->isCaptureDestinationSupported(
68 QCameraImageCapture::CaptureDestination::CaptureToBuffer)) {
69 LOG_ERROR(Frontend, "Camera doesn't support saving to buffer");
70 return;
71 }
72
73 camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer);
60 connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this, 74 connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this,
61 &ConfigureCamera::DisplayCapturedFrame); 75 &ConfigureCamera::DisplayCapturedFrame);
62 camera->unload(); 76 camera->unload();
63 camera->setCaptureMode(QCamera::CaptureViewfinder); 77 if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureViewfinder)) {
78 camera->setCaptureMode(QCamera::CaptureViewfinder);
79 } else if (camera->isCaptureModeSupported(QCamera::CaptureMode::CaptureStillImage)) {
80 camera->setCaptureMode(QCamera::CaptureStillImage);
81 }
64 camera->load(); 82 camera->load();
65 camera->start(); 83 camera->start();
66 84