squash more compiler errors

This commit is contained in:
R2DLiu 2020-07-05 12:18:46 -04:00
commit 6228f14bb6
11 changed files with 57 additions and 62 deletions

View file

@ -109,6 +109,7 @@ namespace Slippi {
class SlippiGame {
public:
static std::unique_ptr<SlippiGame> FromFile(std::string path);
bool AreSettingsLoaded();
bool DoesFrameExist(int32_t frame);
std::array<uint8_t, 4> GetVersion();
@ -118,6 +119,7 @@ namespace Slippi {
GameSettings* GetSettings();
bool DoesPlayerExist(int8_t port);
bool IsProcessingComplete();
private:
Game game;
std::unique_ptr<std::ifstream> file;
@ -136,7 +138,5 @@ namespace Slippi {
bool isProcessingComplete = false;
void processData();
static std::unique_ptr<SlippiGame> FromFile(std::string path);
};
}

View file

@ -213,6 +213,8 @@ add_library(core
HW/EXI/EXI_DeviceMemoryCard.h
HW/EXI/EXI_DeviceMic.cpp
HW/EXI/EXI_DeviceMic.h
HW/EXI/EXI_DeviceSlippi.cpp
HW/EXI/EXI_DeviceSlippi.h
HW/GCKeyboard.cpp
HW/GCKeyboard.h
HW/GCKeyboardEmu.cpp
@ -580,7 +582,7 @@ PUBLIC
videoogl
videosoftware
videovulkan
Slippi
SlippiLib
vcdcom
vcddec
vcdenc

View file

@ -2,39 +2,42 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Core/Debugger/Debugger_SymbolMap.h"
#include <SlippiGame.h>
#include "Core/Slippi/SlippiReplayComm.h"
#include "Core/Slippi/SlippiPlayback.h"
#include <semver/include/semver200.h>
#include <utility> // std::move
#include <algorithm>
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/MemoryUtil.h"
#include "Common/MsgHandler.h"
#include "Common/StringUtil.h"
#include "Common/Thread.h"
#include "Core/HW/Memmap.h"
#include "Common/Version.h"
#include "Core/NetPlayClient.h"
#include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h"
#include "Core/HW/EXI_DeviceSlippi.h"
#include "Core/Debugger/Debugger_SymbolMap.h"
#include "Core/HW/EXI/EXI_DeviceSlippi.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/SystemTimers.h"
#include "Core/NetPlayClient.h"
#include "Core/Slippi/SlippiReplayComm.h"
#include "Core/Slippi/SlippiPlayback.h"
#include "Core/State.h"
// Not clean but idk a better way atm
//#ifndef LINUX_LOCAL_DEV
#include "DolphinWX/Frame.h"
#include "DolphinWX/Main.h"
//#include "DolphinWX/Frame.h"
//#include "DolphinWX/Main.h"
//#endif
namespace ExpansionInterface {
#define FRAME_INTERVAL 900
#define SLEEP_TIME_MS 8
#define WRITE_FILE_SLEEP_TIME_MS 85
@ -42,6 +45,8 @@ namespace ExpansionInterface {
//#define LOCAL_TESTING
//#define CREATE_DIFF_FILES
namespace ExpansionInterface {
static std::unordered_map<u8, std::string> slippi_names;
static std::unordered_map<u8, std::string> slippi_connect_codes;
@ -249,22 +254,6 @@ std::unordered_map<u8, std::string> CEXISlippi::getNetplayNames()
names = slippi_names;
}
else if (netplay_client && netplay_client->IsConnected())
{
auto netplayPlayers = netplay_client->GetPlayers();
for (auto it = netplayPlayers.begin(); it != netplayPlayers.end(); ++it)
{
auto player = *it;
u8 portIndex = netplay_client->FindPlayerPad(player);
if (portIndex < 0)
{
continue;
}
names[portIndex] = player->name;
}
}
return names;
}
@ -1058,7 +1047,7 @@ void CEXISlippi::prepareGeckoList()
geckoList.insert(geckoList.end(), { 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
}
void CEXISlippi::prepareCharacterFrameData(Slippi::FrameData* frame, u8 port, u8 isFollower)
void CEXISlippi::prepareCharacterFrameData(std::shared_ptr<Slippi::FrameData> frame, u8 port, u8 isFollower)
{
std::unordered_map<uint8_t, Slippi::PlayerFrameData> source;
source = isFollower ? frame->followers : frame->players;
@ -1107,7 +1096,7 @@ bool CEXISlippi::checkFrameFullyFetched(s32 frameIndex)
if (!doesFrameExist)
return false;
Slippi::FrameData* frame = m_current_game->GetFrame(frameIndex);
std::shared_ptr<Slippi::FrameData> frame = m_current_game->GetFrame(frameIndex);
// This flag is set to true after a post frame update has been received. At that point
// we know we have received all of the input data for the frame
@ -1258,7 +1247,7 @@ void CEXISlippi::prepareFrameData(u8* payload)
m_read_queue.push_back(requestResultCode);
// Get frame
Slippi::FrameData* frame = m_current_game->GetFrame(frameIndex);
std::shared_ptr<Slippi::FrameData> frame = m_current_game->GetFrame(frameIndex);
if (commSettings.rollbackDisplayMethod != "off")
{
auto previousFrame = m_current_game->GetFrameAt(frameSeqIdx - 1);
@ -1362,7 +1351,7 @@ void CEXISlippi::prepareIsStockSteal(u8* payload)
}
// Load the data from this frame into the read buffer
Slippi::FrameData* frame = m_current_game->GetFrame(frameIndex);
std::shared_ptr<Slippi::FrameData> frame = m_current_game->GetFrame(frameIndex);
auto players = frame->players;
u8 playerIsBack = players.count(playerIndex) ? 1 : 0;
@ -1441,7 +1430,7 @@ void CEXISlippi::handleOnlineInputs(u8* payload)
prepareOpponentInputs(payload);
}
bool CEXISlippi::shouldSkipOnlineFrame(int32_t frame)
bool CEXISlippi::shouldSkipOnlineFrame(s32 frame)
{
auto status = slippi_netplay->GetSlippiConnectStatus();
bool connectionFailed = status == SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_FAILED;
@ -1891,7 +1880,7 @@ u16 CEXISlippi::getRandomStage()
// use a random number to select an index but idk the generator was giving a lot
// of the same stage (same index) many times in a row or so it seemed to I figured
// this can't hurt
std::random_shuffle(stagesToConsider.begin(), stagesToConsider.end());
std::shuffle(stagesToConsider.begin(), stagesToConsider.end(), generator);
// Get random stage
int randIndex = generator() % stagesToConsider.size();
@ -1984,11 +1973,11 @@ void CEXISlippi::logMessageFromGame(u8* payload)
if (payload[0] == 0)
{
// The first byte indicates whether to log the time or not
GENERIC_LOG(LogTypes::SLIPPI, (LogTypes::LOG_LEVELS)payload[1], "%s", (char*)& payload[2]);
GENERIC_LOG(Common::Log::SLIPPI, (Common::Log::LOG_LEVELS)payload[1], "%s", (char*)& payload[2]);
}
else
{
GENERIC_LOG(LogTypes::SLIPPI, (LogTypes::LOG_LEVELS)payload[1], "%s: %llu", (char*)& payload[2],
GENERIC_LOG(Common::Log::SLIPPI, (Common::Log::LOG_LEVELS)payload[1], "%s: %llu", (char*)& payload[2],
Common::Timer::GetTimeUs());
}
}
@ -1999,7 +1988,7 @@ void CEXISlippi::handleLogInRequest()
if (!logInRes)
{
//#ifndef LINUX_LOCAL_DEV
main_frame->LowerRenderWindow();
//main_frame->LowerRenderWindow(); SLIPPITODO: figure out replacement.
//#endif
user->OpenLogInPage();
user->ListenForLogIn();
@ -2016,7 +2005,7 @@ void CEXISlippi::handleUpdateAppRequest()
#ifdef __APPLE__
CriticalAlertT("Automatic updates are not available for macOS, please update manually.");
#else
main_frame->LowerRenderWindow();
// main_frame->LowerRenderWindow(); SLIPPITODO: figure out replacement // mainwindow hide render widget
user->UpdateApp();
main_frame->DoExit();
#endif
@ -2034,7 +2023,7 @@ void CEXISlippi::prepareOnlineStatus()
{
// Check if we have the latest version, and if not, indicate we need to update
version::Semver200_version latestVersion(userInfo.latestVersion);
version::Semver200_version currentVersion(scm_slippi_semver_str);
version::Semver200_version currentVersion(Common::scm_slippi_semver_str);
appState = latestVersion > currentVersion ? 2 : 1;
}
@ -2092,7 +2081,7 @@ void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize)
if (memPtr == nullptr)
{
NOTICE_LOG(SLIPPI, "DMA Write was passed an invalid address: %x", _uAddr);
Dolphin_Debugger::PrintCallstack(LogTypes::LOG_TYPE::SLIPPI, LogTypes::LOG_LEVELS::LNOTICE);
Dolphin_Debugger::PrintCallstack(Common::Log::SLIPPI, Common::Log::LNOTICE);
m_read_queue.clear();
return;
}

View file

@ -13,6 +13,7 @@
#include "Core/Slippi/SlippiGameFileLoader.h"
#include "Core/Slippi/SlippiMatchmaking.h"
#include "Core/Slippi/SlippiNetplay.h"
#include "Core/Slippi/SlippiPlayback.h"
#include "Core/Slippi/SlippiReplayComm.h"
#include "Core/Slippi/SlippiSavestate.h"
#include "Core/Slippi/SlippiUser.h"
@ -165,7 +166,7 @@ namespace ExpansionInterface
// replay playback stuff
void prepareGameInfo(u8* payload);
void prepareGeckoList();
void prepareCharacterFrameData(Slippi::FrameData* frame, u8 port, u8 isFollower);
void prepareCharacterFrameData(std::shared_ptr<Slippi::FrameData> frame, u8 port, u8 isFollower);
void prepareFrameData(u8* payload);
void prepareIsStockSteal(u8* payload);
void prepareIsFileReady();

View file

@ -2,10 +2,10 @@
#include "Common/Logging/Log.h"
#include "Common/FileUtil.h"
#include "Common/File.h"
#include "Core/Boot/Boot.h"
#include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Core/Common/FileUtil.h"
std::string getFilePath(std::string fileName)
{
@ -40,7 +40,7 @@ void ReadFileToBuffer(std::string& fileName, std::vector<u8>& buf)
auto fileSize = file.GetSize();
buf.resize(fileSize);
size_t bytes_read;
file.ReadArray<u8>(vector->data(), std::min<u64>(file.GetSize(), vector->size()), &bytes_read);
file.ReadArray<u8>(buf.data(), std::min<u64>(file.GetSize(), buf.size()), &bytes_read);
}
u32 SlippiGameFileLoader::LoadFile(std::string fileName, std::string& data)

View file

@ -1,5 +1,6 @@
#include "SlippiMatchmaking.h"
#include "Common/Common.h"
#include "Common/Version.h"
#include "Common/ENetUtil.h"
#include "Common/Logging/Log.h"
#include "Common/StringUtil.h"
@ -27,7 +28,7 @@ SlippiMatchmaking::SlippiMatchmaking(SlippiUser* user)
m_client = nullptr;
m_server = nullptr;
MM_HOST = scm_slippi_semver_str.find("dev") == std::string::npos ? MM_HOST_PROD : MM_HOST_DEV;
MM_HOST = Common::scm_slippi_semver_str.find("dev") == std::string::npos ? MM_HOST_PROD : MM_HOST_DEV;
generator = std::default_random_engine(Common::Timer::GetTimeMs());
}
@ -287,7 +288,7 @@ void SlippiMatchmaking::startMatchmaking()
request["type"] = MmMessageType::CREATE_TICKET;
request["user"] = { {"uid", userInfo.uid}, {"playKey", userInfo.playKey} };
request["search"] = { {"mode", m_searchSettings.mode}, {"connectCode", connectCodeBuf} };
request["appVersion"] = scm_slippi_semver_str;
request["appVersion"] = Common::scm_slippi_semver_str;
sendMessage(request);
// Get response from server
@ -388,8 +389,7 @@ void SlippiMatchmaking::handleMatchmaking()
void SlippiMatchmaking::handleConnecting()
{
std::vector<std::string> ipParts;
SplitString(m_oppIp, ':', ipParts);
std::vector<std::string> ipParts = SplitString(m_oppIp, ':');
// Is host is now used to specify who the decider is
auto client = std::make_unique<SlippiNetplayClient>(ipParts[0], std::stoi(ipParts[1]), m_hostPort, m_isHost);

View file

@ -7,6 +7,7 @@
#include "Common/Logging/Log.h"
#include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Core/HW/EXI/EXI_DeviceSlippi.h"
#include "Core/NetPlayClient.h"
#include "Core/State.h"
@ -128,7 +129,7 @@ void SlippiPlaybackStatus::resetPlayback()
inSlippiPlayback = false;
}
void SlippiPlaybackStatus::processInitialState(std::vector<u8>& iState)
void SlippiPlaybackStatus::processInitialState()
{
INFO_LOG(SLIPPI, "saving iState");
State::SaveToBuffer(iState);
@ -161,7 +162,7 @@ void SlippiPlaybackStatus::SavestateThread()
if (!inSlippiPlayback && isStartFrame)
{
processInitialState(iState);
processInitialState();
inSlippiPlayback = true;
}
else if (!hasStateBeenProcessed && !isStartFrame)
@ -194,8 +195,8 @@ void SlippiPlaybackStatus::SeekThread()
if (replayCommSettings.mode == "queue")
clearWatchSettingsStartEnd();
bool paused = (Core::GetState() == Core::CORE_PAUSE);
Core::SetState(Core::CORE_PAUSE);
bool paused = (Core::GetState() == Core::State::Paused);
Core::SetState(Core::State::Paused);
u32 jumpInterval = 300; // 5 seconds;

View file

@ -37,7 +37,7 @@ public:
private:
void SavestateThread(void);
void SeekThread(void);
void processInitialState(std::vector<u8>& iState);
void processInitialState();
void clearWatchSettingsStartEnd();
std::unordered_map<int32_t, std::shared_future<std::string>>

View file

@ -1,10 +1,12 @@
#pragma once
#include <SlippiGame.h>
#include <queue>
#include <string>
#include <nlohmann/json.hpp>
#include <SlippiGame.h>
#include <Common/CommonTypes.h>
using json = nlohmann::json;
class SlippiReplayComm

View file

@ -3,13 +3,13 @@
#include "Common/MemoryUtil.h"
#include "Core/HW/AudioInterface.h"
#include "Core/HW/DSP.h"
#include "Core/HW/DVDInterface.h"
#include "Core/HW/EXI.h"
#include "Core/HW/DVD/DVDInterface.h"
#include "Core/HW/EXI/EXI.h"
#include "Core/HW/GPFifo.h"
#include "Core/HW/HW.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/ProcessorInterface.h"
#include "Core/HW/SI.h"
#include "Core/HW/SI/SI.h"
#include "Core/HW/VideoInterface.h"
#include <vector>

View file

@ -149,13 +149,13 @@ void SlippiUser::UpdateFile()
void SlippiUser::UpdateApp()
{
#ifdef _WIN32
auto isoPath = SConfig::GetInstance().m_strFilename;
auto isoPath = SConfig::GetInstance().m_strBootROM;
std::string path = File::GetExeDirectory() + "/dolphin-slippi-tools.exe";
std::string echoMsg = "echo Starting update process. If nothing happen after a few "
"minutes, you may need to update manually from https://slippi.gg/netplay ...";
std::string command = "start /b cmd /c " + echoMsg + " && \"" + path + "\" app-update -launch -iso \"" + isoPath + "\"";
WARN_LOG(SLIPPI, "Executing app update command: %s", command);
WARN_LOG(SLIPPI, "Executing app update command: %s", command.c_str());
RunSystemCommand(command);
#elif defined(__APPLE__)
#else