add support to stay connected when local testing (#33)

Co-authored-by: Jas Laferriere <Fizzi36@gmail.com>
This commit is contained in:
Edgar Handal 2020-07-16 17:32:59 -05:00 committed by R2DLiu
commit acd2f21f0e

View file

@ -39,6 +39,10 @@
extern std::unique_ptr<SlippiPlaybackStatus> g_playbackStatus; extern std::unique_ptr<SlippiPlaybackStatus> g_playbackStatus;
extern std::unique_ptr<SlippiReplayComm> g_replayComm; extern std::unique_ptr<SlippiReplayComm> g_replayComm;
#ifdef LOCAL_TESTING
bool isLocalConnected = false;
#endif
namespace ExpansionInterface { namespace ExpansionInterface {
static std::unordered_map<u8, std::string> slippi_names; static std::unordered_map<u8, std::string> slippi_names;
@ -1699,8 +1703,11 @@ void CEXISlippi::prepareOnlineMatchState()
SlippiMatchmaking::ProcessState mmState = matchmaking->GetMatchmakeState(); SlippiMatchmaking::ProcessState mmState = matchmaking->GetMatchmakeState();
#ifdef LOCAL_TESTING #ifdef LOCAL_TESTING
if (localSelections.isCharacterSelected) if (localSelections.isCharacterSelected || isLocalConnected)
{
mmState = SlippiMatchmaking::ProcessState::CONNECTION_SUCCESS; mmState = SlippiMatchmaking::ProcessState::CONNECTION_SUCCESS;
isLocalConnected = true;
}
#endif #endif
m_read_queue.push_back(mmState); // Matchmaking State m_read_queue.push_back(mmState); // Matchmaking State
@ -2062,6 +2069,10 @@ void CEXISlippi::handleConnectionCleanup()
// Reset random stage pool // Reset random stage pool
stagePool.clear(); stagePool.clear();
#ifdef LOCAL_TESTING
isLocalConnected = false;
#endif
ERROR_LOG(SLIPPI_ONLINE, "Connection cleanup completed..."); ERROR_LOG(SLIPPI_ONLINE, "Connection cleanup completed...");
} }