diff --git a/core/deps/ggpo/lib/ggpo/network/udp_proto.cpp b/core/deps/ggpo/lib/ggpo/network/udp_proto.cpp index 441f7540ec..738e183e18 100644 --- a/core/deps/ggpo/lib/ggpo/network/udp_proto.cpp +++ b/core/deps/ggpo/lib/ggpo/network/udp_proto.cpp @@ -62,6 +62,7 @@ UdpProtocol::UdpProtocol() : _oo_packet.msg = NULL; _send_latency = GGPOPlatform::GetConfigInt("GGPO_NETWORK_DELAY"); + _jam_latency = GGPOPlatform::GetConfigInt("GGPO_NETWORK_JAM_DELAY"); _oop_percent = GGPOPlatform::GetConfigInt("GGPO_OOP_PERCENT"); } @@ -822,6 +823,21 @@ UdpProtocol::PumpSendQueue() break; } } + + // simulate temporary packet jam + if (_jam_latency) { + if (!_enable_jam && (rand() % 600 == 0)) { + _enable_jam = true; + LogInfo("Jam!"); + } + if (_enable_jam) { + if ((int)GGPOPlatform::GetCurrentTimeMS() < entry.queue_time + _jam_latency) { + break; + } + _enable_jam = false; + } + } + if (_oop_percent && !_oo_packet.msg && ((rand() % 100) < _oop_percent)) { int delay = rand() % (_send_latency * 10 + 1000); Log("udpproto%d | creating rogue oop (seq: %d delay: %d)", _queue, entry.msg->hdr.sequence_number, delay); diff --git a/core/deps/ggpo/lib/ggpo/network/udp_proto.h b/core/deps/ggpo/lib/ggpo/network/udp_proto.h index c6b8a4c63c..8198f0d030 100644 --- a/core/deps/ggpo/lib/ggpo/network/udp_proto.h +++ b/core/deps/ggpo/lib/ggpo/network/udp_proto.h @@ -151,6 +151,8 @@ class UdpProtocol : public IPollSink uint16 _remote_magic_number; bool _connected; int _send_latency; + int _jam_latency; + bool _enable_jam; int _oop_percent; struct { int send_time; diff --git a/core/gdxsv/gdxsv.cpp b/core/gdxsv/gdxsv.cpp index a045bd5439..47b2c1cc44 100644 --- a/core/gdxsv/gdxsv.cpp +++ b/core/gdxsv/gdxsv.cpp @@ -6,7 +6,6 @@ #include #include -#include "cfg/cfg.h" #include "cfg/option.h" #include "emulator.h" #include "gdx_rpc.h" @@ -117,6 +116,10 @@ void Gdxsv::Reset() { config::GdxLocalPort = get_random_port_number(); } + if (config::GdxLoginKey.get().empty()) { + config::GdxLoginKey = GenerateLoginKey(); + } + NOTICE_LOG(COMMON, "gdxsv disk:%d server:%s loginkey:%s udp_port:%d", (int)disk_, config::GdxLobbyServer.get().c_str(), config::GdxLoginKey.get().c_str(), config::GdxLocalPort.get()); diff --git a/run.py b/run.py index e9c7146900..25b252e64d 100644 --- a/run.py +++ b/run.py @@ -100,7 +100,9 @@ def run(idx, *arg_list) -> subprocess.Popen: print(cmd) new_env = os.environ.copy() new_env["GGPO_NETWORK_DELAY"] = "16" - new_env["GGPO_OOP_PERCENT"] = "1" + # new_env["GGPO_OOP_PERCENT"] = "1" + if idx == 0: + new_env["GGPO_NETWORK_JAM_DELAY"] = "500" # else: new_env["GGPO_NETWORK_DELAY"] = "100" return subprocess.Popen(cmd, shell=True, env=new_env)