From fa3f443accc819847764d34583bac7da95e7a53e Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Mon, 13 Feb 2023 21:21:38 +0100 Subject: [PATCH] early-access version 3396 --- README.md | 2 +- .../renderer/command/command_buffer.cpp | 4 +- src/core/hle/service/ldn/lan_discovery.cpp | 11 ++++- src/core/hle/service/ldn/ldn.cpp | 45 ++++++------------- .../internal_network/network_interface.cpp | 2 +- src/yuzu/main.cpp | 1 + 6 files changed, 27 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 48440f19b..6defc6b0e 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3395. +This is the source code for early-access 3396. ## Legal Notice diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp index 08b92bcab..4b87304f3 100755 --- a/src/audio_core/renderer/command/command_buffer.cpp +++ b/src/audio_core/renderer/command/command_buffer.cpp @@ -251,8 +251,8 @@ void CommandBuffer::GenerateBiquadFilterCommand(const s32 node_id, EffectInfoBas const auto& parameter{ *reinterpret_cast(effect_info.GetParameter())}; - const auto state{ - reinterpret_cast(effect_info.GetStateBuffer())}; + const auto state{reinterpret_cast( + effect_info.GetStateBuffer() + channel * sizeof(VoiceState::BiquadFilterState))}; cmd.input = buffer_offset + parameter.inputs[channel]; cmd.output = buffer_offset + parameter.outputs[channel]; diff --git a/src/core/hle/service/ldn/lan_discovery.cpp b/src/core/hle/service/ldn/lan_discovery.cpp index b5a0e0513..478557dda 100755 --- a/src/core/hle/service/ldn/lan_discovery.cpp +++ b/src/core/hle/service/ldn/lan_discovery.cpp @@ -487,7 +487,7 @@ void LANDiscovery::ReceivePacket(const Network::LDNPacket& packet) { std::scoped_lock lock{packet_mutex}; switch (packet.type) { case Network::LDNPacketType::Scan: { - LOG_DEBUG(Frontend, "Scan packet received!"); + LOG_INFO(Frontend, "Scan packet received!"); if (state == State::AccessPointCreated) { // Reply to the sender SendPacket(Network::LDNPacketType::ScanResp, network_info, packet.local_ip); @@ -495,7 +495,7 @@ void LANDiscovery::ReceivePacket(const Network::LDNPacket& packet) { break; } case Network::LDNPacketType::ScanResp: { - LOG_DEBUG(Frontend, "ScanResp packet received!"); + LOG_INFO(Frontend, "ScanResp packet received!"); NetworkInfo info{}; std::memcpy(&info, packet.data.data(), sizeof(NetworkInfo)); @@ -611,6 +611,13 @@ MacAddress LANDiscovery::GetFakeMac() const { Result LANDiscovery::GetNodeInfo(NodeInfo& node, const UserConfig& userConfig, u16 localCommunicationVersion) { + const auto network_interface = Network::GetSelectedNetworkInterface(); + + if (!network_interface) { + LOG_ERROR(Service_LDN, "No network interface available"); + return ResultNoIpAddress; + } + node.mac_address = GetFakeMac(); node.is_connected = 1; std::memcpy(node.user_name.data(), userConfig.user_name.data(), UserNameBytesMax + 1); diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index edd170132..c544812e9 100755 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp @@ -150,7 +150,7 @@ public: } ~IUserLocalCommunicationService() { - if (is_network_available) { + if (is_initialized) { if (auto room_member = room_network.GetRoomMember().lock()) { room_member->Unbind(ldn_packet_received); } @@ -193,7 +193,7 @@ public: NetworkInfo network_info{}; const auto rc = lan_discovery.GetNetworkInfo(network_info); if (rc.IsError()) { - LOG_DEBUG(Service_LDN, "NetworkInfo is not valid {}", rc.raw); + LOG_ERROR(Service_LDN, "NetworkInfo is not valid {}", rc.raw); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(rc); return; @@ -205,14 +205,6 @@ public: } void GetIpv4Address(Kernel::HLERequestContext& ctx) { - if (!is_network_available) { - IPC::ResponseBuilder rb{ctx, 4}; - rb.Push(ResultSuccess); - rb.PushRaw(Ipv4Address{127, 0, 0, 1}); - rb.PushRaw(Ipv4Address{255, 255, 255, 0}); - return; - } - const auto network_interface = Network::GetSelectedNetworkInterface(); if (!network_interface) { @@ -350,13 +342,6 @@ public: return; } - if (!is_network_available) { - IPC::ResponseBuilder rb{ctx, 3}; - rb.Push(ResultSuccess); - rb.Push(0); - return; - } - u16 count = 0; std::vector network_infos(network_info_size); Result rc = lan_discovery.Scan(network_infos, count, scan_filter); @@ -503,18 +488,18 @@ public: } void Initialize(Kernel::HLERequestContext& ctx) { - InitializeImpl(ctx); + const auto rc = InitializeImpl(ctx); + if (rc.IsError()) { + LOG_ERROR(Service_LDN, "Network isn't initialized, rc={}", rc.raw); + } - // Initialize always returns success IPC::ResponseBuilder rb{ctx, 2}; - rb.Push(ResultSuccess); + rb.Push(rc); } void Finalize(Kernel::HLERequestContext& ctx) { - if (is_network_available) { - if (auto room_member = room_network.GetRoomMember().lock()) { - room_member->Unbind(ldn_packet_received); - } + if (auto room_member = room_network.GetRoomMember().lock()) { + room_member->Unbind(ldn_packet_received); } is_initialized = false; @@ -534,25 +519,22 @@ public: } Result InitializeImpl(Kernel::HLERequestContext& ctx) { - lan_discovery.Initialize([&]() { OnEventFired(); }); - is_initialized = true; - is_network_available = false; - const auto network_interface = Network::GetSelectedNetworkInterface(); if (!network_interface) { LOG_ERROR(Service_LDN, "No network interface is set"); - return ResultSuccess; + return ResultAirplaneModeEnabled; } if (auto room_member = room_network.GetRoomMember().lock()) { ldn_packet_received = room_member->BindOnLdnPacketReceived( [this](const Network::LDNPacket& packet) { OnLDNPacketReceived(packet); }); - is_network_available = true; } else { LOG_ERROR(Service_LDN, "Couldn't bind callback!"); - return ResultSuccess; + return ResultAirplaneModeEnabled; } + lan_discovery.Initialize([&]() { OnEventFired(); }); + is_initialized = true; return ResultSuccess; } @@ -565,7 +547,6 @@ public: Network::RoomMember::CallbackHandle ldn_packet_received; bool is_initialized{}; - bool is_network_available{}; }; class LDNS final : public ServiceFramework { diff --git a/src/core/internal_network/network_interface.cpp b/src/core/internal_network/network_interface.cpp index 7248a8080..9097d502f 100755 --- a/src/core/internal_network/network_interface.cpp +++ b/src/core/internal_network/network_interface.cpp @@ -200,7 +200,7 @@ std::optional GetSelectedNetworkInterface() { }); if (res == network_interfaces.end()) { - LOG_DEBUG(Network, "Couldn't find selected interface \"{}\"", selected_network_interface); + LOG_ERROR(Network, "Couldn't find selected interface \"{}\"", selected_network_interface); return std::nullopt; } diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index c7314c4cc..013f84a09 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -955,6 +955,7 @@ void GMainWindow::InitializeWidgets() { statusBar()->addPermanentWidget(label); } + // TODO (flTobi): Add the widget when multiplayer is fully implemented statusBar()->addPermanentWidget(multiplayer_state->GetStatusText(), 0); statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon(), 0);