forked from sin365/AxibugEmuOnline
Compare commits
No commits in common. "5dae909fa283df21ffe69e92975fa826ea97cb80" and "b54de1e162c5614147a0168899f0109c734379aa" have entirely different histories.
5dae909fa2
...
b54de1e162
@ -12,14 +12,10 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class NesEmulator : MonoBehaviour, IEmuCore
|
||||
{
|
||||
//模拟器核心实例化对象
|
||||
public NES NesCore { get; private set; }
|
||||
|
||||
//视频驱动(这里是Unity接收模拟器画面数据的并渲染出来的实现)
|
||||
public VideoProvider VideoProvider;
|
||||
//音频驱动(这里是Unity接收模拟器音频数据的并播放出来的实现)
|
||||
public AudioProvider AudioProvider;
|
||||
//是否暂停
|
||||
public bool m_bPause;
|
||||
|
||||
private void Start()
|
||||
@ -29,10 +25,6 @@ namespace AxibugEmuOnline.Client
|
||||
AudioProvider.NesEmu = this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 指定ROM开始游戏
|
||||
/// </summary>
|
||||
/// <param name="rom"></param>
|
||||
public void StartGame(RomFile rom)
|
||||
{
|
||||
StopGame();
|
||||
@ -53,18 +45,12 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止游戏
|
||||
/// </summary>
|
||||
public void StopGame()
|
||||
{
|
||||
NesCore?.Dispose();
|
||||
NesCore = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unity的逐帧驱动
|
||||
/// </summary>
|
||||
private unsafe void Update()
|
||||
{
|
||||
if (m_bPause) return;
|
||||
@ -80,7 +66,6 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
//是否跳帧,单机无效
|
||||
private void FixEmulatorFrame()
|
||||
{
|
||||
var skipFrameCount = App.roomMgr.netReplay.GetSkipFrameCount();
|
||||
@ -93,7 +78,6 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
ControllerState lastState;
|
||||
//推进帧
|
||||
private bool PushEmulatorFrame()
|
||||
{
|
||||
Supporter.SampleInput(NesCore.FrameCount);
|
||||
@ -148,19 +132,11 @@ namespace AxibugEmuOnline.Client
|
||||
return NesCore.GetState();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取即时存档
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public byte[] GetStateBytes()
|
||||
{
|
||||
return NesCore.GetState().ToBytes();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载即时存档
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public void LoadStateFromBytes(byte[] data)
|
||||
{
|
||||
State st = new State();
|
||||
@ -169,9 +145,6 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑器用
|
||||
/// </summary>
|
||||
[Conditional("UNITY_EDITOR")]
|
||||
[ContextMenu("ImportNesDB")]
|
||||
public void ImportNesDB()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user