Netplay: receive spectating option from frontend.
This commit is contained in:
parent
932f6f1b55
commit
a346e2b0e0
|
@ -1898,9 +1898,11 @@ bool Netplay::CreateSession(std::string nickname, s32 port, s32 max_players, std
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Netplay::JoinSession(std::string nickname, const std::string& hostname, s32 port, std::string password)
|
||||
bool Netplay::JoinSession(std::string nickname, const std::string& hostname, s32 port, std::string password, bool spectating)
|
||||
{
|
||||
s_local_session_password = password;
|
||||
s_local_spectating = spectating;
|
||||
|
||||
// TODO: input delay. GGPO Should support changing it on the fly.
|
||||
const s32 input_delay = 1;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ enum : s32
|
|||
MAX_PLAYERS = 2,
|
||||
|
||||
// Maximum number of spectators allowed to watch the session.
|
||||
MAX_SPECTATORS = 4,
|
||||
MAX_SPECTATORS = 1,
|
||||
|
||||
// Maximum netplay prediction frames
|
||||
MAX_ROLLBACK_FRAMES = 8,
|
||||
|
@ -32,7 +32,7 @@ enum : u8
|
|||
};
|
||||
|
||||
bool CreateSession(std::string nickname, s32 port, s32 max_players, std::string password);
|
||||
bool JoinSession(std::string nickname, const std::string& hostname, s32 port, std::string password);
|
||||
bool JoinSession(std::string nickname, const std::string& hostname, s32 port, std::string password, bool spectating);
|
||||
|
||||
bool IsActive();
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ void JoinNetplaySessionDialog::accept()
|
|||
const QString& nickname = m_ui.nickname->text();
|
||||
const QString& hostname = m_ui.hostname->text();
|
||||
const QString& password = m_ui.password->text();
|
||||
const bool spectating = m_ui.spectating->isChecked();
|
||||
QDialog::accept();
|
||||
|
||||
g_emu_thread->joinNetplaySession(nickname.trimmed(), hostname.trimmed(), port, password);
|
||||
|
|
|
@ -1092,16 +1092,17 @@ void EmuThread::createNetplaySession(const QString& nickname, qint32 port, qint3
|
|||
}
|
||||
|
||||
void EmuThread::joinNetplaySession(const QString& nickname, const QString& hostname, qint32 port,
|
||||
const QString& password)
|
||||
const QString& password, bool spectating)
|
||||
{
|
||||
if (!isOnThread())
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "joinNetplaySession", Qt::QueuedConnection, Q_ARG(const QString&, nickname),
|
||||
Q_ARG(const QString&, hostname), Q_ARG(qint32, port), Q_ARG(const QString&, password));
|
||||
Q_ARG(const QString&, hostname), Q_ARG(qint32, port), Q_ARG(const QString&, password),
|
||||
Q_ARG(bool, spectating));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Netplay::JoinSession(nickname.toStdString(), hostname.toStdString(), port, password.toStdString()))
|
||||
if (!Netplay::JoinSession(nickname.toStdString(), hostname.toStdString(), port, password.toStdString(), spectating))
|
||||
{
|
||||
errorReported(tr("Netplay Error"), tr("Failed to join netplay session. The log may contain more information."));
|
||||
return;
|
||||
|
|
|
@ -188,7 +188,7 @@ public Q_SLOTS:
|
|||
void applyCheat(quint32 index);
|
||||
void reloadPostProcessingShaders();
|
||||
void createNetplaySession(const QString& nickname, qint32 port, qint32 max_players, const QString& password);
|
||||
void joinNetplaySession(const QString& nickname, const QString& hostname, qint32 port, const QString& password);
|
||||
void joinNetplaySession(const QString& nickname, const QString& hostname, qint32 port, bool spectating);
|
||||
|
||||
private Q_SLOTS:
|
||||
void stopInThread();
|
||||
|
|
Loading…
Reference in New Issue