diff options
Diffstat (limited to '')
-rw-r--r-- | src/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/audio_core/CMakeLists.txt | 19 | ||||
-rw-r--r-- | src/common/host_memory.cpp | 19 | ||||
-rw-r--r-- | src/core/file_sys/vfs.cpp | 6 | ||||
-rw-r--r-- | src/core/hid/emulated_console.cpp | 5 | ||||
-rw-r--r-- | src/core/hid/emulated_controller.cpp | 20 | ||||
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 88 | ||||
-rw-r--r-- | src/dedicated_room/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/input_common/CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/input_common/main.cpp | 24 | ||||
-rw-r--r-- | src/yuzu/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.cpp | 36 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_system.ui | 12 | ||||
-rw-r--r-- | src/yuzu/debugger/controller.cpp | 10 | ||||
-rw-r--r-- | src/yuzu_cmd/CMakeLists.txt | 2 |
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) add_subdirectory(network) add_subdirectory(input_common) add_subdirectory(shader_recompiler) -add_subdirectory(dedicated_room) + +if (YUZU_ROOM) + add_subdirectory(dedicated_room) +endif() if (YUZU_TESTS) 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 renderer/voice/voice_info.cpp renderer/voice/voice_info.h renderer/voice/voice_state.h - sink/cubeb_sink.cpp - sink/cubeb_sink.h sink/null_sink.h - sink/sdl2_sink.cpp - sink/sdl2_sink.h sink/sink.h sink/sink_details.cpp sink/sink_details.h @@ -222,11 +218,22 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) target_link_libraries(audio_core PRIVATE dynarmic::dynarmic) endif() -if(ENABLE_CUBEB) +if (ENABLE_CUBEB) + target_sources(audio_core PRIVATE + sink/cubeb_sink.cpp + sink/cubeb_sink.h + ) + target_link_libraries(audio_core PRIVATE cubeb::cubeb) target_compile_definitions(audio_core PRIVATE -DHAVE_CUBEB=1) endif() -if(ENABLE_SDL2) + +if (ENABLE_SDL2) + target_sources(audio_core PRIVATE + sink/sdl2_sink.cpp + sink/sdl2_sink.h + ) + target_link_libraries(audio_core PRIVATE SDL2::SDL2) target_compile_definitions(audio_core PRIVATE HAVE_SDL2) endif() 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: } // Virtual memory initialization - virtual_base = static_cast<u8*>( - mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); +#if defined(__FreeBSD__) + virtual_base = + static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_ALIGNED_SUPER, -1, 0)); + if (virtual_base == MAP_FAILED) { + virtual_base = static_cast<u8*>( + mmap(nullptr, virtual_size, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)); + if (virtual_base == MAP_FAILED) { + LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno)); + throw std::bad_alloc{}; + } + } +#else + virtual_base = static_cast<u8*>(mmap(nullptr, virtual_size, PROT_NONE, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0)); if (virtual_base == MAP_FAILED) { LOG_CRITICAL(HW_Memory, "mmap failed: {}", strerror(errno)); throw std::bad_alloc{}; } + madvise(virtual_base, virtual_size, MADV_HUGEPAGE); +#endif good = true; } 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) std::string VfsFile::GetFullPath() const { if (GetContainingDirectory() == nullptr) - return "/" + GetName(); + return '/' + GetName(); - return GetContainingDirectory()->GetFullPath() + "/" + GetName(); + return GetContainingDirectory()->GetFullPath() + '/' + GetName(); } VirtualFile VfsDirectory::GetFileRelative(std::string_view path) const { @@ -435,7 +435,7 @@ std::string VfsDirectory::GetFullPath() const { if (IsRoot()) return GetName(); - return GetParentDirectory()->GetFullPath() + "/" + GetName(); + return GetParentDirectory()->GetFullPath() + '/' + GetName(); } bool 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() { touch_params[index++] = std::move(touchscreen_param); } + if (Settings::values.touch_from_button_maps.empty()) { + LOG_WARNING(Input, "touch_from_button_maps is unset by frontend config"); + return; + } + const auto button_index = static_cast<u64>(Settings::values.touch_from_button_map_index.GetValue()); 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 @@ namespace Core::HID { constexpr s32 HID_JOYSTICK_MAX = 0x7fff; constexpr s32 HID_TRIGGER_MAX = 0x7fff; +// Use a common UUID for TAS and Virtual Gamepad +constexpr Common::UUID TAS_UUID = + Common::UUID{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; +constexpr Common::UUID VIRTUAL_UUID = + Common::UUID{{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; EmulatedController::EmulatedController(NpadIdType npad_id_type_) : npad_id_type(npad_id_type_) {} @@ -348,10 +353,6 @@ void EmulatedController::ReloadInput() { } } - // Use a common UUID for TAS - static constexpr Common::UUID TAS_UUID = Common::UUID{ - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xA5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; - // Register TAS devices. No need to force update for (std::size_t index = 0; index < tas_button_devices.size(); ++index) { if (!tas_button_devices[index]) { @@ -377,10 +378,6 @@ void EmulatedController::ReloadInput() { }); } - // Use a common UUID for Virtual Gamepad - static constexpr Common::UUID VIRTUAL_UUID = Common::UUID{ - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0xFF, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}}; - // Register virtual devices. No need to force update for (std::size_t index = 0; index < virtual_button_devices.size(); ++index) { if (!virtual_button_devices[index]) { @@ -780,7 +777,12 @@ void EmulatedController::SetStick(const Common::Input::CallbackStatus& callback, // Only read stick values that have the same uuid or are over the threshold to avoid flapping if (controller.stick_values[index].uuid != uuid) { - if (!stick_value.down && !stick_value.up && !stick_value.left && !stick_value.right) { + const bool is_tas = uuid == TAS_UUID; + if (is_tas && stick_value.x.value == 0 && stick_value.y.value == 0) { + return; + } + if (!is_tas && !stick_value.down && !stick_value.up && !stick_value.left && + !stick_value.right) { return; } } 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 { namespace Service::NIFM { +// This is nn::nifm::RequestState enum class RequestState : u32 { NotSubmitted = 1, - Error = 1, ///< The duplicate 1 is intentional; it means both not submitted and error on HW. - Pending = 2, - Connected = 3, + Invalid = 1, ///< The duplicate 1 is intentional; it means both not submitted and error on HW. + OnHold = 2, + Accepted = 3, + Blocking = 4, }; -enum class InternetConnectionType : u8 { - WiFi = 1, +// This is nn::nifm::NetworkInterfaceType +enum class NetworkInterfaceType : u32 { + Invalid = 0, + WiFi_Ieee80211 = 1, Ethernet = 2, }; @@ -42,14 +46,23 @@ enum class InternetConnectionStatus : u8 { Connected, }; +// This is nn::nifm::NetworkProfileType +enum class NetworkProfileType : u32 { + User, + SsidList, + Temporary, +}; + +// This is nn::nifm::IpAddressSetting struct IpAddressSetting { bool is_automatic{}; - Network::IPv4Address current_address{}; + Network::IPv4Address ip_address{}; Network::IPv4Address subnet_mask{}; - Network::IPv4Address gateway{}; + Network::IPv4Address default_gateway{}; }; static_assert(sizeof(IpAddressSetting) == 0xD, "IpAddressSetting has incorrect size."); +// This is nn::nifm::DnsSetting struct DnsSetting { bool is_automatic{}; Network::IPv4Address primary_dns{}; @@ -57,18 +70,26 @@ struct DnsSetting { }; static_assert(sizeof(DnsSetting) == 0x9, "DnsSetting has incorrect size."); +// This is nn::nifm::AuthenticationSetting +struct AuthenticationSetting { + bool is_enabled{}; + std::array<char, 0x20> user{}; + std::array<char, 0x20> password{}; +}; +static_assert(sizeof(AuthenticationSetting) == 0x41, "AuthenticationSetting has incorrect size."); + +// This is nn::nifm::ProxySetting struct ProxySetting { - bool enabled{}; + bool is_enabled{}; INSERT_PADDING_BYTES(1); u16 port{}; std::array<char, 0x64> proxy_server{}; - bool automatic_auth_enabled{}; - std::array<char, 0x20> user{}; - std::array<char, 0x20> password{}; + AuthenticationSetting authentication{}; INSERT_PADDING_BYTES(1); }; static_assert(sizeof(ProxySetting) == 0xAA, "ProxySetting has incorrect size."); +// This is nn::nifm::IpSettingData struct IpSettingData { IpAddressSetting ip_address_setting{}; DnsSetting dns_setting{}; @@ -101,6 +122,7 @@ static_assert(sizeof(NifmWirelessSettingData) == 0x70, "NifmWirelessSettingData has incorrect size."); #pragma pack(push, 1) +// This is nn::nifm::detail::sf::NetworkProfileData struct SfNetworkProfileData { IpSettingData ip_setting_data{}; u128 uuid{}; @@ -114,13 +136,14 @@ struct SfNetworkProfileData { }; static_assert(sizeof(SfNetworkProfileData) == 0x17C, "SfNetworkProfileData has incorrect size."); +// This is nn::nifm::NetworkProfileData struct NifmNetworkProfileData { u128 uuid{}; std::array<char, 0x40> network_name{}; - u32 unknown_1{}; - u32 unknown_2{}; - u8 unknown_3{}; - u8 unknown_4{}; + NetworkProfileType network_profile_type{}; + NetworkInterfaceType network_interface_type{}; + bool is_auto_connect{}; + bool is_large_capacity{}; INSERT_PADDING_BYTES(2); NifmWirelessSettingData wireless_setting_data{}; IpSettingData ip_setting_data{}; @@ -184,6 +207,7 @@ public: event1 = CreateKEvent(service_context, "IRequest:Event1"); event2 = CreateKEvent(service_context, "IRequest:Event2"); + state = RequestState::NotSubmitted; } ~IRequest() override { @@ -196,7 +220,7 @@ private: LOG_WARNING(Service_NIFM, "(STUBBED) called"); if (state == RequestState::NotSubmitted) { - UpdateState(RequestState::Pending); + UpdateState(RequestState::OnHold); } IPC::ResponseBuilder rb{ctx, 2}; @@ -219,14 +243,14 @@ private: switch (state) { case RequestState::NotSubmitted: return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled; - case RequestState::Pending: + case RequestState::OnHold: if (has_connection) { - UpdateState(RequestState::Connected); + UpdateState(RequestState::Accepted); } else { - UpdateState(RequestState::Error); + UpdateState(RequestState::Invalid); } return ResultPendingConnection; - case RequestState::Connected: + case RequestState::Accepted: default: return ResultSuccess; } @@ -338,9 +362,9 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { .ip_setting_data{ .ip_address_setting{ .is_automatic{true}, - .current_address{Network::TranslateIPv4(net_iface->ip_address)}, + .ip_address{Network::TranslateIPv4(net_iface->ip_address)}, .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)}, - .gateway{Network::TranslateIPv4(net_iface->gateway)}, + .default_gateway{Network::TranslateIPv4(net_iface->gateway)}, }, .dns_setting{ .is_automatic{true}, @@ -348,12 +372,14 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { .secondary_dns{1, 0, 0, 1}, }, .proxy_setting{ - .enabled{false}, + .is_enabled{false}, .port{}, .proxy_server{}, - .automatic_auth_enabled{}, - .user{}, - .password{}, + .authentication{ + .is_enabled{}, + .user{}, + .password{}, + }, }, .mtu{1500}, }, @@ -370,7 +396,7 @@ void IGeneralService::GetCurrentNetworkProfile(Kernel::HLERequestContext& ctx) { // When we're connected to a room, spoof the hosts IP address if (auto room_member = network.GetRoomMember().lock()) { if (room_member->IsConnected()) { - network_profile_data.ip_setting_data.ip_address_setting.current_address = + network_profile_data.ip_setting_data.ip_address_setting.ip_address = room_member->GetFakeIpAddress(); } } @@ -444,9 +470,9 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) { return IpConfigInfo{ .ip_address_setting{ .is_automatic{true}, - .current_address{Network::TranslateIPv4(net_iface->ip_address)}, + .ip_address{Network::TranslateIPv4(net_iface->ip_address)}, .subnet_mask{Network::TranslateIPv4(net_iface->subnet_mask)}, - .gateway{Network::TranslateIPv4(net_iface->gateway)}, + .default_gateway{Network::TranslateIPv4(net_iface->gateway)}, }, .dns_setting{ .is_automatic{true}, @@ -459,7 +485,7 @@ void IGeneralService::GetCurrentIpConfigInfo(Kernel::HLERequestContext& ctx) { // When we're connected to a room, spoof the hosts IP address if (auto room_member = network.GetRoomMember().lock()) { if (room_member->IsConnected()) { - ip_config_info.ip_address_setting.current_address = room_member->GetFakeIpAddress(); + ip_config_info.ip_address_setting.ip_address = room_member->GetFakeIpAddress(); } } @@ -480,7 +506,7 @@ void IGeneralService::GetInternetConnectionStatus(Kernel::HLERequestContext& ctx LOG_WARNING(Service_NIFM, "(STUBBED) called"); struct Output { - InternetConnectionType type{InternetConnectionType::WiFi}; + u8 type{static_cast<u8>(NetworkInterfaceType::WiFi_Ieee80211)}; u8 wifi_strength{3}; InternetConnectionStatus state{InternetConnectionStatus::Connected}; }; 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 @@ # SPDX-FileCopyrightText: 2017 Citra Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) - add_executable(yuzu-room precompiled_headers.h 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 @@ add_library(input_common STATIC drivers/camera.cpp drivers/camera.h - drivers/gc_adapter.cpp - drivers/gc_adapter.h drivers/keyboard.cpp drivers/keyboard.h drivers/mouse.cpp drivers/mouse.h - drivers/sdl_driver.cpp - drivers/sdl_driver.h drivers/tas_input.cpp drivers/tas_input.h drivers/touch_screen.cpp @@ -62,8 +58,17 @@ if (ENABLE_SDL2) target_compile_definitions(input_common PRIVATE HAVE_SDL2) endif() +if (ENABLE_LIBUSB) + target_sources(input_common PRIVATE + drivers/gc_adapter.cpp + drivers/gc_adapter.h + ) + target_link_libraries(input_common PRIVATE libusb::usb) + target_compile_definitions(input_common PRIVATE HAVE_LIBUSB) +endif() + create_target_directory_groups(input_common) -target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost libusb::usb) +target_link_libraries(input_common PUBLIC core PRIVATE common Boost::boost) if (YUZU_USE_PRECOMPILED_HEADERS) 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 @@ #include "common/input.h" #include "common/param_package.h" #include "input_common/drivers/camera.h" -#include "input_common/drivers/gc_adapter.h" #include "input_common/drivers/keyboard.h" #include "input_common/drivers/mouse.h" #include "input_common/drivers/tas_input.h" @@ -19,6 +18,10 @@ #include "input_common/input_mapping.h" #include "input_common/input_poller.h" #include "input_common/main.h" + +#ifdef HAVE_LIBUSB +#include "input_common/drivers/gc_adapter.h" +#endif #ifdef HAVE_SDL2 #include "input_common/drivers/sdl_driver.h" #endif @@ -45,7 +48,9 @@ struct InputSubsystem::Impl { RegisterEngine("keyboard", keyboard); RegisterEngine("mouse", mouse); RegisterEngine("touch", touch_screen); +#ifdef HAVE_LIBUSB RegisterEngine("gcpad", gcadapter); +#endif RegisterEngine("cemuhookudp", udp_client); RegisterEngine("tas", tas_input); RegisterEngine("camera", camera); @@ -72,7 +77,9 @@ struct InputSubsystem::Impl { UnregisterEngine(keyboard); UnregisterEngine(mouse); UnregisterEngine(touch_screen); +#ifdef HAVE_LIBUSB UnregisterEngine(gcadapter); +#endif UnregisterEngine(udp_client); UnregisterEngine(tas_input); UnregisterEngine(camera); @@ -95,8 +102,10 @@ struct InputSubsystem::Impl { devices.insert(devices.end(), keyboard_devices.begin(), keyboard_devices.end()); auto mouse_devices = mouse->GetInputDevices(); devices.insert(devices.end(), mouse_devices.begin(), mouse_devices.end()); +#ifdef HAVE_LIBUSB auto gcadapter_devices = gcadapter->GetInputDevices(); devices.insert(devices.end(), gcadapter_devices.begin(), gcadapter_devices.end()); +#endif auto udp_devices = udp_client->GetInputDevices(); devices.insert(devices.end(), udp_devices.begin(), udp_devices.end()); #ifdef HAVE_SDL2 @@ -119,9 +128,11 @@ struct InputSubsystem::Impl { if (engine == mouse->GetEngineName()) { return mouse; } +#ifdef HAVE_LIBUSB if (engine == gcadapter->GetEngineName()) { return gcadapter; } +#endif if (engine == udp_client->GetEngineName()) { return udp_client; } @@ -194,9 +205,11 @@ struct InputSubsystem::Impl { if (engine == mouse->GetEngineName()) { return true; } +#ifdef HAVE_LIBUSB if (engine == gcadapter->GetEngineName()) { return true; } +#endif if (engine == udp_client->GetEngineName()) { return true; } @@ -217,7 +230,9 @@ struct InputSubsystem::Impl { void BeginConfiguration() { keyboard->BeginConfiguration(); mouse->BeginConfiguration(); +#ifdef HAVE_LIBUSB gcadapter->BeginConfiguration(); +#endif udp_client->BeginConfiguration(); #ifdef HAVE_SDL2 sdl->BeginConfiguration(); @@ -227,7 +242,9 @@ struct InputSubsystem::Impl { void EndConfiguration() { keyboard->EndConfiguration(); mouse->EndConfiguration(); +#ifdef HAVE_LIBUSB gcadapter->EndConfiguration(); +#endif udp_client->EndConfiguration(); #ifdef HAVE_SDL2 sdl->EndConfiguration(); @@ -248,7 +265,6 @@ struct InputSubsystem::Impl { std::shared_ptr<Keyboard> keyboard; std::shared_ptr<Mouse> mouse; - std::shared_ptr<GCAdapter> gcadapter; std::shared_ptr<TouchScreen> touch_screen; std::shared_ptr<TasInput::Tas> tas_input; std::shared_ptr<CemuhookUDP::UDPClient> udp_client; @@ -256,6 +272,10 @@ struct InputSubsystem::Impl { std::shared_ptr<VirtualAmiibo> virtual_amiibo; std::shared_ptr<VirtualGamepad> virtual_gamepad; +#ifdef HAVE_LIBUSB + std::shared_ptr<GCAdapter> gcadapter; +#endif + #ifdef HAVE_SDL2 std::shared_ptr<SDLDriver> sdl; #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) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) # Set the RPATH for Qt Libraries # 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() { ReadRendererValues(); ReadAudioValues(); ReadSystemValues(); - ReadMultiplayerValues(); } void Config::SavePlayerValue(std::size_t player_index) { @@ -1099,7 +1098,6 @@ void Config::SaveValues() { SaveRendererValues(); SaveAudioValues(); SaveSystemValues(); - SaveMultiplayerValues(); } void 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 @@ #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_system.h" +constexpr std::array<u32, 7> LOCALE_BLOCKLIST{ + // pzzefezrpnkzeidfej + // thhsrnhutlohsternp + // BHH4CG U + // Raa1AB S + // nn9 + // ts + 0b0100011100001100000, // Japan + 0b0000001101001100100, // Americas + 0b0100110100001000010, // Europe + 0b0100110100001000010, // Australia + 0b0000000000000000000, // China + 0b0100111100001000000, // Korea + 0b0100111100001000000, // Taiwan +}; + +static bool IsValidLocale(u32 region_index, u32 language_index) { + return ((LOCALE_BLOCKLIST.at(region_index) >> language_index) & 1) == 0; +} + ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) : QWidget(parent), ui{std::make_unique<Ui::ConfigureSystem>()}, system{system_} { ui->setupUi(this); @@ -34,6 +54,22 @@ ConfigureSystem::ConfigureSystem(Core::System& system_, QWidget* parent) } }); + const auto locale_check = [this](int index) { + const bool valid_locale = + IsValidLocale(ui->combo_region->currentIndex(), ui->combo_language->currentIndex()); + ui->label_warn_invalid_locale->setVisible(!valid_locale); + if (!valid_locale) { + ui->label_warn_invalid_locale->setText( + tr("Warning: \"%1\" is not a valid language for region \"%2\"") + .arg(ui->combo_language->currentText()) + .arg(ui->combo_region->currentText())); + } + }; + + connect(ui->combo_language, qOverload<int>(&QComboBox::currentIndexChanged), this, + locale_check); + connect(ui->combo_region, qOverload<int>(&QComboBox::currentIndexChanged), this, locale_check); + ui->label_console_id->setVisible(Settings::IsConfiguringGlobal()); ui->button_regenerate_console_id->setVisible(Settings::IsConfiguringGlobal()); 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 @@ </item> <item> <property name="text"> - <string>English</string> + <string>American English</string> </property> </item> <item> @@ -546,6 +546,16 @@ </spacer> </item> <item> + <widget class="QLabel" name="label_warn_invalid_locale"> + <property name="text"> + <string></string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> <widget class="QLabel" name="label_disable_info"> <property name="text"> <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) { case Core::HID::ControllerTriggerType::Button: case Core::HID::ControllerTriggerType::Stick: { const auto buttons_values = controller->GetButtonsValues(); - const auto stick_values = controller->GetSticksValues(); + const auto stick_values = controller->GetSticks(); u64 buttons = 0; std::size_t index = 0; for (const auto& button : buttons_values) { @@ -101,12 +101,12 @@ void ControllerDialog::ControllerUpdate(Core::HID::ControllerTriggerType type) { index++; } const InputCommon::TasInput::TasAnalog left_axis = { - .x = stick_values[Settings::NativeAnalog::LStick].x.value, - .y = stick_values[Settings::NativeAnalog::LStick].y.value, + .x = stick_values.left.x / 32767.f, + .y = stick_values.left.y / 32767.f, }; const InputCommon::TasInput::TasAnalog right_axis = { - .x = stick_values[Settings::NativeAnalog::RStick].x.value, - .y = stick_values[Settings::NativeAnalog::RStick].y.value, + .x = stick_values.right.x / 32767.f, + .y = stick_values.right.y / 32767.f, }; input_subsystem->GetTas()->RecordInput(buttons, left_axis, right_axis); 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 @@ # SPDX-FileCopyrightText: 2018 yuzu Emulator Project # SPDX-License-Identifier: GPL-2.0-or-later -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) - # Credits to Samantas5855 and others for this function. function(create_resource file output filename) # Read hex data from file |