Attempt to fix network bug

This commit is contained in:
Hamish Milne 2020-04-11 20:33:38 +01:00
parent 4be752dd98
commit 34af0d3452
2 changed files with 15 additions and 0 deletions

View File

@ -504,6 +504,9 @@ void NWM_UDS::HandleDataFrame(const Network::WifiPacket& packet) {
/// Callback to parse and handle a received wifi packet. /// Callback to parse and handle a received wifi packet.
void NWM_UDS::OnWifiPacketReceived(const Network::WifiPacket& packet) { void NWM_UDS::OnWifiPacketReceived(const Network::WifiPacket& packet) {
if (!initialized) {
return;
}
switch (packet.type) { switch (packet.type) {
case Network::WifiPacket::PacketType::Beacon: case Network::WifiPacket::PacketType::Beacon:
HandleBeaconFrame(packet); HandleBeaconFrame(packet);

View File

@ -3,6 +3,7 @@
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <chrono> #include <chrono>
#include <boost/serialization/binary_object.hpp>
#include <cryptopp/hex.h> #include <cryptopp/hex.h>
#include "common/archives.h" #include "common/archives.h"
#include "common/logging/log.h" #include "common/logging/log.h"
@ -11,6 +12,7 @@
#include "core/cheats/cheats.h" #include "core/cheats/cheats.h"
#include "core/core.h" #include "core/core.h"
#include "core/savestate.h" #include "core/savestate.h"
#include "network/network.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
namespace Core { namespace Core {
@ -23,6 +25,11 @@ struct CSTHeader {
u64_le time; /// The time when this save state was created u64_le time; /// The time when this save state was created
std::array<u8, 216> reserved; /// Make heading 256 bytes so it has consistent size std::array<u8, 216> reserved; /// Make heading 256 bytes so it has consistent size
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
ar& boost::serialization::binary_object(this, sizeof(CSTHeader));
}
}; };
static_assert(sizeof(CSTHeader) == 256, "CSTHeader should be 256 bytes"); static_assert(sizeof(CSTHeader) == 256, "CSTHeader should be 256 bytes");
#pragma pack(pop) #pragma pack(pop)
@ -127,6 +134,11 @@ void System::SaveState(u32 slot) const {
} }
void System::LoadState(u32 slot) { void System::LoadState(u32 slot) {
if (Network::GetRoomMember().lock()->IsConnected()) {
LOG_ERROR(Core, "Unable to load while connected to multiplayer");
return;
}
const auto path = GetSaveStatePath(title_id, slot); const auto path = GetSaveStatePath(title_id, slot);
if (!FileUtil::Exists(path)) { if (!FileUtil::Exists(path)) {
LOG_ERROR(Core, "File not exist {}", path); LOG_ERROR(Core, "File not exist {}", path);