From bddb84c57d0ae4e7f49153c7db888e46b2707bc0 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Tue, 12 Nov 2024 14:47:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E8=BF=BD=E5=B8=A7?= =?UTF-8?q?=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/NesEmulator/CoreSupporter.cs | 2 +- .../Assets/Script/NesEmulator/NesEmulator.cs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs index 1a1ef83..5f66133 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/CoreSupporter.cs @@ -119,7 +119,7 @@ namespace AxibugEmuOnline.Client LastTestInput = rawData; App.log.Debug($"{DateTime.Now.ToString("hh:mm:ss.fff")} Input F:{App.roomMgr.netReplay.mCurrClientFrameIdx} | I:{rawData}"); } - App.roomMgr.SendRoomSingelPlayerInput((uint)App.roomMgr.netReplay.mCurrClientFrameIdx, rawData); + App.roomMgr.SendRoomSingelPlayerInput(frameIndex, rawData); } else { diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs index bda2299..1b77ee4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs @@ -72,9 +72,10 @@ namespace AxibugEmuOnline.Client var frameGap = App.roomMgr.netReplay.mDiffFrameCount; if (frameGap > 10000) return; - if (frameGap > 2 && frameGap < 6) skipFrameCount = 1; - else if (frameGap > 7 && frameGap < 12) skipFrameCount = 2; - else if (frameGap > 13 && frameGap < 20) skipFrameCount = 3; + if (frameGap <= 2) skipFrameCount = 0; + if (frameGap > 2 && frameGap < 6) skipFrameCount = 1 + 1; + else if (frameGap > 7 && frameGap < 12) skipFrameCount = 2 + 1; + else if (frameGap > 13 && frameGap < 20) skipFrameCount = 3 + 1; else skipFrameCount = frameGap - 2; if (skipFrameCount > 0) App.log.Debug($"SKIP FRAME : {skipFrameCount}"); -- 2.36.0.windows.1 From 4afcc2f1f13d927e45e87fde1094254a2168df5d Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Tue, 12 Nov 2024 14:55:45 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=BF=BD=E5=B8=A7=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Plugins/AxiReplay/NetReplay.cs | 22 +++++++++++++++++-- .../Assets/Script/NesEmulator/NesEmulator.cs | 10 +-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs index 132f97b..1dee7cf 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; namespace AxiReplay { @@ -104,6 +105,23 @@ namespace AxiReplay data = mCurrReplay; return result; - } + } + + public int GetSkipFrameCount() + { + var frameGap = mDiffFrameCount; + if (frameGap > 10000) return 0; + + int skip = 0; + + if (frameGap <= 2) skip = 0; + if (frameGap > 2 && frameGap < 6) skip = 1 + 1; + else if (frameGap > 7 && frameGap < 12) skip = 2 + 1; + else if (frameGap > 13 && frameGap < 20) skip = 3 + 1; + else skip = frameGap - 2; + + + return skip; + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs index 1b77ee4..425e9bc 100644 --- a/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/NesEmulator/NesEmulator.cs @@ -68,15 +68,7 @@ namespace AxibugEmuOnline.Client private void FixEmulatorFrame() { - int skipFrameCount = 0; - var frameGap = App.roomMgr.netReplay.mDiffFrameCount; - if (frameGap > 10000) return; - - if (frameGap <= 2) skipFrameCount = 0; - if (frameGap > 2 && frameGap < 6) skipFrameCount = 1 + 1; - else if (frameGap > 7 && frameGap < 12) skipFrameCount = 2 + 1; - else if (frameGap > 13 && frameGap < 20) skipFrameCount = 3 + 1; - else skipFrameCount = frameGap - 2; + var skipFrameCount = App.roomMgr.netReplay.GetSkipFrameCount(); if (skipFrameCount > 0) App.log.Debug($"SKIP FRAME : {skipFrameCount}"); for (int i = 0; i < skipFrameCount; i++) -- 2.36.0.windows.1