Skip to content

Commit

Permalink
[NetPlay] Prepare structures for future mitm_session argument
Browse files Browse the repository at this point in the history
  • Loading branch information
fabricecaruso committed Oct 14, 2023
1 parent f9debe8 commit 8b917f9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions es-app/src/FileData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,8 @@ std::string FileData::getlaunchCommand(LaunchGameOptions& options, bool includeC
if (!options.netplayClientPassword.empty())
pass = " -netplaypass " + options.netplayClientPassword;

// TODO : Add options.mitm_session when it's available

#if WIN32
if (Utils::String::toLower(command).find("retroarch.exe") != std::string::npos)
command = Utils::String::replace(command, "%NETPLAY%", "--connect " + options.ip + " --port " + std::to_string(options.port) + " --nick " + SystemConf::getInstance()->get("global.netplay.nickname"));
Expand Down
1 change: 1 addition & 0 deletions es-app/src/FileData.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct LaunchGameOptions
int netPlayMode;
std::string ip;
int port;
std::string session;

std::string core;
std::string netplayClientPassword;
Expand Down
4 changes: 4 additions & 0 deletions es-app/src/guis/GuiNetPlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@ bool GuiNetPlay::populateFromJson(const std::string json)
if (fields.HasMember("mitm_port") && fields["mitm_port"].IsInt())
game.mitm_port = fields["mitm_port"].GetInt();

if (fields.HasMember("mitm_session") && fields["mitm_session"].IsInt())
game.mitm_session = fields["mitm_session"].GetString();

if (fields.HasMember("fixed") && fields["fixed"].IsBool())
game.fixed = fields["fixed"].GetBool();

Expand Down Expand Up @@ -684,6 +687,7 @@ void GuiNetPlay::launchGame(LobbyAppEntry entry)
{
options.ip = entry.mitm_ip;
options.port = entry.mitm_port;
options.session = entry.mitm_session;
}
else
{
Expand Down
1 change: 1 addition & 0 deletions es-app/src/guis/GuiNetPlay.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct LobbyAppEntry
bool has_spectate_password;
std::string core_name;
int mitm_port;
std::string mitm_session;
bool fixed;
std::string retroarch_version;
int port;
Expand Down

0 comments on commit 8b917f9

Please sign in to comment.