热机逻辑:主要解决NEOGEO问题,避免加入其他人房间自动联机时,加载流程,cpu一次都没执行,部分逻辑没有初始化

This commit is contained in:
sin365 2025-10-18 12:01:07 +08:00
parent f340888f30
commit 75e80df577
3 changed files with 12 additions and 5 deletions

View File

@ -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;
}

View File

@ -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];
}

View File

@ -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
{