From 7eaa208c786e70a704d9b17633d28c64e2f38e58 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Tue, 7 Jan 2025 14:11:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E6=A8=A1=E6=8B=9F?= =?UTF-8?q?=E5=99=A8=E6=A0=B8=E5=BF=83=E6=8E=A5=E5=8F=A3IEmuCore=E5=90=84?= =?UTF-8?q?=E4=B8=AA=E6=96=B9=E6=B3=95=E7=9A=84=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/IEmuCore.cs | 16 ++++++++++++++-- .../Assets/Script/AppMain/Manager/AppEmu.cs | 2 +- .../Script/AppMain/NesEmulator/NesEmulator.cs | 5 ----- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs index 1583993d..44841572 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/IEmuCore.cs @@ -7,18 +7,30 @@ namespace AxibugEmuOnline.Client { GameObject gameObject { get; } + /// 获得模拟器核心中的状态快照对象 object GetState(); + /// 获得模拟器核心中的状态快照字节数据 byte[] GetStateBytes(); + /// 加载状态快照 + /// 该对象应该来自核心的方法的返回值,或是从返回的byte数组构建 void LoadState(object state); + /// 加载状态快照 + /// 该对象应该来自核心的返回的byte数组 void LoadStateFromBytes(byte[] data); + /// 暂停核心推帧 void Pause(); + /// 恢复核心推帧(从Pause状态恢复) void Resume(); - void SetupScheme(); + /// 启动模拟器逻辑 MsgBool StartGame(RomFile romFile); + /// 重置核心,通常由模拟器核心提供的功能 void DoReset(); + /// 获得模拟器核心的控制器设置器 + /// IControllerSetuper GetControllerSetuper(); - + /// 核心所属平台 RomPlatformType Platform { get; } + /// 获取当前模拟器帧序号,在加载快照和Reset后,应当重置为0 uint Frame { get; } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs index d994bb40..db5da709 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppEmu.cs @@ -63,7 +63,7 @@ namespace AxibugEmuOnline.Client.Manager LaunchUI.Instance.HideMainMenu(); InGameUI.Instance.Show(romFile, m_emuCore); - m_emuCore.SetupScheme(); + CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Gaming; m_controllerSetuper = m_emuCore.GetControllerSetuper(); diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs index b6977b31..8532f5b2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs @@ -103,11 +103,6 @@ namespace AxibugEmuOnline.Client NesCore.Reset(); } - public void SetupScheme() - { - CommandDispatcher.Instance.Current = CommandDispatcher.Instance.Gaming; - } - public void LoadState(object state) { NesCore.LoadState((State)state);