ggpo: add frame delay to settings (#343)

This commit is contained in:
Enrique Santos 2021-09-04 09:47:21 -07:00 committed by GitHub
parent f35a18bb63
commit e3aca85efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 1 deletions

View File

@ -117,6 +117,7 @@ OptionString DNS("DNS", "46.101.91.123", "network");
OptionString NetworkServer("server", "", "network");
Option<bool> EmulateBBA("EmulateBBA", false, "network");
Option<bool> GGPOEnable("GGPO", false, "network");
Option<int> GGPODelay("GGPODelay", 0, "network");
#ifdef SUPPORT_DISPMANX
Option<bool> DispmanxMaintainAspect("maintain_aspect", true, "dispmanx");

View File

@ -412,6 +412,7 @@ extern OptionString DNS;
extern OptionString NetworkServer;
extern Option<bool> EmulateBBA;
extern Option<bool> GGPOEnable;
extern Option<int> GGPODelay;
#ifdef SUPPORT_DISPMANX
extern Option<bool> DispmanxMaintainAspect;

View File

@ -361,7 +361,7 @@ void startSession(int localPort, int localPlayerNum)
ggpoSession = nullptr;
return;
}
// ggpo_set_frame_delay(ggpoSession, localPlayer, FRAME_DELAY);
ggpo_set_frame_delay(ggpoSession, localPlayer, config::GGPODelay.get());
size_t colon = config::NetworkServer.get().find(':');
std::string peerIp = config::NetworkServer.get().substr(0, colon);
@ -512,6 +512,12 @@ void displayStats()
ImGui::Text("Send Q");
ImGui::ProgressBar(stats.network.send_queue_len / 10.f, ImVec2(-1, 10.f * scaling), "");
// Frame Delay
ImGui::Text("Delay");
std::string delay = std::to_string(config::GGPODelay.get());
ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(delay.c_str()).x);
ImGui::Text("%s", delay.c_str());
// Ping
ImGui::Text("Ping");
std::string ping = std::to_string(stats.network.ping);

View File

@ -1719,6 +1719,9 @@ static void gui_display_settings()
ImGui::SameLine();
ShowHelpMarker("Your peer IP address and optional port");
config::NetworkServer.set(server_name);
OptionSlider("Frame Delay", config::GGPODelay, 0, 20,
"Sets Frame Delay, advisable for sessions with ping >100 ms");
}
else if (config::NetworkEnable)
{

View File

@ -109,6 +109,7 @@ OptionString DNS("", "46.101.91.123");
OptionString NetworkServer("", "");
Option<bool> EmulateBBA("", false); // TODO
Option<bool> GGPOEnable("", false);
Option<int> GGPODelay("", 0);
// Maple