mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-26 12:16:20 +00:00
compiles
This commit is contained in:
parent
8d94c3563c
commit
fa63bc3ae0
7 changed files with 31 additions and 40 deletions
|
@ -26,13 +26,13 @@
|
|||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <ShlObj.h>
|
||||
#include <Shlwapi.h>
|
||||
#include <commdlg.h> // for GetSaveFileName
|
||||
#include <direct.h> // getcwd
|
||||
#include <io.h>
|
||||
#include <objbase.h> // guid stuff
|
||||
#include <shellapi.h>
|
||||
#include <ShlObj.h>
|
||||
#include <winerror.h>
|
||||
#else
|
||||
#include <dirent.h>
|
||||
|
@ -791,21 +791,22 @@ std::string GetExePath()
|
|||
return dolphin_path;
|
||||
}
|
||||
|
||||
// SLIPPITODO: refactor with c++17 std::filesystem?
|
||||
std::string GetHomeDirectory()
|
||||
{
|
||||
std::string homeDir;
|
||||
#ifdef _WIN32
|
||||
wchar_t* path = nullptr;
|
||||
|
||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path))) {
|
||||
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &path)))
|
||||
{
|
||||
char pathStr[MAX_PATH];
|
||||
wcstombs(pathStr, path, MAX_PATH);
|
||||
|
||||
homeDir = std::string(pathStr);
|
||||
CoTaskMemFree(path);
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
const char* home = getenv("USERPROFILE");
|
||||
homeDir = std::string(home) + "\\Documents";
|
||||
}
|
||||
|
@ -853,13 +854,15 @@ std::string GetSysDirectory()
|
|||
ASSERT_MSG(COMMON, !sysDir.empty(), "Sys directory has not been set");
|
||||
#else
|
||||
const char* home = getenv("HOME");
|
||||
if (!home) home = getenv("PWD");
|
||||
if (!home) home = "";
|
||||
if (!home)
|
||||
home = getenv("PWD");
|
||||
if (!home)
|
||||
home = "";
|
||||
std::string home_path = std::string(home) + DIR_SEP;
|
||||
const char* config_home = getenv("XDG_CONFIG_HOME");
|
||||
sysDir = std::string(config_home && config_home[0] == '/'
|
||||
? config_home : (home_path + ".config"))
|
||||
+ DIR_SEP DOLPHIN_DATA_DIR DIR_SEP "Sys" DIR_SEP;
|
||||
sysDir =
|
||||
std::string(config_home && config_home[0] == '/' ? config_home : (home_path + ".config")) +
|
||||
DIR_SEP DOLPHIN_DATA_DIR DIR_SEP "Sys" DIR_SEP;
|
||||
#endif
|
||||
|
||||
INFO_LOG_FMT(COMMON, "GetSysDirectory: Setting to {}:", sysDir);
|
||||
|
|
|
@ -365,8 +365,6 @@ std::vector<u8> GenerateGct()
|
|||
|
||||
std::lock_guard<std::mutex> lk(s_active_codes_lock);
|
||||
|
||||
int i = 0;
|
||||
|
||||
// Write codes
|
||||
for (const GeckoCode& active_code : s_active_codes)
|
||||
{
|
||||
|
|
|
@ -99,9 +99,11 @@ void appendHalfToBuffer(std::vector<u8>* buf, u16 word)
|
|||
|
||||
std::string ConvertConnectCodeForGame(const std::string& input)
|
||||
{
|
||||
char fullWidthShiftJisHashtag[] = {(char)0x81, (char)0x94, (char)0x00};
|
||||
// Shift-Jis '#' symbol is two bytes (0x8194), followed by 0x00 null terminator
|
||||
char fullWidthShiftJisHashtag[] = {-127, -108, 0}; // 0x81, 0x94, 0x00
|
||||
std::string connectCode(input);
|
||||
connectCode = ReplaceAll(connectCode, "#", fullWidthShiftJisHashtag);
|
||||
// SLIPPITODO:Not the best use of ReplaceAll. potential bug if more than one '#' found.
|
||||
connectCode = ReplaceAll(connectCode, "#", std::string(fullWidthShiftJisHashtag));
|
||||
connectCode.resize(CONNECT_CODE_LENGTH +
|
||||
2); // fixed length + full width (two byte) hashtag +1, null terminator +1
|
||||
return connectCode;
|
||||
|
@ -2144,7 +2146,7 @@ void CEXISlippi::prepareOnlineMatchState()
|
|||
onlineMatchBlock[0x84]);
|
||||
|
||||
// Turn pause on in direct, off in everything else
|
||||
u8* gameBitField3 = (u8*)&onlineMatchBlock[2];
|
||||
u8* gameBitField3 = static_cast<u8*>(&onlineMatchBlock[2]);
|
||||
*gameBitField3 = lastSearch.mode >= directMode ? *gameBitField3 & 0xF7 : *gameBitField3 | 0x8;
|
||||
//*gameBitField3 = *gameBitField3 | 0x8;
|
||||
|
||||
|
@ -2157,8 +2159,8 @@ void CEXISlippi::prepareOnlineMatchState()
|
|||
else
|
||||
rightTeamPlayers.push_back(i);
|
||||
}
|
||||
auto leftTeamSize = leftTeamPlayers.size();
|
||||
auto rightTeamSize = rightTeamPlayers.size();
|
||||
int leftTeamSize = static_cast<int>(leftTeamPlayers.size());
|
||||
int rightTeamSize = static_cast<int>(rightTeamPlayers.size());
|
||||
leftTeamPlayers.resize(4, 0);
|
||||
rightTeamPlayers.resize(4, 0);
|
||||
leftTeamPlayers[3] = static_cast<u8>(leftTeamSize);
|
||||
|
@ -2229,7 +2231,7 @@ void CEXISlippi::prepareOnlineMatchState()
|
|||
auto playerInfo = matchmaking->GetPlayerInfo();
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
std::string connectCode = i < playerInfo.size() ? playerInfo[i].connectCode : "";
|
||||
std::string connectCode = i < playerInfo.size() ? playerInfo[i].connect_code : "";
|
||||
#ifdef LOCAL_TESTING
|
||||
connectCode = defaultConnectCodes[i];
|
||||
#endif
|
||||
|
|
|
@ -16,18 +16,6 @@
|
|||
#include <json.hpp>
|
||||
using json = nlohmann::json;
|
||||
|
||||
inline size_t receive(char* ptr, size_t size, size_t nmemb, void* rcvBuf)
|
||||
{
|
||||
size_t len = size * nmemb;
|
||||
INFO_LOG(SLIPPI_ONLINE, "[User] Received data: %d", len);
|
||||
|
||||
std::string* buf = (std::string*)rcvBuf;
|
||||
|
||||
buf->insert(buf->end(), ptr, ptr + len);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
SlippiGameReporter::SlippiGameReporter(SlippiUser* user)
|
||||
{
|
||||
CURL* curl = curl_easy_init();
|
||||
|
@ -76,7 +64,7 @@ void SlippiGameReporter::StartReport(GameReport report)
|
|||
|
||||
void SlippiGameReporter::StartNewSession(std::vector<std::string> new_player_uids)
|
||||
{
|
||||
this->player_uids = new_player_uids;
|
||||
this->m_player_uids = new_player_uids;
|
||||
gameIndex = 1;
|
||||
}
|
||||
|
||||
|
@ -108,7 +96,7 @@ void SlippiGameReporter::ReportThreadHandler()
|
|||
for (int i = 0; i < report.players.size(); i++)
|
||||
{
|
||||
json p;
|
||||
p["uid"] = player_uids[i];
|
||||
p["uid"] = m_player_uids[i];
|
||||
p["damage_done"] = report.players[i].damage_done;
|
||||
p["stocks_remaining"] = report.players[i].stocks_remaining;
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ protected:
|
|||
struct curl_slist* m_curl_header_list = nullptr;
|
||||
|
||||
u32 gameIndex = 1;
|
||||
std::vector<std::string> player_uids;
|
||||
std::vector<std::string> m_player_uids;
|
||||
|
||||
SlippiUser* m_user;
|
||||
std::queue<GameReport> game_report_queue;
|
||||
|
|
|
@ -67,13 +67,13 @@ SlippiNetplayClient::SlippiNetplayClient(std::vector<std::string> addrs, std::ve
|
|||
|
||||
this->isDecider = isDecider;
|
||||
this->m_remotePlayerCount = remotePlayerCount;
|
||||
this->playerIdx = playerIdx;
|
||||
this->m_player_idx = playerIdx;
|
||||
|
||||
// Set up remote player data structures.
|
||||
int j = 0;
|
||||
for (int i = 0; i < SLIPPI_REMOTE_PLAYER_MAX; i++, j++)
|
||||
{
|
||||
if (j == playerIdx)
|
||||
if (j == m_player_idx)
|
||||
j++;
|
||||
this->matchInfo.remotePlayerSelections[i] = SlippiPlayerSelections();
|
||||
this->matchInfo.remotePlayerSelections[i].playerIdx = j;
|
||||
|
@ -151,7 +151,7 @@ SlippiNetplayClient::SlippiNetplayClient(bool isDecider)
|
|||
u8 SlippiNetplayClient::PlayerIdxFromPort(u8 port)
|
||||
{
|
||||
u8 p = port;
|
||||
if (port > playerIdx)
|
||||
if (port > m_player_idx)
|
||||
{
|
||||
p--;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ u8 SlippiNetplayClient::PlayerIdxFromPort(u8 port)
|
|||
|
||||
u8 SlippiNetplayClient::LocalPlayerPort()
|
||||
{
|
||||
return this->playerIdx;
|
||||
return this->m_player_idx;
|
||||
}
|
||||
|
||||
// called from ---NETPLAY--- thread
|
||||
|
@ -267,7 +267,7 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet, ENetPeer* peer)
|
|||
sf::Packet spac;
|
||||
spac << (NetPlay::MessageId)NetPlay::NP_MSG_SLIPPI_PAD_ACK;
|
||||
spac << frame;
|
||||
spac << playerIdx;
|
||||
spac << m_player_idx;
|
||||
INFO_LOG(SLIPPI_ONLINE, "Sending ack packet for frame %d (player %d) to peer at %d:%d", frame,
|
||||
packetPlayerPort, peer->address.host, peer->address.port);
|
||||
|
||||
|
@ -835,7 +835,7 @@ void SlippiNetplayClient::SendSlippiPad(std::unique_ptr<SlippiPad> pad)
|
|||
auto spac = std::make_unique<sf::Packet>();
|
||||
*spac << static_cast<NetPlay::MessageId>(NetPlay::NP_MSG_SLIPPI_PAD);
|
||||
*spac << frame;
|
||||
*spac << this->playerIdx;
|
||||
*spac << this->m_player_idx;
|
||||
// INFO_LOG(SLIPPI_ONLINE, "Sending a packet of inputs [%d]...", frame);
|
||||
for (auto it = localPadQueue.begin(); it != localPadQueue.end(); ++it)
|
||||
{
|
||||
|
@ -869,7 +869,7 @@ void SlippiNetplayClient::SendSlippiPad(std::unique_ptr<SlippiPad> pad)
|
|||
void SlippiNetplayClient::SetMatchSelections(SlippiPlayerSelections& s)
|
||||
{
|
||||
matchInfo.localPlayerSelections.Merge(s);
|
||||
matchInfo.localPlayerSelections.playerIdx = playerIdx;
|
||||
matchInfo.localPlayerSelections.playerIdx = m_player_idx;
|
||||
|
||||
// Send packet containing selections
|
||||
auto spac = std::make_unique<sf::Packet>();
|
||||
|
|
|
@ -192,7 +192,7 @@ protected:
|
|||
bool isConnectionSelected = false;
|
||||
bool isDecider = false;
|
||||
bool hasGameStarted = false;
|
||||
u8 playerIdx = 0;
|
||||
u8 m_player_idx = 0;
|
||||
|
||||
std::deque<std::unique_ptr<SlippiPad>> localPadQueue; // most recent inputs at start of deque
|
||||
std::deque<std::unique_ptr<SlippiPad>>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue