summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/audio_core/CMakeLists.txt19
-rw-r--r--src/common/host_memory.cpp19
-rw-r--r--src/core/file_sys/vfs.cpp6
-rw-r--r--src/core/hid/emulated_console.cpp5
-rw-r--r--src/core/hid/emulated_controller.cpp20
-rw-r--r--src/core/hle/service/nifm/nifm.cpp88
-rw-r--r--src/dedicated_room/CMakeLists.txt2
-rw-r--r--src/input_common/CMakeLists.txt15
-rw-r--r--src/input_common/main.cpp24
-rw-r--r--src/yuzu/CMakeLists.txt1
-rw-r--r--src/yuzu/configuration/config.cpp2
-rw-r--r--src/yuzu/configuration/configure_system.cpp36
-rw-r--r--src/yuzu/configuration/configure_system.ui12
-rw-r--r--src/yuzu/debugger/controller.cpp10
-rw-r--r--src/yuzu_cmd/CMakeLists.txt2
16 files changed, 194 insertions, 72 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 140415474..c7283e82c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -161,7 +161,10 @@ add_subdirectory(video_core)
161add_subdirectory(network) 161add_subdirectory(network)
162add_subdirectory(input_common) 162add_subdirectory(input_common)
163add_subdirectory(shader_recompiler) 163add_subdirectory(shader_recompiler)
164add_subdirectory(dedicated_room) 164
165if (YUZU_ROOM)
166 add_subdirectory(dedicated_room)
167endif()
165 168
166if (YUZU_TESTS) 169if (YUZU_TESTS)
167 add_subdirectory(tests) 170 add_subdirectory(tests)
diff --git a/src/audio_core/CMakeLists.txt b/src/audio_core/CMakeLists.txt
index 420ba62e0..e7b595459 100644
--- a/src/audio_core/CMakeLists.txt
+++ b/src/audio_core/CMakeLists.txt
@@ -187,11 +187,7 @@ add_library(audio_core STATIC
187 renderer/voice/voice_info.cpp 187 renderer/voice/voice_info.cpp
188 renderer/voice/voice_info.h 188 renderer/voice/voice_info.h
189 renderer/voice/voice_state.h 189 renderer/voice/voice_state.h
190 sink/cubeb_sink.cpp
191 sink/cubeb_sink.h
192 sink/null_sink.h 190 sink/null_sink.h
193 sink/sdl2_sink.cpp
194 sink/sdl2_sink.h
195 sink/sink.h 191 sink/sink.h
196 sink/sink_details.cpp 192 sink/sink_details.cpp
197 sink/sink_details.h 193 sink/sink_details.h
@@ -222,11 +218,22 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
222 target_link_libraries(audio_core PRIVATE dynarmic::dynarmic) 218 target_link_libraries(audio_core PRIVATE dynarmic::dynarmic)
223endif() 219endif()
224 220
225if(ENABLE_CUBEB) 221if (ENABLE_CUBEB)
222 target_sources(audio_core PRIVATE
223 sink/cubeb_sink.cpp
224 sink/cubeb_sink.h
225 )
226
226 target_link_libraries(audio_core PRIVATE cubeb::cubeb) 227 target_link_libraries(audio_core PRIVATE cubeb::cubeb)
227 target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1) 228 target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1)
228endif() 229endif()
229if(ENABLE_SDL2) 230
231if (ENABLE_SDL2)
232 target_sources(audio_core PRIVATE
233 sink/sdl2_sink.cpp
234 sink/sdl2_sink.h
235 )
236
230 target_link_libraries(audio_core PRIVATE SDL2::SDL2) 237 target_link_libraries(audio_core PRIVATE SDL2::SDL2)
231 target_compile_definitions(audio_core PRIVATE HAVE_SDL2) 238 target_compile_definitions(audio_core PRIVATE HAVE_SDL2)
232endif() 239endif()
diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp
index 909f6cf3f..611c7d1a3 100644
--- a/src/common/host_memory.cpp
+++ b/src/common/host_memory.cpp
@@ -393,12 +393,27 @@ public:
393 } 393 }
394 394
395 // Virtual memory initialization 395 // Virtual memory initialization
396 virtual_base = static_cast<u8*>( 396#if defined(__FreeBSD__)
397 mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); 397 virtual_base =
398 static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE,
399 MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0));
400 if (virtual_base == MAP_FAILED) {
401 virtual_base = static_cast<u8*>(
402 mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
403 if (virtual_base == MAP_FAILED) {
404 LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
405 throw std::bad_alloc{};
406 }
407 }
408#else
409 virtual_base = static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE,
410 MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0));
398 if (virtual_base == MAP_FAILED) { 411 if (virtual_base == MAP_FAILED) {
399 LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno)); 412 LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno));
400 throw std::bad_alloc{}; 413 throw std::bad_alloc{};
401 } 414 }
415 madvise(virtual_base, virtual_size, MADV_HUGEPAGE);
416#endif
402 417
403 good = true; 418 good = true;
404 } 419 }
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp
index 0f6618b31..639842401 100644
--- a/src/core/file_sys/vfs.cpp
+++ b/src/core/file_sys/vfs.cpp
@@ -194,9 +194,9 @@ std::size_t VfsFile::WriteBytes(const std::vector<u8>& data, std::size_t offset)
194 194
195std::string VfsFile::GetFullPath() const { 195std::string VfsFile::GetFullPath() const {
196 if (GetContainingDirectory() == nullptr) 196 if (GetContainingDirectory() == nullptr)
197 return "/" + GetName(); 197 return '/' + GetName();
198 198
199 return GetContainingDirectory()->GetFullPath() + "/" + GetName(); 199 return GetContainingDirectory()->GetFullPath() + '/' + GetName();
200} 200}
201 201
202VirtualFile VfsDirectory::GetFileRelative(std::string_view path) const { 202VirtualFile VfsDirectory::GetFileRelative(std::string_view path) const {
@@ -435,7 +435,7 @@ std::string VfsDirectory::GetFullPath() const {
435 if (IsRoot()) 435 if (IsRoot())
436 return GetName(); 436 return GetName();
437 437
438 return GetParentDirectory()->GetFullPath() + "/" + GetName(); 438 return GetParentDirectory()->GetFullPath() + '/' + GetName();
439} 439}
440 440
441bool ReadOnlyVfsDirectory::IsWritable() const { 441bool ReadOnlyVfsDirectory::IsWritable() const {
diff --git a/src/core/hid/emulated_console.cpp b/src/core/hid/emulated_console.cpp
index 30c2e9d17..1c91bbe40 100644
--- a/src/core/hid/emulated_console.cpp
+++ b/src/core/hid/emulated_console.cpp
@@ -40,6 +40,11 @@ void EmulatedConsole::SetTouchParams() {
40 touch_params[index++] = std::move(touchscreen_param); 40 touch_params[index++] = std::move(touchscreen_param);
41 } 41 }
42 42
43 if (Settings::values.touch_from_button_maps.empty()) {
44 LOG_WARNING(Input, "touch_from_button_maps is unset by frontend config");
45 return;
46 }
47
43 const auto button_index = 48 const auto button_index =
44 static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); 49 static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue());
45 const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons; 50 const auto& touch_buttons = Settings::values.touch_from_button_maps[button_index].buttons;
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index 5587ee097..71364c323 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -11,6 +11,11 @@
11namespace Core::HID { 11namespace Core::HID {
12constexpr s32 HID_JOYSTICK_MAX = 0x7fff; 12constexpr s32 HID_JOYSTICK_MAX = 0x7fff;
13constexpr s32 HID_TRIGGER_MAX = 0x7fff; 13constexpr s32 HID_TRIGGER_MAX = 0x7fff;
14// Use a common UUID for TAS and Virtual Gamepad
15constexpr Common::UUID TAS_UUID =
16 Common::UUID{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
17constexpr Common::UUID VIRTUAL_UUID =
18 Common::UUID{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
14 19
15EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(npad_id_type_) {} 20EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(npad_id_type_) {}
16 21
@@ -348,10 +353,6 @@ void EmulatedController::ReloadInput() {
348 } 353 }
349 } 354 }
350 355
351 // Use a common UUID for TAS
352 static constexpr Common::UUID TAS_UUID = Common::UUID{
353 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
354
355 // Register TAS devices. No need to force update 356 // Register TAS devices. No need to force update
356 for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { 357 for (std::size_t index = 0; index < tas_button_devices.size(); ++index) {
357 if (!tas_button_devices[index]) { 358 if (!tas_button_devices[index]) {
@@ -377,10 +378,6 @@ void EmulatedController::ReloadInput() {
377 }); 378 });
378 } 379 }
379 380
380 // Use a common UUID for Virtual Gamepad
381 static constexpr Common::UUID VIRTUAL_UUID = Common::UUID{
382 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}};
383
384 // Register virtual devices. No need to force update 381 // Register virtual devices. No need to force update
385 for (std::size_t index = 0; index < virtual_button_devices.size(); ++index) { 382 for (std::size_t index = 0; index < virtual_button_devices.size(); ++index) {
386 if (!virtual_button_devices[index]) { 383 if (!virtual_button_devices[index]) {
@@ -780,7 +777,12 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback,
780 777
781 // Only read stick values that have the same uuid or are over the threshold to avoid flapping 778 // Only read stick values that have the same uuid or are over the threshold to avoid flapping
782 if (controller.stick_values[index].uuid != uuid) { 779 if (controller.stick_values[index].uuid != uuid) {
783 if (!stick_value.down && !stick_value.up && !stick_value.left && !stick_value.right) { 780 const bool is_tas = uuid == TAS_UUID;
781 if (is_tas && stick_value.x.value == 0 && stick_value.y.value == 0) {
782 return;
783 }
784 if (!is_tas && !stick_value.down && !stick_value.up && !stick_value.left &&
785 !stick_value.right) {
784 return; 786 return;
785 } 787 }
786 } 788 }
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 4fa9f51a6..5d32adf64 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -22,15 +22,19 @@ namespace {
22 22
23namespace Service::NIFM { 23namespace Service::NIFM {
24 24
25// This is nn::nifm::RequestState
25enum class RequestState : u32 { 26enum class RequestState : u32 {
26 NotSubmitted = 1, 27 NotSubmitted = 1,
27 Error = 1, ///< The duplicate 1 is intentional; it means both not submitted and error on HW. 28 Invalid = 1, ///< The duplicate 1 is intentional; it means both not submitted and error on HW.
28 Pending = 2, 29 OnHold = 2,
29 Connected = 3, 30 Accepted = 3,
31 Blocking = 4,
30}; 32};
31 33
32enum class InternetConnectionType : u8 { 34// This is nn::nifm::NetworkInterfaceType
33 WiFi = 1, 35enum class NetworkInterfaceType : u32 {
36 Invalid = 0,
37 WiFi_Ieee80211 = 1,
34 Ethernet = 2, 38 Ethernet = 2,
35}; 39};
36 40
@@ -42,14 +46,23 @@ enum class InternetConnectionStatus : u8 {
42 Connected, 46 Connected,
43}; 47};
44 48
49// This is nn::nifm::NetworkProfileType
50enum class NetworkProfileType : u32 {
51 User,
52 SsidList,
53 Temporary,
54};
55
56// This is nn::nifm::IpAddressSetting
45struct IpAddressSetting { 57struct IpAddressSetting {
46 bool is_automatic{}; 58 bool is_automatic{};
47 Network::IPv4Address current_address{}; 59 Network::IPv4Address ip_address{};
48 Network::IPv4Address subnet_mask{}; 60 Network::IPv4Address subnet_mask{};
49 Network::IPv4Address gateway{}; 61 Network::IPv4Address default_gateway{};
50}; 62};
51static_assert(sizeof(IpAddressSetting) == 0xD, "IpAddressSetting has incorrect size."); 63static_assert(sizeof(IpAddressSetting) == 0xD, "IpAddressSetting has incorrect size.");
52 64
65// This is nn::nifm::DnsSetting
53struct DnsSetting { 66struct DnsSetting {
54 bool is_automatic{}; 67 bool is_automatic{};
55 Network::IPv4Address primary_dns{}; 68 Network::IPv4Address primary_dns{};
@@ -57,18 +70,26 @@ struct DnsSetting {
57}; 70};
58static_assert(sizeof(DnsSetting) == 0x9, "DnsSetting has incorrect size."); 71static_assert(sizeof(DnsSetting) == 0x9, "DnsSetting has incorrect size.");
59 72
73// This is nn::nifm::AuthenticationSetting
74struct AuthenticationSetting {
75 bool is_enabled{};
76 std::array<char, 0x20> user{};
77 std::array<char, 0x20> password{};
78};
79static_assert(sizeof(AuthenticationSetting) == 0x41, "AuthenticationSetting has incorrect size.");
80
81// This is nn::nifm::ProxySetting
60struct ProxySetting { 82struct ProxySetting {
61 bool enabled{}; 83 bool is_enabled{};
62 INSERT_PADDING_BYTES(1); 84 INSERT_PADDING_BYTES(1);
63 u16 port{}; 85 u16 port{};
64 std::array<char, 0x64> proxy_server{}; 86 std::array<char, 0x64> proxy_server{};
65 bool automatic_auth_enabled{}; 87 AuthenticationSetting authentication{};
66 std::array<char, 0x20> user{};
67 std::array<char, 0x20> password{};
68 INSERT_PADDING_BYTES(1); 88 INSERT_PADDING_BYTES(1);
69}; 89};
70static_assert(sizeof(ProxySetting) == 0xAA, "ProxySetting has incorrect size."); 90static_assert(sizeof(ProxySetting) == 0xAA, "ProxySetting has incorrect size.");
71 91
92// This is nn::nifm::IpSettingData
72struct IpSettingData { 93struct IpSettingData {
73 IpAddressSetting ip_address_setting{}; 94 IpAddressSetting ip_address_setting{};
74 DnsSetting dns_setting{}; 95 DnsSetting dns_setting{};
@@ -101,6 +122,7 @@ static_assert(sizeof(NifmWirelessSettingData) == 0x70,
101 "NifmWirelessSettingData has incorrect size."); 122 "NifmWirelessSettingData has incorrect size.");
102 123
103#pragma pack(push, 1) 124#pragma pack(push, 1)
125// This is nn::nifm::detail::sf::NetworkProfileData
104struct SfNetworkProfileData { 126struct SfNetworkProfileData {
105 IpSettingData ip_setting_data{}; 127 IpSettingData ip_setting_data{};
106 u128 uuid{}; 128 u128 uuid{};
@@ -114,13 +136,14 @@ struct SfNetworkProfileData {
114}; 136};
115static_assert(sizeof(SfNetworkProfileData) == 0x17C, "SfNetworkProfileData has incorrect size."); 137static_assert(sizeof(SfNetworkProfileData) == 0x17C, "SfNetworkProfileData has incorrect size.");
116 138
139// This is nn::nifm::NetworkProfileData
117struct NifmNetworkProfileData { 140struct NifmNetworkProfileData {
118 u128 uuid{}; 141 u128 uuid{};
119 std::array<char, 0x40> network_name{}; 142 std::array<char, 0x40> network_name{};
120 u32 unknown_1{}; 143 NetworkProfileType network_profile_type{};
121 u32 unknown_2{}; 144 NetworkInterfaceType network_interface_type{};
122 u8 unknown_3{}; 145 bool is_auto_connect{};
123 u8 unknown_4{}; 146 bool is_large_capacity{};
124 INSERT_PADDING_BYTES(2); 147 INSERT_PADDING_BYTES(2);
125 NifmWirelessSettingData wireless_setting_data{}; 148 NifmWirelessSettingData wireless_setting_data{};
126 IpSettingData ip_setting_data{}; 149 IpSettingData ip_setting_data{};
@@ -184,6 +207,7 @@ public:
184 207
185 event1 = CreateKEvent(service_context, "IRequest:Event1"); 208 event1 = CreateKEvent(service_context, "IRequest:Event1");
186 event2 = CreateKEvent(service_context, "IRequest:Event2"); 209 event2 = CreateKEvent(service_context, "IRequest:Event2");
210 state = RequestState::NotSubmitted;
187 } 211 }
188 212
189 ~IRequest() override { 213 ~IRequest() override {
@@ -196,7 +220,7 @@ private:
196 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 220 LOG_WARNING(Service_NIFM, "(STUBBED) called");
197 221
198 if (state == RequestState::NotSubmitted) { 222 if (state == RequestState::NotSubmitted) {
199 UpdateState(RequestState::Pending); 223 UpdateState(RequestState::OnHold);
200 } 224 }
201 225
202 IPC::ResponseBuilder rb{ctx, 2}; 226 IPC::ResponseBuilder rb{ctx, 2};
@@ -219,14 +243,14 @@ private:
219 switch (state) { 243 switch (state) {
220 case RequestState::NotSubmitted: 244 case RequestState::NotSubmitted:
221 return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled; 245 return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled;
222 case RequestState::Pending: 246 case RequestState::OnHold:
223 if (has_connection) { 247 if (has_connection) {
224 UpdateState(RequestState::Connected); 248 UpdateState(RequestState::Accepted);
225 } else { 249 } else {
226 UpdateState(RequestState::Error); 250 UpdateState(RequestState::Invalid);
227 } 251 }
228 return ResultPendingConnection; 252 return ResultPendingConnection;
229 case RequestState::Connected: 253 case RequestState::Accepted:
230 default: 254 default:
231 return ResultSuccess; 255 return ResultSuccess;
232 } 256 }
@@ -338,9 +362,9 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
338 .ip_setting_data{ 362 .ip_setting_data{
339 .ip_address_setting{ 363 .ip_address_setting{
340 .is_automatic{true}, 364 .is_automatic{true},
341 .current_address{Network::TranslateIPv4(net_iface->ip_address)}, 365 .ip_address{Network::TranslateIPv4(net_iface->ip_address)},
342 .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)}, 366 .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)},
343 .gateway{Network::TranslateIPv4(net_iface->gateway)}, 367 .default_gateway{Network::TranslateIPv4(net_iface->gateway)},
344 }, 368 },
345 .dns_setting{ 369 .dns_setting{
346 .is_automatic{true}, 370 .is_automatic{true},
@@ -348,12 +372,14 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
348 .secondary_dns{1, 0, 0, 1}, 372 .secondary_dns{1, 0, 0, 1},
349 }, 373 },
350 .proxy_setting{ 374 .proxy_setting{
351 .enabled{false}, 375 .is_enabled{false},
352 .port{}, 376 .port{},
353 .proxy_server{}, 377 .proxy_server{},
354 .automatic_auth_enabled{}, 378 .authentication{
355 .user{}, 379 .is_enabled{},
356 .password{}, 380 .user{},
381 .password{},
382 },
357 }, 383 },
358 .mtu{1500}, 384 .mtu{1500},
359 }, 385 },
@@ -370,7 +396,7 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) {
370 // When we're connected to a room, spoof the hosts IP address 396 // When we're connected to a room, spoof the hosts IP address
371 if (auto room_member = network.GetRoomMember().lock()) { 397 if (auto room_member = network.GetRoomMember().lock()) {
372 if (room_member->IsConnected()) { 398 if (room_member->IsConnected()) {
373 network_profile_data.ip_setting_data.ip_address_setting.current_address = 399 network_profile_data.ip_setting_data.ip_address_setting.ip_address =
374 room_member->GetFakeIpAddress(); 400 room_member->GetFakeIpAddress();
375 } 401 }
376 } 402 }
@@ -444,9 +470,9 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) {
444 return IpConfigInfo{ 470 return IpConfigInfo{
445 .ip_address_setting{ 471 .ip_address_setting{
446 .is_automatic{true}, 472 .is_automatic{true},
447 .current_address{Network::TranslateIPv4(net_iface->ip_address)}, 473 .ip_address{Network::TranslateIPv4(net_iface->ip_address)},
448 .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)}, 474 .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)},
449 .gateway{Network::TranslateIPv4(net_iface->gateway)}, 475 .default_gateway{Network::TranslateIPv4(net_iface->gateway)},
450 }, 476 },
451 .dns_setting{ 477 .dns_setting{
452 .is_automatic{true}, 478 .is_automatic{true},
@@ -459,7 +485,7 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) {
459 // When we're connected to a room, spoof the hosts IP address 485 // When we're connected to a room, spoof the hosts IP address
460 if (auto room_member = network.GetRoomMember().lock()) { 486 if (auto room_member = network.GetRoomMember().lock()) {
461 if (room_member->IsConnected()) { 487 if (room_member->IsConnected()) {
462 ip_config_info.ip_address_setting.current_address = room_member->GetFakeIpAddress(); 488 ip_config_info.ip_address_setting.ip_address = room_member->GetFakeIpAddress();
463 } 489 }
464 } 490 }
465 491
@@ -480,7 +506,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx
480 LOG_WARNING(Service_NIFM, "(STUBBED) called"); 506 LOG_WARNING(Service_NIFM, "(STUBBED) called");
481 507
482 struct Output { 508 struct Output {
483 InternetConnectionType type{InternetConnectionType::WiFi}; 509 u8 type{static_cast<u8>(NetworkInterfaceType::WiFi_Ieee80211)};
484 u8 wifi_strength{3}; 510 u8 wifi_strength{3};
485 InternetConnectionStatus state{InternetConnectionStatus::Connected}; 511 InternetConnectionStatus state{InternetConnectionStatus::Connected};
486 }; 512 };
diff --git a/src/dedicated_room/CMakeLists.txt b/src/dedicated_room/CMakeLists.txt
index 5bbe1d4b5..136109a0c 100644
--- a/src/dedicated_room/CMakeLists.txt
+++ b/src/dedicated_room/CMakeLists.txt
@@ -1,8 +1,6 @@
1# SPDX-FileCopyrightText: 2017 Citra Emulator Project 1# SPDX-FileCopyrightText: 2017 Citra Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later 2# SPDX-License-Identifier: GPL-2.0-or-later
3 3
4set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
5
6add_executable(yuzu-room 4add_executable(yuzu-room
7 precompiled_headers.h 5 precompiled_headers.h
8 yuzu_room.cpp 6 yuzu_room.cpp
diff --git a/src/input_common/CMakeLists.txt b/src/input_common/CMakeLists.txt
index f24c89b04..cef2c4d52 100644
--- a/src/input_common/CMakeLists.txt
+++ b/src/input_common/CMakeLists.txt
@@ -4,14 +4,10 @@
4add_library(input_common STATIC 4add_library(input_common STATIC
5 drivers/camera.cpp 5 drivers/camera.cpp
6 drivers/camera.h 6 drivers/camera.h
7 drivers/gc_adapter.cpp
8 drivers/gc_adapter.h
9 drivers/keyboard.cpp 7 drivers/keyboard.cpp
10 drivers/keyboard.h 8 drivers/keyboard.h
11 drivers/mouse.cpp 9 drivers/mouse.cpp
12 drivers/mouse.h 10 drivers/mouse.h
13 drivers/sdl_driver.cpp
14 drivers/sdl_driver.h
15 drivers/tas_input.cpp 11 drivers/tas_input.cpp
16 drivers/tas_input.h 12 drivers/tas_input.h
17 drivers/touch_screen.cpp 13 drivers/touch_screen.cpp
@@ -62,8 +58,17 @@ if (ENABLE_SDL2)
62 target_compile_definitions(input_common PRIVATE HAVE_SDL2) 58 target_compile_definitions(input_common PRIVATE HAVE_SDL2)
63endif() 59endif()
64 60
61if (ENABLE_LIBUSB)
62 target_sources(input_common PRIVATE
63 drivers/gc_adapter.cpp
64 drivers/gc_adapter.h
65 )
66 target_link_libraries(input_common PRIVATE libusb::usb)
67 target_compile_definitions(input_common PRIVATE HAVE_LIBUSB)
68endif()
69
65create_target_directory_groups(input_common) 70create_target_directory_groups(input_common)
66target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost libusb::usb) 71target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost)
67 72
68if (YUZU_USE_PRECOMPILED_HEADERS) 73if (YUZU_USE_PRECOMPILED_HEADERS)
69 target_precompile_headers(input_common PRIVATE precompiled_headers.h) 74 target_precompile_headers(input_common PRIVATE precompiled_headers.h)
diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp
index 86deb4c7c..4dc92f482 100644
--- a/src/input_common/main.cpp
+++ b/src/input_common/main.cpp
@@ -5,7 +5,6 @@
5#include "common/input.h" 5#include "common/input.h"
6#include "common/param_package.h" 6#include "common/param_package.h"
7#include "input_common/drivers/camera.h" 7#include "input_common/drivers/camera.h"
8#include "input_common/drivers/gc_adapter.h"
9#include "input_common/drivers/keyboard.h" 8#include "input_common/drivers/keyboard.h"
10#include "input_common/drivers/mouse.h" 9#include "input_common/drivers/mouse.h"
11#include "input_common/drivers/tas_input.h" 10#include "input_common/drivers/tas_input.h"
@@ -19,6 +18,10 @@
19#include "input_common/input_mapping.h" 18#include "input_common/input_mapping.h"
20#include "input_common/input_poller.h" 19#include "input_common/input_poller.h"
21#include "input_common/main.h" 20#include "input_common/main.h"
21
22#ifdef HAVE_LIBUSB
23#include "input_common/drivers/gc_adapter.h"
24#endif
22#ifdef HAVE_SDL2 25#ifdef HAVE_SDL2
23#include "input_common/drivers/sdl_driver.h" 26#include "input_common/drivers/sdl_driver.h"
24#endif 27#endif
@@ -45,7 +48,9 @@ struct InputSubsystem::Impl {
45 RegisterEngine("keyboard", keyboard); 48 RegisterEngine("keyboard", keyboard);
46 RegisterEngine("mouse", mouse); 49 RegisterEngine("mouse", mouse);
47 RegisterEngine("touch", touch_screen); 50 RegisterEngine("touch", touch_screen);
51#ifdef HAVE_LIBUSB
48 RegisterEngine("gcpad", gcadapter); 52 RegisterEngine("gcpad", gcadapter);
53#endif
49 RegisterEngine("cemuhookudp", udp_client); 54 RegisterEngine("cemuhookudp", udp_client);
50 RegisterEngine("tas", tas_input); 55 RegisterEngine("tas", tas_input);
51 RegisterEngine("camera", camera); 56 RegisterEngine("camera", camera);
@@ -72,7 +77,9 @@ struct InputSubsystem::Impl {
72 UnregisterEngine(keyboard); 77 UnregisterEngine(keyboard);
73 UnregisterEngine(mouse); 78 UnregisterEngine(mouse);
74 UnregisterEngine(touch_screen); 79 UnregisterEngine(touch_screen);
80#ifdef HAVE_LIBUSB
75 UnregisterEngine(gcadapter); 81 UnregisterEngine(gcadapter);
82#endif
76 UnregisterEngine(udp_client); 83 UnregisterEngine(udp_client);
77 UnregisterEngine(tas_input); 84 UnregisterEngine(tas_input);
78 UnregisterEngine(camera); 85 UnregisterEngine(camera);
@@ -95,8 +102,10 @@ struct InputSubsystem::Impl {
95 devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); 102 devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end());
96 auto mouse_devices = mouse->GetInputDevices(); 103 auto mouse_devices = mouse->GetInputDevices();
97 devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); 104 devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end());
105#ifdef HAVE_LIBUSB
98 auto gcadapter_devices = gcadapter->GetInputDevices(); 106 auto gcadapter_devices = gcadapter->GetInputDevices();
99 devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); 107 devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end());
108#endif
100 auto udp_devices = udp_client->GetInputDevices(); 109 auto udp_devices = udp_client->GetInputDevices();
101 devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); 110 devices.insert(devices.end(), udp_devices.begin(), udp_devices.end());
102#ifdef HAVE_SDL2 111#ifdef HAVE_SDL2
@@ -119,9 +128,11 @@ struct InputSubsystem::Impl {
119 if (engine == mouse->GetEngineName()) { 128 if (engine == mouse->GetEngineName()) {
120 return mouse; 129 return mouse;
121 } 130 }
131#ifdef HAVE_LIBUSB
122 if (engine == gcadapter->GetEngineName()) { 132 if (engine == gcadapter->GetEngineName()) {
123 return gcadapter; 133 return gcadapter;
124 } 134 }
135#endif
125 if (engine == udp_client->GetEngineName()) { 136 if (engine == udp_client->GetEngineName()) {
126 return udp_client; 137 return udp_client;
127 } 138 }
@@ -194,9 +205,11 @@ struct InputSubsystem::Impl {
194 if (engine == mouse->GetEngineName()) { 205 if (engine == mouse->GetEngineName()) {
195 return true; 206 return true;
196 } 207 }
208#ifdef HAVE_LIBUSB
197 if (engine == gcadapter->GetEngineName()) { 209 if (engine == gcadapter->GetEngineName()) {
198 return true; 210 return true;
199 } 211 }
212#endif
200 if (engine == udp_client->GetEngineName()) { 213 if (engine == udp_client->GetEngineName()) {
201 return true; 214 return true;
202 } 215 }
@@ -217,7 +230,9 @@ struct InputSubsystem::Impl {
217 void BeginConfiguration() { 230 void BeginConfiguration() {
218 keyboard->BeginConfiguration(); 231 keyboard->BeginConfiguration();
219 mouse->BeginConfiguration(); 232 mouse->BeginConfiguration();
233#ifdef HAVE_LIBUSB
220 gcadapter->BeginConfiguration(); 234 gcadapter->BeginConfiguration();
235#endif
221 udp_client->BeginConfiguration(); 236 udp_client->BeginConfiguration();
222#ifdef HAVE_SDL2 237#ifdef HAVE_SDL2
223 sdl->BeginConfiguration(); 238 sdl->BeginConfiguration();
@@ -227,7 +242,9 @@ struct InputSubsystem::Impl {
227 void EndConfiguration() { 242 void EndConfiguration() {
228 keyboard->EndConfiguration(); 243 keyboard->EndConfiguration();
229 mouse->EndConfiguration(); 244 mouse->EndConfiguration();
245#ifdef HAVE_LIBUSB
230 gcadapter->EndConfiguration(); 246 gcadapter->EndConfiguration();
247#endif
231 udp_client->EndConfiguration(); 248 udp_client->EndConfiguration();
232#ifdef HAVE_SDL2 249#ifdef HAVE_SDL2
233 sdl->EndConfiguration(); 250 sdl->EndConfiguration();
@@ -248,7 +265,6 @@ struct InputSubsystem::Impl {
248 265
249 std::shared_ptr<Keyboard> keyboard; 266 std::shared_ptr<Keyboard> keyboard;
250 std::shared_ptr<Mouse> mouse; 267 std::shared_ptr<Mouse> mouse;
251 std::shared_ptr<GCAdapter> gcadapter;
252 std::shared_ptr<TouchScreen> touch_screen; 268 std::shared_ptr<TouchScreen> touch_screen;
253 std::shared_ptr<TasInput::Tas> tas_input; 269 std::shared_ptr<TasInput::Tas> tas_input;
254 std::shared_ptr<CemuhookUDP::UDPClient> udp_client; 270 std::shared_ptr<CemuhookUDP::UDPClient> udp_client;
@@ -256,6 +272,10 @@ struct InputSubsystem::Impl {
256 std::shared_ptr<VirtualAmiibo> virtual_amiibo; 272 std::shared_ptr<VirtualAmiibo> virtual_amiibo;
257 std::shared_ptr<VirtualGamepad> virtual_gamepad; 273 std::shared_ptr<VirtualGamepad> virtual_gamepad;
258 274
275#ifdef HAVE_LIBUSB
276 std::shared_ptr<GCAdapter> gcadapter;
277#endif
278
259#ifdef HAVE_SDL2 279#ifdef HAVE_SDL2
260 std::shared_ptr<SDLDriver> sdl; 280 std::shared_ptr<SDLDriver> sdl;
261#endif 281#endif
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index 4a7d35617..dfc675cc8 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -5,7 +5,6 @@ set(CMAKE_AUTOMOC ON)
5set(CMAKE_AUTORCC ON) 5set(CMAKE_AUTORCC ON)
6set(CMAKE_AUTOUIC ON) 6set(CMAKE_AUTOUIC ON)
7set(CMAKE_INCLUDE_CURRENT_DIR ON) 7set(CMAKE_INCLUDE_CURRENT_DIR ON)
8set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
9 8
10# Set the RPATH for Qt Libraries 9# Set the RPATH for Qt Libraries
11# This must be done before the `yuzu` target is created 10# This must be done before the `yuzu` target is created
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 2ea4f367b..3e51426c8 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -941,7 +941,6 @@ void Config::ReadValues() {
941 ReadRendererValues(); 941 ReadRendererValues();
942 ReadAudioValues(); 942 ReadAudioValues();
943 ReadSystemValues(); 943 ReadSystemValues();
944 ReadMultiplayerValues();
945} 944}
946 945
947void Config::SavePlayerValue(std::size_t player_index) { 946void Config::SavePlayerValue(std::size_t player_index) {
@@ -1099,7 +1098,6 @@ void Config::SaveValues() {
1099 SaveRendererValues(); 1098 SaveRendererValues();
1100 SaveAudioValues(); 1099 SaveAudioValues();
1101 SaveSystemValues(); 1100 SaveSystemValues();
1102 SaveMultiplayerValues();
1103} 1101}
1104 1102
1105void Config::SaveAudioValues() { 1103void Config::SaveAudioValues() {
diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp
index 9b14e5903..94049f2f4 100644
--- a/src/yuzu/configuration/configure_system.cpp
+++ b/src/yuzu/configuration/configure_system.cpp
@@ -14,6 +14,26 @@
14#include "yuzu/configuration/configuration_shared.h" 14#include "yuzu/configuration/configuration_shared.h"
15#include "yuzu/configuration/configure_system.h" 15#include "yuzu/configuration/configure_system.h"
16 16
17constexpr std::array<u32, 7> LOCALE_BLOCKLIST{
18 // pzzefezrpnkzeidfej
19 // thhsrnhutlohsternp
20 // BHH4CG U
21 // Raa1AB S
22 // nn9
23 // ts
24 0b0100011100001100000, // Japan
25 0b0000001101001100100, // Americas
26 0b0100110100001000010, // Europe
27 0b0100110100001000010, // Australia
28 0b0000000000000000000, // China
29 0b0100111100001000000, // Korea
30 0b0100111100001000000, // Taiwan
31};
32
33static bool IsValidLocale(u32 region_index, u32 language_index) {
34 return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0;
35}
36
17ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) 37ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
18 : QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} { 38 : QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} {
19 ui->setupUi(this); 39 ui->setupUi(this);
@@ -34,6 +54,22 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent)
34 } 54 }
35 }); 55 });
36 56
57 const auto locale_check = [this](int index) {
58 const bool valid_locale =
59 IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex());
60 ui->label_warn_invalid_locale->setVisible(!valid_locale);
61 if (!valid_locale) {
62 ui->label_warn_invalid_locale->setText(
63 tr("Warning: \"%1\" is not a valid language for region \"%2\"")
64 .arg(ui->combo_language->currentText())
65 .arg(ui->combo_region->currentText()));
66 }
67 };
68
69 connect(ui->combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
70 locale_check);
71 connect(ui->combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check);
72
37 ui->label_console_id->setVisible(Settings::IsConfiguringGlobal()); 73 ui->label_console_id->setVisible(Settings::IsConfiguringGlobal());
38 ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal()); 74 ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal());
39 75
diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui
index 46892f5c1..0459cd924 100644
--- a/src/yuzu/configuration/configure_system.ui
+++ b/src/yuzu/configuration/configure_system.ui
@@ -326,7 +326,7 @@
326 </item> 326 </item>
327 <item> 327 <item>
328 <property name="text"> 328 <property name="text">
329 <string>English</string> 329 <string>American English</string>
330 </property> 330 </property>
331 </item> 331 </item>
332 <item> 332 <item>
@@ -546,6 +546,16 @@
546 </spacer> 546 </spacer>
547 </item> 547 </item>
548 <item> 548 <item>
549 <widget class="QLabel" name="label_warn_invalid_locale">
550 <property name="text">
551 <string></string>
552 </property>
553 <property name="wordWrap">
554 <bool>true</bool>
555 </property>
556 </widget>
557 </item>
558 <item>
549 <widget class="QLabel" name="label_disable_info"> 559 <widget class="QLabel" name="label_disable_info">
550 <property name="text"> 560 <property name="text">
551 <string>System settings are available only when game is not running.</string> 561 <string>System settings are available only when game is not running.</string>
diff --git a/src/yuzu/debugger/controller.cpp b/src/yuzu/debugger/controller.cpp
index e4bf16a04..19f3775a3 100644
--- a/src/yuzu/debugger/controller.cpp
+++ b/src/yuzu/debugger/controller.cpp
@@ -93,7 +93,7 @@ void ControllerDialog::ControllerUpdate(Core::HID::ControllerTriggerType type) {
93 case Core::HID::ControllerTriggerType::Button: 93 case Core::HID::ControllerTriggerType::Button:
94 case Core::HID::ControllerTriggerType::Stick: { 94 case Core::HID::ControllerTriggerType::Stick: {
95 const auto buttons_values = controller->GetButtonsValues(); 95 const auto buttons_values = controller->GetButtonsValues();
96 const auto stick_values = controller->GetSticksValues(); 96 const auto stick_values = controller->GetSticks();
97 u64 buttons = 0; 97 u64 buttons = 0;
98 std::size_t index = 0; 98 std::size_t index = 0;
99 for (const auto& button : buttons_values) { 99 for (const auto& button : buttons_values) {
@@ -101,12 +101,12 @@ void ControllerDialog::ControllerUpdate(Core::HID::ControllerTriggerType type) {
101 index++; 101 index++;
102 } 102 }
103 const InputCommon::TasInput::TasAnalog left_axis = { 103 const InputCommon::TasInput::TasAnalog left_axis = {
104 .x = stick_values[Settings::NativeAnalog::LStick].x.value, 104 .x = stick_values.left.x / 32767.f,
105 .y = stick_values[Settings::NativeAnalog::LStick].y.value, 105 .y = stick_values.left.y / 32767.f,
106 }; 106 };
107 const InputCommon::TasInput::TasAnalog right_axis = { 107 const InputCommon::TasInput::TasAnalog right_axis = {
108 .x = stick_values[Settings::NativeAnalog::RStick].x.value, 108 .x = stick_values.right.x / 32767.f,
109 .y = stick_values[Settings::NativeAnalog::RStick].y.value, 109 .y = stick_values.right.y / 32767.f,
110 }; 110 };
111 input_subsystem->GetTas()->RecordInput(buttons, left_axis, right_axis); 111 input_subsystem->GetTas()->RecordInput(buttons, left_axis, right_axis);
112 break; 112 break;
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt
index 61b6cc4e0..46eddf423 100644
--- a/src/yuzu_cmd/CMakeLists.txt
+++ b/src/yuzu_cmd/CMakeLists.txt
@@ -1,8 +1,6 @@
1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project 1# SPDX-FileCopyrightText: 2018 yuzu Emulator Project
2# SPDX-License-Identifier: GPL-2.0-or-later 2# SPDX-License-Identifier: GPL-2.0-or-later
3 3
4set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
5
6# Credits to Samantas5855 and others for this function. 4# Credits to Samantas5855 and others for this function.
7function(create_resource file output filename) 5function(create_resource file output filename)
8 # Read hex data from file 6 # Read hex data from file