diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index da7b69565..c68eb2c91 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -117,6 +117,7 @@ OptionString DNS("DNS", "46.101.91.123", "network"); OptionString NetworkServer("server", "", "network"); Option EmulateBBA("EmulateBBA", false, "network"); Option GGPOEnable("GGPO", false, "network"); +Option GGPODelay("GGPODelay", 0, "network"); #ifdef SUPPORT_DISPMANX Option DispmanxMaintainAspect("maintain_aspect", true, "dispmanx"); diff --git a/core/cfg/option.h b/core/cfg/option.h index cb824e713..100d890f9 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -412,6 +412,7 @@ extern OptionString DNS; extern OptionString NetworkServer; extern Option EmulateBBA; extern Option GGPOEnable; +extern Option GGPODelay; #ifdef SUPPORT_DISPMANX extern Option DispmanxMaintainAspect; diff --git a/core/network/ggpo.cpp b/core/network/ggpo.cpp index 7568b4721..a4762d831 100644 --- a/core/network/ggpo.cpp +++ b/core/network/ggpo.cpp @@ -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); diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 80720a024..9bf12165a 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -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) { diff --git a/shell/libretro/option.cpp b/shell/libretro/option.cpp index e7d4ab618..f31f436d0 100644 --- a/shell/libretro/option.cpp +++ b/shell/libretro/option.cpp @@ -109,6 +109,7 @@ OptionString DNS("", "46.101.91.123"); OptionString NetworkServer("", ""); Option EmulateBBA("", false); // TODO Option GGPOEnable("", false); +Option GGPODelay("", 0); // Maple