diff options
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | externals/find-modules/Findhttplib.cmake | 2 | ||||
-rw-r--r-- | externals/find-modules/Findlz4.cmake | 2 | ||||
-rw-r--r-- | externals/find-modules/Findzstd.cmake | 2 | ||||
-rw-r--r-- | src/core/hle/service/nifm/nifm.cpp | 88 | ||||
-rw-r--r-- | src/yuzu/debugger/controller.cpp | 10 |
6 files changed, 77 insertions, 50 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index cf366c24f..ed22187fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,42 +203,43 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) # System imported libraries # ======================================================================= -find_package(enet 1.3) +# Enforce the search mode of non-required packages for better and shorter failure messages +find_package(enet 1.3 MODULE) find_package(fmt 9 REQUIRED) -find_package(inih) +find_package(inih MODULE) find_package(lz4 REQUIRED) find_package(nlohmann_json 3.8 REQUIRED) -find_package(Opus 1.3) +find_package(Opus 1.3 MODULE) find_package(ZLIB 1.2 REQUIRED) find_package(zstd 1.5 REQUIRED) if (NOT YUZU_USE_EXTERNAL_VULKAN_HEADERS) - find_package(Vulkan 1.3.238) + find_package(Vulkan 1.3.238 REQUIRED) endif() if (ENABLE_LIBUSB) - find_package(libusb 1.0.24) + find_package(libusb 1.0.24 MODULE) endif() if (ARCHITECTURE_x86 OR ARCHITECTURE_x86_64) - find_package(xbyak 6 QUIET) + find_package(xbyak 6 CONFIG) endif() if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64) - find_package(dynarmic 6.4.0 QUIET) + find_package(dynarmic 6.4.0 CONFIG) endif() if (ENABLE_CUBEB) - find_package(cubeb QUIET) + find_package(cubeb CONFIG) endif() if (USE_DISCORD_PRESENCE) - find_package(DiscordRPC QUIET) + find_package(DiscordRPC MODULE) endif() if (ENABLE_WEB_SERVICE) - find_package(cpp-jwt 1.4 QUIET) - find_package(httplib 0.11 QUIET) + find_package(cpp-jwt 1.4 CONFIG) + find_package(httplib 0.11 MODULE) endif() if (YUZU_TESTS) diff --git a/externals/find-modules/Findhttplib.cmake b/externals/find-modules/Findhttplib.cmake index 4d17cb393..861207eb5 100644 --- a/externals/find-modules/Findhttplib.cmake +++ b/externals/find-modules/Findhttplib.cmake @@ -5,7 +5,7 @@ include(FindPackageHandleStandardArgs) find_package(httplib QUIET CONFIG) -if (httplib_FOUND) +if (httplib_CONSIDERED_CONFIGS) find_package_handle_standard_args(httplib CONFIG_MODE) else() find_package(PkgConfig QUIET) diff --git a/externals/find-modules/Findlz4.cmake b/externals/find-modules/Findlz4.cmake index c82405c59..7a9a02d4e 100644 --- a/externals/find-modules/Findlz4.cmake +++ b/externals/find-modules/Findlz4.cmake @@ -4,7 +4,7 @@ include(FindPackageHandleStandardArgs) find_package(lz4 QUIET CONFIG) -if (lz4_FOUND) +if (lz4_CONSIDERED_CONFIGS) find_package_handle_standard_args(lz4 CONFIG_MODE) else() find_package(PkgConfig QUIET) diff --git a/externals/find-modules/Findzstd.cmake b/externals/find-modules/Findzstd.cmake index f6eb9643a..ae3ea0865 100644 --- a/externals/find-modules/Findzstd.cmake +++ b/externals/find-modules/Findzstd.cmake @@ -4,7 +4,7 @@ include(FindPackageHandleStandardArgs) find_package(zstd QUIET CONFIG) -if (zstd_FOUND) +if (zstd_CONSIDERED_CONFIGS) find_package_handle_standard_args(zstd CONFIG_MODE) else() find_package(PkgConfig QUIET) 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/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; |