even with 5ae73c8e228e0eb8bc3368fbb96b15685d0f3ef4

This commit is contained in:
R2DLiu 2020-12-07 00:42:31 -05:00
commit 4e00af9220
7 changed files with 32 additions and 13 deletions

View file

@ -542,7 +542,7 @@ void CEXISlippi::createNewFile()
PanicAlertT("Could not create .slp replay file [%s].\n\n"
"The replay folder's path might be invalid, or you might "
"not have permission to write to it.\n\n"
"You can change the replay folder in Config > GameCube > "
"You can change the replay folder in Config > Slippi > "
"Slippi Replay Settings.",
filepath.c_str());
}
@ -687,6 +687,9 @@ void CEXISlippi::prepareGameInfo(u8* payload)
// Write PS Frozen byte
m_read_queue.push_back(settings->isFrozenPS);
// Write should resync setting
m_read_queue.push_back(replayCommSettings.shouldResync ? 1 : 0);
// Return the size of the gecko code list
prepareGeckoList();
appendWordToBuffer(&m_read_queue, (u32)geckoList.size());
@ -1008,6 +1011,7 @@ void CEXISlippi::prepareGeckoList()
{0x80185050, true}, // Online/Menus/VSScreen/HideStageDisplay/PreventEarlyR3Overwrite.asm
{0x80184b1c, true}, // Online/Menus/VSScreen/HideStageText/SkipStageNumberShow.asm
{0x801A45BC, true}, // Online/Slippi Online Scene/main.asm
{0x801a45b8, true}, // Online/Slippi Online Scene/main.asm (https://bit.ly/3kxohf4)
{0x801BFA20, true}, // Online/Slippi Online Scene/boot.asm
};
@ -1397,6 +1401,15 @@ void CEXISlippi::prepareIsFileReady()
m_read_queue.push_back(1);
}
bool CEXISlippi::isDisconnected()
{
if (!slippi_netplay)
return true;
auto status = slippi_netplay->GetSlippiConnectStatus();
return status != SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_CONNECTED || isConnectionStalled;
}
static int tempTestCount = 0;
void CEXISlippi::handleOnlineInputs(u8* payload)
{
@ -1404,6 +1417,12 @@ void CEXISlippi::handleOnlineInputs(u8* payload)
int32_t frame = payload[0] << 24 | payload[1] << 16 | payload[2] << 8 | payload[3];
if (isDisconnected())
{
m_read_queue.push_back(3); // Indicate we disconnected
return;
}
if (frame == 1)
{
availableSavestates.clear();
@ -1564,6 +1583,9 @@ void CEXISlippi::prepareOpponentInputs(u8* payload)
void CEXISlippi::handleCaptureSavestate(u8* payload)
{
if (isDisconnected())
return;
s32 frame = payload[0] << 24 | payload[1] << 16 | payload[2] << 8 | payload[3];
u64 startTime = Common::Timer::GetTimeUs();
@ -2006,12 +2028,9 @@ void CEXISlippi::handleLogOutRequest()
void CEXISlippi::handleUpdateAppRequest()
{
#ifdef __APPLE__
CriticalAlertT(
"Automatic updates are not available for macOS, please get the latest update from slippi.gg/netplay.");
#else
Host_LowerWindow();
user->UpdateApp();
#ifdef _WIN32
Host_Exit();
#endif
}

View file

@ -142,7 +142,6 @@ namespace ExpansionInterface
void closeFile();
std::string generateFileName();
bool checkFrameFullyFetched(s32 frameIndex);
bool shouldFFWFrame(s32 frameIndex);
// std::ofstream log;
@ -151,6 +150,7 @@ namespace ExpansionInterface
// online play stuff
u16 getRandomStage();
bool isDisconnected();
void handleOnlineInputs(u8* payload);
void prepareOpponentInputs(u8* payload);
void handleSendInputs(u8* payload);

View file

@ -182,12 +182,6 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
int32_t headFrame = remotePadQueue.empty() ? 0 : remotePadQueue.front()->frame;
int inputsToCopy = frame - headFrame;
// Check that the packet actually contains the data it claims to
if ((5 + inputsToCopy * SLIPPI_PAD_DATA_SIZE) > (int)packet.getDataSize()) {
ERROR_LOG(SLIPPI_ONLINE, "Netplay packet too small to read pad buffer");
break;
}
for (int i = inputsToCopy - 1; i >= 0; i--)
{
auto pad = std::make_unique<SlippiPad>(frame - i, &packetData[5 + i * SLIPPI_PAD_DATA_SIZE]);

View file

@ -163,6 +163,7 @@ void SlippiReplayComm::loadFile()
commFileSettings.commandId = "";
commFileSettings.outputOverlayFiles = false;
commFileSettings.isRealTimeMode = false;
commFileSettings.shouldResync = true;
commFileSettings.rollbackDisplayMethod = "off";
if (res.is_string())
@ -193,6 +194,7 @@ void SlippiReplayComm::loadFile()
commFileSettings.commandId = res.value("commandId", "");
commFileSettings.outputOverlayFiles = res.value("outputOverlayFiles", false);
commFileSettings.isRealTimeMode = res.value("isRealTimeMode", false);
commFileSettings.shouldResync = res.value("shouldResync", true);
commFileSettings.rollbackDisplayMethod = res.value("rollbackDisplayMethod", "off");
if (commFileSettings.mode == "queue")

View file

@ -32,6 +32,7 @@ public:
int endFrame = INT_MAX;
bool outputOverlayFiles;
bool isRealTimeMode;
bool shouldResync; // If true, logic will attempt to resync games
std::string rollbackDisplayMethod; // off, normal, visible
std::string commandId;
std::queue<WatchSettings> queue;

View file

@ -147,7 +147,7 @@ void SlippiSpectateServer::popEvents()
if (sendEvents.count(command))
{
u32 cursor = static_cast<u32>(m_event_buffer.size() + m_cursor_offset);
u32 cursor = (u32)(m_event_buffer.size() + m_cursor_offset);
game_event["payload"] = base64::Base64::Encode(m_event_concat);
game_event["type"] = "game_event";
game_event["cursor"] = cursor;

View file

@ -190,6 +190,7 @@ void SlippiUser::UpdateApp()
WARN_LOG(SLIPPI, "Executing app update command: %s", command.c_str());
RunSystemCommand(command);
#elif defined(__APPLE__)
CriticalAlertT("Automatic updates are not available for macOS; please get the latest update from slippi.gg/netplay.");
#else
const char* appimage_path = getenv("APPIMAGE");
const char* appmount_path = getenv("APPDIR");
@ -203,6 +204,8 @@ void SlippiUser::UpdateApp()
std::string command = mount_path + "/usr/bin/appimageupdatetool " + path;
WARN_LOG(SLIPPI, "Executing app update command: %s", command.c_str());
RunSystemCommand(command);
CriticalAlertT("Restart Dolphin to finish the update. If there was an issue, please head over to the Slippi "
"Discord for support.");
#endif
}