More errors pounded down

This commit is contained in:
R2DLiu 2020-07-03 02:41:06 -04:00
commit 6857a445e4
14 changed files with 20314 additions and 33 deletions

View file

@ -545,8 +545,9 @@ else()
endif()
add_subdirectory(Externals/glslang)
add_subdirectory(Externals/imgui)
add_subdirectory(Externals/Slippi)
include_directories(Externals/Slippi)
add_subdirectory(Externals/SlippiLib)
include_directories(Externals/SlippiLib)
include_directories(Externals/nlohmann)
add_subdirectory(Externals/semver)
include_directories(Externals/semver/include)
add_subdirectory(Externals/open-vcdiff)

View file

@ -1,4 +1,4 @@
project(Slippi
project(SlippiLib
VERSION 1.0.0)
set(SRCS
@ -15,5 +15,5 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter")
endif()
add_library(Slippi STATIC ${SRCS})
add_library(SlippiLib STATIC ${SRCS})

View file

File diff suppressed because it is too large Load diff

View file

@ -53,6 +53,7 @@
} while (0)
#endif
#undef ASSERT
#define ASSERT(_a_) \
do \
{ \

View file

@ -150,7 +150,7 @@ std::unique_ptr<IEXIDevice> EXIDevice_Create(const TEXIDevices device_type, cons
break;
case EXIDEVICE_SLIPPI:
result = std::make_unique<CEXISlippi>(channel_num);
result = std::make_unique<CEXISlippi>();
break;
case EXIDEVICE_AM_BASEBOARD:

View file

@ -379,18 +379,18 @@ void CEXISlippi::writeToFileAsync(u8* payload, u32 length, std::string fileOptio
writeMsg->data = payloadData;
writeMsg->operation = fileOption;
fileWriteQueue.Push(std::move(writeMsg));
fileWriteQueue.push(std::move(writeMsg));
}
void CEXISlippi::FileWriteThread(void)
{
while (writeThreadRunning || !fileWriteQueue.Empty())
while (writeThreadRunning || !fileWriteQueue.empty())
{
// Process all messages
while (!fileWriteQueue.Empty())
while (!fileWriteQueue.empty())
{
writeToFile(std::move(fileWriteQueue.Front()));
fileWriteQueue.Pop();
writeToFile(std::move(fileWriteQueue.front()));
fileWriteQueue.pop();
Common::SleepCurrentThread(0);
}

View file

@ -8,6 +8,7 @@
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/File.h"
#include "EXI_Device.h"
#include "Core/Slippi/SlippiGameFileLoader.h"
#include "Core/Slippi/SlippiMatchmaking.h"
@ -176,7 +177,7 @@ namespace ExpansionInterface
void FileWriteThread(void);
Common::FifoQueue<std::unique_ptr<WriteMessage>, false> fileWriteQueue;
std::queue<std::unique_ptr<WriteMessage>> fileWriteQueue;
bool writeThreadRunning = false;
std::thread m_fileWriteThread;

View file

@ -8,8 +8,9 @@
#include <enet/enet.h>
#include <unordered_map>
#include <vector>
#include <random>
#include <json.hpp>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
class SlippiMatchmaking

View file

@ -6,19 +6,22 @@
#include "Common/Common.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/Config/Config.h"
#include "Common/ENetUtil.h"
#include "Common/MD5.h"
#include "Common/MsgHandler.h"
#include "Common/Timer.h"
#include "Core/ConfigManager.h"
#include "Core/NetplayProto.h"
#include "Core/Core.h"
#include "Core/HW/EXI_DeviceIPL.h"
#include "Core/HW/SI.h"
#include "Core/HW/SI_DeviceGCController.h"
#include "Core/Config/NetplaySettings.h"
//#include "Core/HW/EXI_DeviceIPL.h"
//#include "Core/HW/SI.h"
//#include "Core/HW/SI_DeviceGCController.h"
#include "Core/HW/Sram.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
//#include "Core/IPC_HLE/WII_IPC_HLE_Device_usb_bt_emu.h"
#include "Core/Movie.h"
#include "InputCommon/GCAdapter.h"
#include "VideoCommon/OnScreenDisplay.h"
@ -122,12 +125,12 @@ SlippiNetplayClient::SlippiNetplayClient(bool isDecider)
// called from ---NETPLAY--- thread
unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
{
MessageId mid;
NetPlay::MessageId mid;
packet >> mid;
switch (mid)
{
case NP_MSG_SLIPPI_PAD:
case NetPlay::NP_MSG_SLIPPI_PAD:
{
int32_t frame;
packet >> frame;
@ -186,13 +189,13 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
// Send Ack
sf::Packet spac;
spac << (MessageId)NP_MSG_SLIPPI_PAD_ACK;
spac << (NetPlay::MessageId)NetPlay::NP_MSG_SLIPPI_PAD_ACK;
spac << frame;
Send(spac);
}
break;
case NP_MSG_SLIPPI_PAD_ACK:
case NetPlay::NP_MSG_SLIPPI_PAD_ACK:
{
std::lock_guard<std::mutex> lk(ack_mutex); // Trying to fix rare crash on ackTimers.count
@ -226,7 +229,7 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
}
break;
case NP_MSG_SLIPPI_MATCH_SELECTIONS:
case NetPlay::NP_MSG_SLIPPI_MATCH_SELECTIONS:
{
auto s = readSelectionsFromPacket(packet);
ERROR_LOG(SLIPPI_ONLINE, "[Received Selections] Char: 0x%X, Color: 0x%X", s->characterId, s->characterId);
@ -246,7 +249,7 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
}
break;
case NP_MSG_SLIPPI_CONN_SELECTED:
case NetPlay::NP_MSG_SLIPPI_CONN_SELECTED:
{
// Currently this is unused but the intent is to support two-way simultaneous connection attempts
isConnectionSelected = true;
@ -263,7 +266,7 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
void SlippiNetplayClient::writeToPacket(sf::Packet& packet, SlippiPlayerSelections& s)
{
packet << static_cast<MessageId>(NP_MSG_SLIPPI_MATCH_SELECTIONS);
packet << static_cast<NetPlay::MessageId>(NetPlay::NP_MSG_SLIPPI_MATCH_SELECTIONS);
packet << s.characterId << s.characterColor << s.isCharacterSelected;
packet << s.stageId << s.isStageSelected;
packet << s.rngOffset;
@ -294,8 +297,8 @@ void SlippiNetplayClient::Send(sf::Packet& packet)
enet_uint32 flags = ENET_PACKET_FLAG_RELIABLE;
u8 channelId = 0;
MessageId mid = ((u8*)packet.getData())[0];
if (mid == NP_MSG_SLIPPI_PAD || mid == NP_MSG_SLIPPI_PAD_ACK)
NetPlay::MessageId mid = ((u8*)packet.getData())[0];
if (mid == NetPlay::NP_MSG_SLIPPI_PAD || mid == NetPlay::NP_MSG_SLIPPI_PAD_ACK)
{
// Slippi communications do not need reliable connection and do not need to
// be received in order. Channel is changed so that other reliable communications
@ -340,7 +343,7 @@ void SlippiNetplayClient::SendAsync(std::unique_ptr<sf::Packet> packet)
{
{
std::lock_guard<std::recursive_mutex> lkq(m_crit.async_queue_write);
m_async_queue.push(std::move(packet));
m_async_queue.emplace(std::move(packet));
}
ENetUtil::WakeupThread(m_client);
}
@ -388,7 +391,7 @@ void SlippiNetplayClient::ThreadFunc()
#ifdef _WIN32
QOS_VERSION ver = { 1, 0 };
if (SConfig::GetInstance().bQoSEnabled && QOSCreateHandle(&ver, &m_qos_handle))
if (Config::Get(Config::NETPLAY_ENABLE_QOS) && QOSCreateHandle(&ver, &m_qos_handle))
{
// from win32.c
struct sockaddr_in sin = { 0 };
@ -516,7 +519,7 @@ void SlippiNetplayClient::StartSlippiGame()
matchInfo.Reset();
// Reset ack timers
ackTimers.Clear();
ackTimers = {};
}
void SlippiNetplayClient::SendConnectionSelected()
@ -524,7 +527,7 @@ void SlippiNetplayClient::SendConnectionSelected()
isConnectionSelected = true;
auto spac = std::make_unique<sf::Packet>();
*spac << static_cast<MessageId>(NP_MSG_SLIPPI_CONN_SELECTED);
*spac << static_cast<NetPlay::MessageId>(NetPlay::NP_MSG_SLIPPI_CONN_SELECTED);
SendAsync(std::move(spac));
}
@ -565,7 +568,7 @@ void SlippiNetplayClient::SendSlippiPad(std::unique_ptr<SlippiPad> pad)
auto frame = localPadQueue.front()->frame;
auto spac = std::make_unique<sf::Packet>();
*spac << static_cast<MessageId>(NP_MSG_SLIPPI_PAD);
*spac << static_cast<NetPlay::MessageId>(NetPlay::NP_MSG_SLIPPI_PAD);
*spac << frame;
INFO_LOG(SLIPPI_ONLINE, "Sending a packet of inputs [%d]...", frame);
@ -592,7 +595,7 @@ void SlippiNetplayClient::SendSlippiPad(std::unique_ptr<SlippiPad> pad)
FrameTiming sendTime;
sendTime.frame = frame;
sendTime.timeUs = time;
ackTimers.Push(sendTime);
ackTimers.emplace(sendTime);
}
void SlippiNetplayClient::SetMatchSelections(SlippiPlayerSelections& s)

View file

@ -7,7 +7,7 @@
#include "Common/Logging/Log.h"
#include "Core/Core.h"
#include "Core/HW/EXI_DeviceSlippi.h"
#include "Core/HW/EXI/EXI_DeviceSlippi.h"
#include "Core/NetPlayClient.h"
#include "Core/State.h"
#include "SlippiPlayback.h"

View file

@ -4,7 +4,7 @@
#include <queue>
#include <string>
#include <json.hpp>
#include <nlohmann/json.hpp>
using json = nlohmann::json;
class SlippiReplayComm