early-access version 3396

This commit is contained in:
pineappleEA 2023-02-13 21:21:38 +01:00
parent aef8eb6afb
commit fa3f443acc
6 changed files with 27 additions and 38 deletions

View File

@ -1,7 +1,7 @@
yuzu emulator early access yuzu emulator early access
============= =============
This is the source code for early-access 3395. This is the source code for early-access 3396.
## Legal Notice ## Legal Notice

View File

@ -251,8 +251,8 @@ void CommandBuffer::GenerateBiquadFilterCommand(const s32 node_id, EffectInfoBas
const auto& parameter{ const auto& parameter{
*reinterpret_cast<BiquadFilterInfo::ParameterVersion1*>(effect_info.GetParameter())}; *reinterpret_cast<BiquadFilterInfo::ParameterVersion1*>(effect_info.GetParameter())};
const auto state{ const auto state{reinterpret_cast<VoiceState::BiquadFilterState*>(
reinterpret_cast<VoiceState::BiquadFilterState*>(effect_info.GetStateBuffer())}; effect_info.GetStateBuffer() + channel * sizeof(VoiceState::BiquadFilterState))};
cmd.input = buffer_offset + parameter.inputs[channel]; cmd.input = buffer_offset + parameter.inputs[channel];
cmd.output = buffer_offset + parameter.outputs[channel]; cmd.output = buffer_offset + parameter.outputs[channel];

View File

@ -487,7 +487,7 @@ void LANDiscovery::ReceivePacket(const Network::LDNPacket& packet) {
std::scoped_lock lock{packet_mutex}; std::scoped_lock lock{packet_mutex};
switch (packet.type) { switch (packet.type) {
case Network::LDNPacketType::Scan: { case Network::LDNPacketType::Scan: {
LOG_DEBUG(Frontend, "Scan packet received!"); LOG_INFO(Frontend, "Scan packet received!");
if (state == State::AccessPointCreated) { if (state == State::AccessPointCreated) {
// Reply to the sender // Reply to the sender
SendPacket(Network::LDNPacketType::ScanResp, network_info, packet.local_ip); SendPacket(Network::LDNPacketType::ScanResp, network_info, packet.local_ip);
@ -495,7 +495,7 @@ void LANDiscovery::ReceivePacket(const Network::LDNPacket& packet) {
break; break;
} }
case Network::LDNPacketType::ScanResp: { case Network::LDNPacketType::ScanResp: {
LOG_DEBUG(Frontend, "ScanResp packet received!"); LOG_INFO(Frontend, "ScanResp packet received!");
NetworkInfo info{}; NetworkInfo info{};
std::memcpy(&info, packet.data.data(), sizeof(NetworkInfo)); std::memcpy(&info, packet.data.data(), sizeof(NetworkInfo));
@ -611,6 +611,13 @@ MacAddress LANDiscovery::GetFakeMac() const {
Result LANDiscovery::GetNodeInfo(NodeInfo& node, const UserConfig& userConfig, Result LANDiscovery::GetNodeInfo(NodeInfo& node, const UserConfig& userConfig,
u16 localCommunicationVersion) { 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.mac_address = GetFakeMac();
node.is_connected = 1; node.is_connected = 1;
std::memcpy(node.user_name.data(), userConfig.user_name.data(), UserNameBytesMax + 1); std::memcpy(node.user_name.data(), userConfig.user_name.data(), UserNameBytesMax + 1);

View File

@ -150,7 +150,7 @@ public:
} }
~IUserLocalCommunicationService() { ~IUserLocalCommunicationService() {
if (is_network_available) { if (is_initialized) {
if (auto room_member = room_network.GetRoomMember().lock()) { if (auto room_member = room_network.GetRoomMember().lock()) {
room_member->Unbind(ldn_packet_received); room_member->Unbind(ldn_packet_received);
} }
@ -193,7 +193,7 @@ public:
NetworkInfo network_info{}; NetworkInfo network_info{};
const auto rc = lan_discovery.GetNetworkInfo(network_info); const auto rc = lan_discovery.GetNetworkInfo(network_info);
if (rc.IsError()) { 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}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(rc); rb.Push(rc);
return; return;
@ -205,14 +205,6 @@ public:
} }
void GetIpv4Address(Kernel::HLERequestContext& ctx) { 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(); const auto network_interface = Network::GetSelectedNetworkInterface();
if (!network_interface) { if (!network_interface) {
@ -350,13 +342,6 @@ public:
return; return;
} }
if (!is_network_available) {
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
rb.Push(0);
return;
}
u16 count = 0; u16 count = 0;
std::vector<NetworkInfo> network_infos(network_info_size); std::vector<NetworkInfo> network_infos(network_info_size);
Result rc = lan_discovery.Scan(network_infos, count, scan_filter); Result rc = lan_discovery.Scan(network_infos, count, scan_filter);
@ -503,18 +488,18 @@ public:
} }
void Initialize(Kernel::HLERequestContext& ctx) { 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}; IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess); rb.Push(rc);
} }
void Finalize(Kernel::HLERequestContext& ctx) { void Finalize(Kernel::HLERequestContext& ctx) {
if (is_network_available) { if (auto room_member = room_network.GetRoomMember().lock()) {
if (auto room_member = room_network.GetRoomMember().lock()) { room_member->Unbind(ldn_packet_received);
room_member->Unbind(ldn_packet_received);
}
} }
is_initialized = false; is_initialized = false;
@ -534,25 +519,22 @@ public:
} }
Result InitializeImpl(Kernel::HLERequestContext& ctx) { Result InitializeImpl(Kernel::HLERequestContext& ctx) {
lan_discovery.Initialize([&]() { OnEventFired(); });
is_initialized = true;
is_network_available = false;
const auto network_interface = Network::GetSelectedNetworkInterface(); const auto network_interface = Network::GetSelectedNetworkInterface();
if (!network_interface) { if (!network_interface) {
LOG_ERROR(Service_LDN, "No network interface is set"); LOG_ERROR(Service_LDN, "No network interface is set");
return ResultSuccess; return ResultAirplaneModeEnabled;
} }
if (auto room_member = room_network.GetRoomMember().lock()) { if (auto room_member = room_network.GetRoomMember().lock()) {
ldn_packet_received = room_member->BindOnLdnPacketReceived( ldn_packet_received = room_member->BindOnLdnPacketReceived(
[this](const Network::LDNPacket& packet) { OnLDNPacketReceived(packet); }); [this](const Network::LDNPacket& packet) { OnLDNPacketReceived(packet); });
is_network_available = true;
} else { } else {
LOG_ERROR(Service_LDN, "Couldn't bind callback!"); LOG_ERROR(Service_LDN, "Couldn't bind callback!");
return ResultSuccess; return ResultAirplaneModeEnabled;
} }
lan_discovery.Initialize([&]() { OnEventFired(); });
is_initialized = true;
return ResultSuccess; return ResultSuccess;
} }
@ -565,7 +547,6 @@ public:
Network::RoomMember::CallbackHandle<Network::LDNPacket> ldn_packet_received; Network::RoomMember::CallbackHandle<Network::LDNPacket> ldn_packet_received;
bool is_initialized{}; bool is_initialized{};
bool is_network_available{};
}; };
class LDNS final : public ServiceFramework<LDNS> { class LDNS final : public ServiceFramework<LDNS> {

View File

@ -200,7 +200,7 @@ std::optional<NetworkInterface> GetSelectedNetworkInterface() {
}); });
if (res == network_interfaces.end()) { 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; return std::nullopt;
} }

View File

@ -955,6 +955,7 @@ void GMainWindow::InitializeWidgets() {
statusBar()->addPermanentWidget(label); statusBar()->addPermanentWidget(label);
} }
// TODO (flTobi): Add the widget when multiplayer is fully implemented
statusBar()->addPermanentWidget(multiplayer_state->GetStatusText(), 0); statusBar()->addPermanentWidget(multiplayer_state->GetStatusText(), 0);
statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon(), 0); statusBar()->addPermanentWidget(multiplayer_state->GetStatusIcon(), 0);