mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-09-01 15:16:22 +00:00
pull in project-slippi/Ishiiruka/commit/8c7b139b443f57a414428501113c994b7781d38c
This commit is contained in:
parent
1c714503d1
commit
14a2eeafbd
6 changed files with 55 additions and 19 deletions
|
@ -263,6 +263,8 @@ void SConfig::SaveSlippiSettings(IniFile& ini)
|
||||||
slippi->Set("ReplayMonthFolders", m_slippiReplayMonthFolders);
|
slippi->Set("ReplayMonthFolders", m_slippiReplayMonthFolders);
|
||||||
slippi->Set("ReplayDir", m_strSlippiReplayDir);
|
slippi->Set("ReplayDir", m_strSlippiReplayDir);
|
||||||
slippi->Set("PlaybackControls", m_slippiEnableSeek);
|
slippi->Set("PlaybackControls", m_slippiEnableSeek);
|
||||||
|
slippi->Set("ForceNetplayPort", m_slippiForceNetplayPort);
|
||||||
|
slippi->Set("NetplayPort", m_slippiNetplayPort);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::SaveMovieSettings(IniFile& ini)
|
void SConfig::SaveMovieSettings(IniFile& ini)
|
||||||
|
@ -541,7 +543,7 @@ void SConfig::LoadSlippiSettings(IniFile& ini)
|
||||||
IniFile::Section* slippi = ini.GetOrCreateSection("Slippi");
|
IniFile::Section* slippi = ini.GetOrCreateSection("Slippi");
|
||||||
|
|
||||||
slippi->Get("EnableSpectator", &m_enableSpectator, true);
|
slippi->Get("EnableSpectator", &m_enableSpectator, true);
|
||||||
slippi->Get("SpectatorLocalPort", &m_spectator_local_port, 51441);
|
slippi->Get("SpectatorPort", &m_spectatorPort, 51441);
|
||||||
slippi->Get("PlaybackControls", &m_slippiEnableSeek, true);
|
slippi->Get("PlaybackControls", &m_slippiEnableSeek, true);
|
||||||
slippi->Get("OnlineDelay", &m_slippiOnlineDelay, 2);
|
slippi->Get("OnlineDelay", &m_slippiOnlineDelay, 2);
|
||||||
slippi->Get("SaveReplays", &m_slippiSaveReplays, true);
|
slippi->Get("SaveReplays", &m_slippiSaveReplays, true);
|
||||||
|
@ -551,6 +553,8 @@ void SConfig::LoadSlippiSettings(IniFile& ini)
|
||||||
slippi->Get("ReplayDir", &m_strSlippiReplayDir, default_replay_dir);
|
slippi->Get("ReplayDir", &m_strSlippiReplayDir, default_replay_dir);
|
||||||
if (m_strSlippiReplayDir.empty())
|
if (m_strSlippiReplayDir.empty())
|
||||||
m_strSlippiReplayDir = default_replay_dir;
|
m_strSlippiReplayDir = default_replay_dir;
|
||||||
|
slippi->Get("ForceNetplayPort", &m_slippiForceNetplayPort, false);
|
||||||
|
slippi->Get("NetplayPort", &m_slippiNetplayPort, 2626);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SConfig::LoadMovieSettings(IniFile& ini)
|
void SConfig::LoadMovieSettings(IniFile& ini)
|
||||||
|
|
|
@ -164,7 +164,7 @@ struct SConfig
|
||||||
// Slippi
|
// Slippi
|
||||||
// enable Slippi Networking output
|
// enable Slippi Networking output
|
||||||
bool m_enableSpectator;
|
bool m_enableSpectator;
|
||||||
int m_spectator_local_port;
|
int m_spectatorPort = 51441;
|
||||||
std::string m_strSlippiInput;
|
std::string m_strSlippiInput;
|
||||||
int m_slippiOnlineDelay = 2;
|
int m_slippiOnlineDelay = 2;
|
||||||
bool m_slippiEnableSeek = true;
|
bool m_slippiEnableSeek = true;
|
||||||
|
@ -173,6 +173,8 @@ struct SConfig
|
||||||
bool m_slippiReplayMonthFolders = false;
|
bool m_slippiReplayMonthFolders = false;
|
||||||
std::string m_strSlippiReplayDir;
|
std::string m_strSlippiReplayDir;
|
||||||
bool m_blockingPipes = false;
|
bool m_blockingPipes = false;
|
||||||
|
bool m_slippiForceNetplayPort = false;
|
||||||
|
int m_slippiNetplayPort = 2626;
|
||||||
|
|
||||||
// Interface settings
|
// Interface settings
|
||||||
bool bConfirmStop = false;
|
bool bConfirmStop = false;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
#include "Common/Version.h"
|
#include "Common/Version.h"
|
||||||
|
#include "Core/ConfigManager.h"
|
||||||
|
|
||||||
#if defined __linux__ && HAVE_ALSA
|
#if defined __linux__ && HAVE_ALSA
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
|
@ -218,8 +219,8 @@ void SlippiMatchmaking::startMatchmaking()
|
||||||
auto userInfo = m_user->GetUserInfo();
|
auto userInfo = m_user->GetUserInfo();
|
||||||
while (m_client == nullptr && retryCount < 15)
|
while (m_client == nullptr && retryCount < 15)
|
||||||
{
|
{
|
||||||
if (userInfo.port > 0)
|
if (SConfig::GetInstance().m_slippiForceNetplayPort)
|
||||||
m_hostPort = userInfo.port;
|
m_hostPort = SConfig::GetInstance().m_slippiNetplayPort;
|
||||||
else
|
else
|
||||||
m_hostPort = 41000 + (generator() % 10000);
|
m_hostPort = 41000 + (generator() % 10000);
|
||||||
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Port to use: {}...", m_hostPort);
|
ERROR_LOG_FMT(SLIPPI_ONLINE, "[Matchmaking] Port to use: {}...", m_hostPort);
|
||||||
|
|
|
@ -273,7 +273,7 @@ void SlippiSpectateServer::SlippicommSocketThread(void)
|
||||||
|
|
||||||
ENetAddress server_address = {0};
|
ENetAddress server_address = {0};
|
||||||
server_address.host = ENET_HOST_ANY;
|
server_address.host = ENET_HOST_ANY;
|
||||||
server_address.port = SConfig::GetInstance().m_spectator_local_port;
|
server_address.port = SConfig::GetInstance().m_spectatorPort;
|
||||||
|
|
||||||
// Create the spectator server
|
// Create the spectator server
|
||||||
// This call can fail if the system is already listening on the specified port
|
// This call can fail if the system is already listening on the specified port
|
||||||
|
|
|
@ -312,7 +312,6 @@ SlippiUser::UserInfo SlippiUser::parseFile(std::string file_contents)
|
||||||
info.play_key = readString(res, "playKey");
|
info.play_key = readString(res, "playKey");
|
||||||
info.connect_code = readString(res, "connectCode");
|
info.connect_code = readString(res, "connectCode");
|
||||||
info.latest_version = readString(res, "latestVersion");
|
info.latest_version = readString(res, "latestVersion");
|
||||||
info.port = res.value("port", -1);
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,18 +20,6 @@ SlippiPane::SlippiPane(QWidget* parent) : QWidget(parent)
|
||||||
CreateLayout();
|
CreateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SlippiPane::BrowseReplayFolder()
|
|
||||||
{
|
|
||||||
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
|
|
||||||
this, tr("Select Replay Folder"),
|
|
||||||
QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir)));
|
|
||||||
if (!dir.isEmpty())
|
|
||||||
{
|
|
||||||
m_replay_folder_edit->setText(dir);
|
|
||||||
SConfig::GetInstance().m_strSlippiReplayDir = dir.toStdString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SlippiPane::CreateLayout()
|
void SlippiPane::CreateLayout()
|
||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
|
||||||
|
@ -84,7 +72,7 @@ void SlippiPane::CreateLayout()
|
||||||
layout->addWidget(online_settings);
|
layout->addWidget(online_settings);
|
||||||
|
|
||||||
auto* delay_spin = new QSpinBox();
|
auto* delay_spin = new QSpinBox();
|
||||||
delay_spin->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
delay_spin->setFixedSize(30, 25);
|
||||||
delay_spin->setRange(1, 9);
|
delay_spin->setRange(1, 9);
|
||||||
delay_spin->setToolTip(tr("Leave this at 2 unless consistently playing on 120+ ping. "
|
delay_spin->setToolTip(tr("Leave this at 2 unless consistently playing on 120+ ping. "
|
||||||
"Increasing this can cause unplayable input delay, and lowering it "
|
"Increasing this can cause unplayable input delay, and lowering it "
|
||||||
|
@ -93,6 +81,36 @@ void SlippiPane::CreateLayout()
|
||||||
delay_spin->setValue(SConfig::GetInstance().m_slippiOnlineDelay);
|
delay_spin->setValue(SConfig::GetInstance().m_slippiOnlineDelay);
|
||||||
connect(delay_spin, qOverload<int>(&QSpinBox::valueChanged), this,
|
connect(delay_spin, qOverload<int>(&QSpinBox::valueChanged), this,
|
||||||
[](int delay) { SConfig::GetInstance().m_slippiOnlineDelay = delay; });
|
[](int delay) { SConfig::GetInstance().m_slippiOnlineDelay = delay; });
|
||||||
|
|
||||||
|
auto* netplay_port_spin = new QSpinBox();
|
||||||
|
netplay_port_spin->setFixedSize(60, 25);
|
||||||
|
QSizePolicy sp_retain = netplay_port_spin->sizePolicy();
|
||||||
|
sp_retain.setRetainSizeWhenHidden(true);
|
||||||
|
netplay_port_spin->setSizePolicy(sp_retain);
|
||||||
|
netplay_port_spin->setRange(1000, 65535);
|
||||||
|
netplay_port_spin->setValue(SConfig::GetInstance().m_slippiNetplayPort);
|
||||||
|
if (!SConfig::GetInstance().m_slippiForceNetplayPort)
|
||||||
|
{
|
||||||
|
netplay_port_spin->hide();
|
||||||
|
}
|
||||||
|
auto* enable_force_netplay_port_checkbox = new QCheckBox(tr("Force Netplay Port:"));
|
||||||
|
enable_force_netplay_port_checkbox->setToolTip(
|
||||||
|
tr("Enable this to force Slippi to use a specific network port for online peer-to-peer "
|
||||||
|
"connections."));
|
||||||
|
|
||||||
|
enable_force_netplay_port_checkbox->setChecked(SConfig::GetInstance().m_slippiForceNetplayPort);
|
||||||
|
connect(enable_force_netplay_port_checkbox, &QCheckBox::toggled, this,
|
||||||
|
[netplay_port_spin](bool checked) {
|
||||||
|
SConfig::GetInstance().m_slippiForceNetplayPort = checked;
|
||||||
|
checked ? netplay_port_spin->show() : netplay_port_spin->hide();
|
||||||
|
});
|
||||||
|
auto* netplay_port_layout = new QGridLayout();
|
||||||
|
netplay_port_layout->setColumnStretch(1, 1);
|
||||||
|
netplay_port_layout->addWidget(enable_force_netplay_port_checkbox, 0, 0);
|
||||||
|
netplay_port_layout->addWidget(netplay_port_spin, 0, 1, Qt::AlignLeft);
|
||||||
|
|
||||||
|
online_settings_layout->addRow(netplay_port_layout);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
// Playback Settings
|
// Playback Settings
|
||||||
auto* playback_settings = new QGroupBox(tr("Playback Settings"));
|
auto* playback_settings = new QGroupBox(tr("Playback Settings"));
|
||||||
|
@ -114,3 +132,15 @@ void SlippiPane::CreateLayout()
|
||||||
[](bool checked) { SConfig::GetInstance().m_slippiEnableSeek = checked; });
|
[](bool checked) { SConfig::GetInstance().m_slippiEnableSeek = checked; });
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SlippiPane::BrowseReplayFolder()
|
||||||
|
{
|
||||||
|
QString dir = QDir::toNativeSeparators(QFileDialog::getExistingDirectory(
|
||||||
|
this, tr("Select Replay Folder"),
|
||||||
|
QString::fromStdString(SConfig::GetInstance().m_strSlippiReplayDir)));
|
||||||
|
if (!dir.isEmpty())
|
||||||
|
{
|
||||||
|
m_replay_folder_edit->setText(dir);
|
||||||
|
SConfig::GetInstance().m_strSlippiReplayDir = dir.toStdString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue