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
=============
This is the source code for early-access 3395.
This is the source code for early-access 3396.
## Legal Notice

View file

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

View file

@ -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<NetworkInfo> network_infos(network_info_size);
Result rc = lan_discovery.Scan(network_infos, count, scan_filter);
@ -503,19 +488,19 @@ 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);
}
}
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<Network::LDNPacket> ldn_packet_received;
bool is_initialized{};
bool is_network_available{};
};
class LDNS final : public ServiceFramework<LDNS> {

View file

@ -200,7 +200,7 @@ std::optional<NetworkInterface> 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;
}

View file

@ -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);