Fix random build errors

This commit is contained in:
R2DLiu 2020-07-03 00:17:56 -04:00
commit 51a060caec
7 changed files with 60 additions and 16 deletions

View file

@ -550,7 +550,7 @@ include_directories(Externals/Slippi)
add_subdirectory(Externals/semver)
include_directories(Externals/semver/include)
add_subdirectory(Externals/open-vcdiff)
include_directories(Externals/open-vcdiff)
include_directories(Externals)
find_package(pugixml)
if(NOT pugixml_FOUND)

View file

@ -17,5 +17,3 @@ endif()
add_library(Slippi STATIC ${SRCS})
target_include_directories(Slippi PUBLIC "../nlohmann")

View file

@ -48,9 +48,9 @@
#ifndef FIFOSamplePipe_H
#define FIFOSamplePipe_H
#include <assert.h>
#include <stdlib.h>
#include "STTypes.h"
#include <assert.h>
namespace soundtouch
{

41
Externals/soundtouch/assert.h vendored Normal file
View file

@ -0,0 +1,41 @@
//
// assert.h
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// Defines the assert macro and related functionality.
//
#if defined _VCRT_BUILD && !defined _ASSERT_OK
#error assert.h not for CRT internal use
#endif
#include <corecrt.h>
_CRT_BEGIN_C_HEADER
#undef assert
#ifdef NDEBUG
#define assert(expression) ((void)0)
#else
_ACRTIMP void __cdecl _wassert(
_In_z_ wchar_t const* _Message,
_In_z_ wchar_t const* _File,
_In_ unsigned _Line
);
#define assert(expression) (void)( \
(!!(expression)) || \
(_wassert(_CRT_WIDE(#expression), _CRT_WIDE(__FILE__), (unsigned)(__LINE__)), 0) \
)
#endif
_CRT_END_C_HEADER

View file

@ -131,6 +131,11 @@ enum
NP_MSG_WIIMOTE_DATA = 0x70,
NP_MSG_WIIMOTE_MAPPING = 0x71,
NP_MSG_SLIPPI_PAD = 0x80,
NP_MSG_SLIPPI_PAD_ACK = 0x81,
NP_MSG_SLIPPI_MATCH_SELECTIONS = 0x82,
NP_MSG_SLIPPI_CONN_SELECTED = 0x83,
NP_MSG_GOLF_REQUEST = 0x90,
NP_MSG_GOLF_SWITCH = 0x91,
NP_MSG_GOLF_ACQUIRE = 0x92,

View file

@ -203,19 +203,19 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
lastFrameAcked = frame > lastFrameAcked ? frame : lastFrameAcked;
// Remove old timings
while (!ackTimers.Empty() && ackTimers.Front().frame < frame)
while (!ackTimers.empty() && ackTimers.front().frame < frame)
{
ackTimers.Pop();
ackTimers.pop();
}
// Don't get a ping if we do not have the right ack frame
if (ackTimers.Empty() || ackTimers.Front().frame != frame)
if (ackTimers.empty() || ackTimers.front().frame != frame)
{
break;
}
auto sendTime = ackTimers.Front().timeUs;
ackTimers.Pop();
auto sendTime = ackTimers.front().timeUs;
ackTimers.pop();
pingUs = Common::Timer::GetTimeUs() - sendTime;
if (g_ActiveConfig.bShowNetPlayPing && frame % SLIPPI_PING_DISPLAY_INTERVAL == 0)
@ -340,7 +340,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.push(std::move(packet));
}
ENetUtil::WakeupThread(m_client);
}
@ -431,10 +431,10 @@ void SlippiNetplayClient::ThreadFunc()
ENetEvent netEvent;
int net;
net = enet_host_service(m_client, &netEvent, 250);
while (!m_async_queue.Empty())
while (!m_async_queue.empty())
{
Send(*(m_async_queue.Front().get()));
m_async_queue.Pop();
Send(*(m_async_queue.front().get()));
m_async_queue.pop();
}
if (net > 0)
{

View file

@ -6,7 +6,6 @@
#include "Common/CommonTypes.h"
#include "Common/Event.h"
#include "Common/FifoQueue.h"
#include "Common/Timer.h"
#include "Common/TraversalClient.h"
#include "Core/NetPlayProto.h"
@ -21,6 +20,7 @@
#include <string>
#include <thread>
#include <vector>
#include <queue>
#ifdef _WIN32
#include <Qos2.h>
@ -140,7 +140,7 @@ protected:
std::recursive_mutex async_queue_write;
} m_crit;
Common::FifoQueue<std::unique_ptr<sf::Packet>, false> m_async_queue;
std::queue<std::unique_ptr<sf::Packet>> m_async_queue;
std::string oppName = "";
@ -178,7 +178,7 @@ protected:
u64 pingUs;
std::deque<std::unique_ptr<SlippiPad>> localPadQueue; // most recent inputs at start of deque
std::deque<std::unique_ptr<SlippiPad>> remotePadQueue; // most recent inputs at start of deque
Common::FifoQueue<FrameTiming, false> ackTimers;
std::queue<FrameTiming> ackTimers;
SlippiConnectStatus slippiConnectStatus = SlippiConnectStatus::NET_CONNECT_STATUS_UNSET;
SlippiMatchInfo matchInfo;