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 { class SlippiGame {
public: public:
static std::unique_ptr<SlippiGame> FromFile(std::string path);
bool AreSettingsLoaded(); bool AreSettingsLoaded();
bool DoesFrameExist(int32_t frame); bool DoesFrameExist(int32_t frame);
std::array<uint8_t, 4> GetVersion(); std::array<uint8_t, 4> GetVersion();
@ -118,6 +119,7 @@ namespace Slippi {
GameSettings* GetSettings(); GameSettings* GetSettings();
bool DoesPlayerExist(int8_t port); bool DoesPlayerExist(int8_t port);
bool IsProcessingComplete(); bool IsProcessingComplete();
private: private:
Game game; Game game;
std::unique_ptr<std::ifstream> file; std::unique_ptr<std::ifstream> file;
@ -136,7 +138,5 @@ namespace Slippi {
bool isProcessingComplete = false; bool isProcessingComplete = false;
void processData(); 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_DeviceMemoryCard.h
HW/EXI/EXI_DeviceMic.cpp HW/EXI/EXI_DeviceMic.cpp
HW/EXI/EXI_DeviceMic.h HW/EXI/EXI_DeviceMic.h
HW/EXI/EXI_DeviceSlippi.cpp
HW/EXI/EXI_DeviceSlippi.h
HW/GCKeyboard.cpp HW/GCKeyboard.cpp
HW/GCKeyboard.h HW/GCKeyboard.h
HW/GCKeyboardEmu.cpp HW/GCKeyboardEmu.cpp
@ -580,7 +582,7 @@ PUBLIC
videoogl videoogl
videosoftware videosoftware
videovulkan videovulkan
Slippi SlippiLib
vcdcom vcdcom
vcddec vcddec
vcdenc vcdenc

View file

@ -2,39 +2,42 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // 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 <semver/include/semver200.h>
#include <utility> // std::move #include <utility> // std::move
#include <algorithm>
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Common/MsgHandler.h" #include "Common/MsgHandler.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
#include "Common/Thread.h" #include "Common/Thread.h"
#include "Core/HW/Memmap.h" #include "Common/Version.h"
#include "Core/NetPlayClient.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Core/CoreTiming.h" #include "Core/CoreTiming.h"
#include "Core/Debugger/Debugger_SymbolMap.h"
#include "Core/HW/EXI_DeviceSlippi.h" #include "Core/HW/EXI/EXI_DeviceSlippi.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/SystemTimers.h" #include "Core/HW/SystemTimers.h"
#include "Core/NetPlayClient.h"
#include "Core/Slippi/SlippiReplayComm.h"
#include "Core/Slippi/SlippiPlayback.h"
#include "Core/State.h" #include "Core/State.h"
// Not clean but idk a better way atm // Not clean but idk a better way atm
//#ifndef LINUX_LOCAL_DEV //#ifndef LINUX_LOCAL_DEV
#include "DolphinWX/Frame.h" //#include "DolphinWX/Frame.h"
#include "DolphinWX/Main.h" //#include "DolphinWX/Main.h"
//#endif //#endif
namespace ExpansionInterface {
#define FRAME_INTERVAL 900 #define FRAME_INTERVAL 900
#define SLEEP_TIME_MS 8 #define SLEEP_TIME_MS 8
#define WRITE_FILE_SLEEP_TIME_MS 85 #define WRITE_FILE_SLEEP_TIME_MS 85
@ -42,6 +45,8 @@ namespace ExpansionInterface {
//#define LOCAL_TESTING //#define LOCAL_TESTING
//#define CREATE_DIFF_FILES //#define CREATE_DIFF_FILES
namespace ExpansionInterface {
static std::unordered_map<u8, std::string> slippi_names; static std::unordered_map<u8, std::string> slippi_names;
static std::unordered_map<u8, std::string> slippi_connect_codes; 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; 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; return names;
} }
@ -1058,7 +1047,7 @@ void CEXISlippi::prepareGeckoList()
geckoList.insert(geckoList.end(), { 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); 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; std::unordered_map<uint8_t, Slippi::PlayerFrameData> source;
source = isFollower ? frame->followers : frame->players; source = isFollower ? frame->followers : frame->players;
@ -1107,7 +1096,7 @@ bool CEXISlippi::checkFrameFullyFetched(s32 frameIndex)
if (!doesFrameExist) if (!doesFrameExist)
return false; 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 // 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 // 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); m_read_queue.push_back(requestResultCode);
// Get frame // 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") if (commSettings.rollbackDisplayMethod != "off")
{ {
auto previousFrame = m_current_game->GetFrameAt(frameSeqIdx - 1); 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 // 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; auto players = frame->players;
u8 playerIsBack = players.count(playerIndex) ? 1 : 0; u8 playerIsBack = players.count(playerIndex) ? 1 : 0;
@ -1441,7 +1430,7 @@ void CEXISlippi::handleOnlineInputs(u8* payload)
prepareOpponentInputs(payload); prepareOpponentInputs(payload);
} }
bool CEXISlippi::shouldSkipOnlineFrame(int32_t frame) bool CEXISlippi::shouldSkipOnlineFrame(s32 frame)
{ {
auto status = slippi_netplay->GetSlippiConnectStatus(); auto status = slippi_netplay->GetSlippiConnectStatus();
bool connectionFailed = status == SlippiNetplayClient::SlippiConnectStatus::NET_CONNECT_STATUS_FAILED; 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 // 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 // of the same stage (same index) many times in a row or so it seemed to I figured
// this can't hurt // this can't hurt
std::random_shuffle(stagesToConsider.begin(), stagesToConsider.end()); std::shuffle(stagesToConsider.begin(), stagesToConsider.end(), generator);
// Get random stage // Get random stage
int randIndex = generator() % stagesToConsider.size(); int randIndex = generator() % stagesToConsider.size();
@ -1984,11 +1973,11 @@ void CEXISlippi::logMessageFromGame(u8* payload)
if (payload[0] == 0) if (payload[0] == 0)
{ {
// The first byte indicates whether to log the time or not // 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 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()); Common::Timer::GetTimeUs());
} }
} }
@ -1999,7 +1988,7 @@ void CEXISlippi::handleLogInRequest()
if (!logInRes) if (!logInRes)
{ {
//#ifndef LINUX_LOCAL_DEV //#ifndef LINUX_LOCAL_DEV
main_frame->LowerRenderWindow(); //main_frame->LowerRenderWindow(); SLIPPITODO: figure out replacement.
//#endif //#endif
user->OpenLogInPage(); user->OpenLogInPage();
user->ListenForLogIn(); user->ListenForLogIn();
@ -2016,7 +2005,7 @@ void CEXISlippi::handleUpdateAppRequest()
#ifdef __APPLE__ #ifdef __APPLE__
CriticalAlertT("Automatic updates are not available for macOS, please update manually."); CriticalAlertT("Automatic updates are not available for macOS, please update manually.");
#else #else
main_frame->LowerRenderWindow(); // main_frame->LowerRenderWindow(); SLIPPITODO: figure out replacement // mainwindow hide render widget
user->UpdateApp(); user->UpdateApp();
main_frame->DoExit(); main_frame->DoExit();
#endif #endif
@ -2034,7 +2023,7 @@ void CEXISlippi::prepareOnlineStatus()
{ {
// Check if we have the latest version, and if not, indicate we need to update // Check if we have the latest version, and if not, indicate we need to update
version::Semver200_version latestVersion(userInfo.latestVersion); 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; appState = latestVersion > currentVersion ? 2 : 1;
} }
@ -2092,7 +2081,7 @@ void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize)
if (memPtr == nullptr) if (memPtr == nullptr)
{ {
NOTICE_LOG(SLIPPI, "DMA Write was passed an invalid address: %x", _uAddr); 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(); m_read_queue.clear();
return; return;
} }

View file

@ -13,6 +13,7 @@
#include "Core/Slippi/SlippiGameFileLoader.h" #include "Core/Slippi/SlippiGameFileLoader.h"
#include "Core/Slippi/SlippiMatchmaking.h" #include "Core/Slippi/SlippiMatchmaking.h"
#include "Core/Slippi/SlippiNetplay.h" #include "Core/Slippi/SlippiNetplay.h"
#include "Core/Slippi/SlippiPlayback.h"
#include "Core/Slippi/SlippiReplayComm.h" #include "Core/Slippi/SlippiReplayComm.h"
#include "Core/Slippi/SlippiSavestate.h" #include "Core/Slippi/SlippiSavestate.h"
#include "Core/Slippi/SlippiUser.h" #include "Core/Slippi/SlippiUser.h"
@ -165,7 +166,7 @@ namespace ExpansionInterface
// replay playback stuff // replay playback stuff
void prepareGameInfo(u8* payload); void prepareGameInfo(u8* payload);
void prepareGeckoList(); 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 prepareFrameData(u8* payload);
void prepareIsStockSteal(u8* payload); void prepareIsStockSteal(u8* payload);
void prepareIsFileReady(); void prepareIsFileReady();

View file

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

View file

@ -1,5 +1,6 @@
#include "SlippiMatchmaking.h" #include "SlippiMatchmaking.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/Version.h"
#include "Common/ENetUtil.h" #include "Common/ENetUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
@ -27,7 +28,7 @@ SlippiMatchmaking::SlippiMatchmaking(SlippiUser* user)
m_client = nullptr; m_client = nullptr;
m_server = 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()); generator = std::default_random_engine(Common::Timer::GetTimeMs());
} }
@ -287,7 +288,7 @@ void SlippiMatchmaking::startMatchmaking()
request["type"] = MmMessageType::CREATE_TICKET; request["type"] = MmMessageType::CREATE_TICKET;
request["user"] = { {"uid", userInfo.uid}, {"playKey", userInfo.playKey} }; request["user"] = { {"uid", userInfo.uid}, {"playKey", userInfo.playKey} };
request["search"] = { {"mode", m_searchSettings.mode}, {"connectCode", connectCodeBuf} }; request["search"] = { {"mode", m_searchSettings.mode}, {"connectCode", connectCodeBuf} };
request["appVersion"] = scm_slippi_semver_str; request["appVersion"] = Common::scm_slippi_semver_str;
sendMessage(request); sendMessage(request);
// Get response from server // Get response from server
@ -388,8 +389,7 @@ void SlippiMatchmaking::handleMatchmaking()
void SlippiMatchmaking::handleConnecting() void SlippiMatchmaking::handleConnecting()
{ {
std::vector<std::string> ipParts; std::vector<std::string> ipParts = SplitString(m_oppIp, ':');
SplitString(m_oppIp, ':', ipParts);
// Is host is now used to specify who the decider is // 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); 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 "Common/Logging/Log.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/ConfigManager.h"
#include "Core/HW/EXI/EXI_DeviceSlippi.h" #include "Core/HW/EXI/EXI_DeviceSlippi.h"
#include "Core/NetPlayClient.h" #include "Core/NetPlayClient.h"
#include "Core/State.h" #include "Core/State.h"
@ -128,7 +129,7 @@ void SlippiPlaybackStatus::resetPlayback()
inSlippiPlayback = false; inSlippiPlayback = false;
} }
void SlippiPlaybackStatus::processInitialState(std::vector<u8>& iState) void SlippiPlaybackStatus::processInitialState()
{ {
INFO_LOG(SLIPPI, "saving iState"); INFO_LOG(SLIPPI, "saving iState");
State::SaveToBuffer(iState); State::SaveToBuffer(iState);
@ -161,7 +162,7 @@ void SlippiPlaybackStatus::SavestateThread()
if (!inSlippiPlayback && isStartFrame) if (!inSlippiPlayback && isStartFrame)
{ {
processInitialState(iState); processInitialState();
inSlippiPlayback = true; inSlippiPlayback = true;
} }
else if (!hasStateBeenProcessed && !isStartFrame) else if (!hasStateBeenProcessed && !isStartFrame)
@ -194,8 +195,8 @@ void SlippiPlaybackStatus::SeekThread()
if (replayCommSettings.mode == "queue") if (replayCommSettings.mode == "queue")
clearWatchSettingsStartEnd(); clearWatchSettingsStartEnd();
bool paused = (Core::GetState() == Core::CORE_PAUSE); bool paused = (Core::GetState() == Core::State::Paused);
Core::SetState(Core::CORE_PAUSE); Core::SetState(Core::State::Paused);
u32 jumpInterval = 300; // 5 seconds; u32 jumpInterval = 300; // 5 seconds;

View file

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

View file

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

View file

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

View file

@ -149,13 +149,13 @@ void SlippiUser::UpdateFile()
void SlippiUser::UpdateApp() void SlippiUser::UpdateApp()
{ {
#ifdef _WIN32 #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 path = File::GetExeDirectory() + "/dolphin-slippi-tools.exe";
std::string echoMsg = "echo Starting update process. If nothing happen after a few " 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 ..."; "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 + "\""; 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); RunSystemCommand(command);
#elif defined(__APPLE__) #elif defined(__APPLE__)
#else #else