封装即时存档

This commit is contained in:
sin365 2024-08-28 16:15:23 +08:00
parent 5310a9923a
commit 697fb8f63b
4 changed files with 28 additions and 4 deletions

View File

@ -1,11 +1,16 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
namespace MAME.Core
{
public class MAMEEmu : IDisposable
{
MameMainMotion mameMainMotion;
//byte[] mGameTileData;
//byte[] mtileListData;
public MAMEEmu()
{
mameMainMotion = new MameMainMotion();
@ -28,6 +33,25 @@ namespace MAME.Core
public void StartGame() => mameMainMotion.StartGame();
public void StopGame() => mameMainMotion.StopGame();
public void LoadState(BinaryReader sr)
{
Mame.paused = true;
Thread.Sleep(20);
State.loadstate_callback.Invoke(sr);
Mame.postload();
Thread.Sleep(20);
Mame.paused = false;
}
public void SaveState(BinaryWriter sw)
{
Mame.paused = true;
Thread.Sleep(20);
State.savestate_callback.Invoke(sw);
Thread.Sleep(20);
Mame.paused = false;
}
public void Dispose()
{
mameMainMotion.StopGame();

View File

@ -238,7 +238,7 @@ namespace MAME.Core
if (Machine.bRom)
{
Mame.exit_pending = true;
Thread.Sleep(100);
Thread.Sleep(50);
}
}

View File

@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<History>True|2024-08-28T04:54:14.9742502Z||;True|2024-08-28T12:09:37.5280942+08:00||;True|2024-08-28T12:07:03.6717540+08:00||;True|2024-08-07T18:02:59.4096796+08:00||;False|2024-08-07T18:02:44.0239078+08:00||;True|2024-07-31T17:00:23.0585720+08:00||;True|2024-07-31T17:00:19.8123170+08:00||;True|2024-07-30T20:51:40.9773933+08:00||;True|2024-07-30T17:04:12.3440051+08:00||;True|2024-07-30T17:01:28.0849009+08:00||;True|2024-07-30T10:36:57.5301145+08:00||;</History>
<History>True|2024-08-28T08:12:23.3416224Z||;True|2024-08-28T13:18:21.7983285+08:00||;True|2024-08-28T12:54:14.9742502+08:00||;True|2024-08-28T12:09:37.5280942+08:00||;True|2024-08-28T12:07:03.6717540+08:00||;True|2024-08-07T18:02:59.4096796+08:00||;False|2024-08-07T18:02:44.0239078+08:00||;True|2024-07-31T17:00:23.0585720+08:00||;True|2024-07-31T17:00:19.8123170+08:00||;True|2024-07-30T20:51:40.9773933+08:00||;True|2024-07-30T17:04:12.3440051+08:00||;True|2024-07-30T17:01:28.0849009+08:00||;True|2024-07-30T10:36:57.5301145+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

View File

@ -263,7 +263,7 @@ namespace MAME.Core
public static byte[] GetNeogeoRom(string sFile)
{
byte[] bb1;
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/neogeo/", sFile);
string path = System.IO.Path.Combine(Mame.RomRoot + "/neogeo/", sFile);
if (File.Exists(path))
{
EmuLogger.Log($"Had File => {path}");
@ -287,7 +287,7 @@ namespace MAME.Core
int n1;
foreach (string s1 in lsParents)
{
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/" + s1 + "/", sFile);
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + s1 + "/", sFile);
if (File.Exists(path))
{
EmuLogger.Log($"Had File => {path}");