From 75e80df5776ef58d1af264796371ebdf83817fa7 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Sat, 18 Oct 2025 12:01:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=83=AD=E6=9C=BA=E9=80=BB=E8=BE=91=EF=BC=9A?= =?UTF-8?q?=E4=B8=BB=E8=A6=81=E8=A7=A3=E5=86=B3NEOGEO=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=8A=A0=E5=85=A5=E5=85=B6=E4=BB=96?= =?UTF-8?q?=E4=BA=BA=E6=88=BF=E9=97=B4=E8=87=AA=E5=8A=A8=E8=81=94=E6=9C=BA?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=8A=A0=E8=BD=BD=E6=B5=81=E7=A8=8B=EF=BC=8C?= =?UTF-8?q?cpu=E4=B8=80=E6=AC=A1=E9=83=BD=E6=B2=A1=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=EF=BC=8C=E9=83=A8=E5=88=86=E9=80=BB=E8=BE=91=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Plugins/Mame.Core/MAMEEmu.cs | 12 ++++++++++-- .../Assets/Plugins/Mame.Core/sound/Streams.cs | 4 ++-- AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs | 1 - 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/MAMEEmu.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/MAMEEmu.cs index 5301e634..90b0d9dc 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/MAMEEmu.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/MAMEEmu.cs @@ -42,10 +42,18 @@ namespace MAME.Core public bool IsPaused => Mame.paused; public void LoadState(System.IO.BinaryReader sr) { + //热机逻辑:主要解决NEOGEO问题,避免加入其他人房间自动联机时,加载流程,cpu一次都没执行,部分逻辑没有初始化。 + //再加载数据之前,推若干帧,确保所有组件充分初始化 + for (int i = 0; i < 5; i++) + { + UpdateFrame(); + } Mame.paused = true; Thread.Sleep(20); - State.loadstate_callback.Invoke(sr); + Mame.soft_reset();//软重启一次,确保没有脏数据 + State.loadstate_callback(sr); Mame.postload(); + Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; mameMainMotion.ResetFreameIndex(); Thread.Sleep(20); Mame.paused = false; @@ -55,7 +63,7 @@ namespace MAME.Core { Mame.paused = true; Thread.Sleep(20); - State.savestate_callback.Invoke(sw); + State.savestate_callback(sw); Thread.Sleep(20); Mame.paused = false; } diff --git a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/Streams.cs b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/Streams.cs index 32407a9b..4f345e2f 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/Streams.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/Mame.Core/sound/Streams.cs @@ -119,8 +119,8 @@ namespace MAME.Core //} //这是一个Monkey Patch, 这里一维数组是0~2,二位数组可能不正常 - int maxcount = Math.Min(streamoutput[i].Length, max_samples_per_update); - for (j = 0; j < maxcount; j++) + max_samples_per_update = Math.Min(max_samples_per_update, streamoutput[i].Length - samples_to_lose); + for (j = 0; j < max_samples_per_update; j++) { streamoutput[i][j] = streamoutput[i][samples_to_lose + j]; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs index caa455ce..bbca725e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/App.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using UnityEngine; using static AxibugEmuOnline.Client.HttpAPI; using static AxibugEmuOnline.Client.Manager.LogManager; -using static AxibugEmuOnline.Client.SaveFile; namespace AxibugEmuOnline.Client.ClientCore {